Changeset 287873 in webkit
- Timestamp:
- Jan 11, 2022, 4:57:41 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 9 edited
-
ChangeLog (modified) (1 diff)
-
Sources.txt (modified) (1 diff)
-
WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
rendering/svg/LegacyRenderSVGModelObject.h (modified) (1 diff)
-
rendering/svg/RenderSVGModelObject.h (modified) (2 diffs)
-
rendering/svg/RenderSVGRoot.cpp (modified) (2 diffs)
-
rendering/svg/RenderSVGRoot.h (modified) (2 diffs)
-
rendering/svg/RenderSVGShape.cpp (modified) (2 diffs)
-
rendering/svg/RenderSVGShape.h (modified) (2 diffs)
-
rendering/svg/SVGBoundingBoxComputation.cpp (added)
-
rendering/svg/SVGBoundingBoxComputation.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287872 r287873 1 2022-01-11 Nikolas Zimmermann <nzimmermann@igalia.com> 2 3 [LBSE] Introduce SVGBoundingBoxComputation 4 https://bugs.webkit.org/show_bug.cgi?id=234632 5 <rdar://problem/87001334> 6 7 Reviewed by Rob Buis. 8 9 Upstream SVGBoundingBoxComputation, a utility class 10 implementing the SVG2 "bounding box computation" algorithm, 11 as spec'ed in https://svgwg.org/svg2-draft/coords.html#BoundingBoxes. 12 13 SVG2 also specifies a new optional argument for getBBox() & friends: 14 DOMRect getBBox(optional SVGBoundingBoxOptions options = {}); 15 16 SVGBoundingBoxOptions can be implemented using SVGBoundingBoxComputation: 17 exposing this to the Web is left for the future, once more of LBSE is ready. 18 19 LBSE utilizes SVGBoundingBoxComputation whenever any kind of bounding box 20 needs to be computed (object / stroke / decorated (e.g. including markers). 21 22 Covered by existing tests, no change in behaviour. 23 24 * Sources.txt: 25 * WebCore.xcodeproj/project.pbxproj: 26 * rendering/svg/LegacyRenderSVGModelObject.h: 27 (WebCore::LegacyRenderSVGModelObject::visualOverflowRectEquivalent const): Deleted. 28 * rendering/svg/RenderSVGModelObject.h: 29 (WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const): 30 * rendering/svg/RenderSVGRoot.cpp: 31 (WebCore::RenderSVGRoot::layout): 32 * rendering/svg/RenderSVGRoot.h: 33 * rendering/svg/SVGBoundingBoxComputation.cpp: Added. 34 (WebCore::SVGBoundingBoxComputation::SVGBoundingBoxComputation): 35 (WebCore::SVGBoundingBoxComputation::~SVGBoundingBoxComputation): 36 (WebCore::SVGBoundingBoxComputation::computeDecoratedBoundingBox const): 37 (WebCore::SVGBoundingBoxComputation::handleShapeOrTextOrInline const): 38 (WebCore::SVGBoundingBoxComputation::handleRootOrContainer const): 39 (WebCore::SVGBoundingBoxComputation::handleForeignObjectOrImage const): 40 (WebCore::SVGBoundingBoxComputation::adjustBoxForClippingAndEffects const): 41 * rendering/svg/SVGBoundingBoxComputation.h: Added. 42 (WebCore::SVGBoundingBoxComputation::computeDecoratedBoundingBox): 43 (WebCore::SVGBoundingBoxComputation::computeRepaintBoundingBox): 44 (WebCore::SVGBoundingBoxComputation::computeVisualOverflowRect): 45 1 46 2022-01-11 Carlos Garcia Campos <cgarcia@igalia.com> 2 47 -
trunk/Source/WebCore/Sources.txt
r287834 r287873 2502 2502 rendering/svg/RenderSVGTransformableContainer.cpp 2503 2503 rendering/svg/RenderSVGViewportContainer.cpp 2504 rendering/svg/SVGBoundingBoxComputation.cpp 2504 2505 rendering/svg/SVGInlineFlowBox.cpp 2505 2506 rendering/svg/SVGInlineTextBox.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r287834 r287873 245 245 0854B01B1255E4E600B9CDD0 /* RenderSVGTextPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B0091255E4E600B9CDD0 /* RenderSVGTextPath.h */; }; 246 246 0854B01D1255E4E600B9CDD0 /* RenderSVGTSpan.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B00B1255E4E600B9CDD0 /* RenderSVGTSpan.h */; }; 247 0844B01D1255B4E600B9CDD0 /* SVGBoundingBoxComputation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0844B01D1255E4E600B9CDD0 /* SVGBoundingBoxComputation.h */; }; 247 248 0854B01F1255E4E600B9CDD0 /* SVGInlineFlowBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B00D1255E4E600B9CDD0 /* SVGInlineFlowBox.h */; }; 248 249 0854B0211255E4E600B9CDD0 /* SVGInlineTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0854B00F1255E4E600B9CDD0 /* SVGInlineTextBox.h */; }; … … 6186 6187 0854B0091255E4E600B9CDD0 /* RenderSVGTextPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTextPath.h; sourceTree = "<group>"; }; 6187 6188 0854B00B1255E4E600B9CDD0 /* RenderSVGTSpan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTSpan.h; sourceTree = "<group>"; }; 6189 0834B00C1244E4E600B9CDD0 /* SVGBoundingBoxComputation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGBoundingBoxComputation.cpp; sourceTree = "<group>"; }; 6190 0844B01D1255E4E600B9CDD0 /* SVGBoundingBoxComputation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGBoundingBoxComputation.h; sourceTree = "<group>"; }; 6188 6191 0854B00C1255E4E600B9CDD0 /* SVGInlineFlowBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGInlineFlowBox.cpp; sourceTree = "<group>"; }; 6189 6192 0854B00D1255E4E600B9CDD0 /* SVGInlineFlowBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGInlineFlowBox.h; sourceTree = "<group>"; }; … … 18995 18998 436708AB12D9CA4B00044234 /* RenderSVGViewportContainer.cpp */, 18996 18999 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */, 19000 0834B00C1244E4E600B9CDD0 /* SVGBoundingBoxComputation.cpp */, 19001 0844B01D1255E4E600B9CDD0 /* SVGBoundingBoxComputation.h */, 18997 19002 0854B00C1255E4E600B9CDD0 /* SVGInlineFlowBox.cpp */, 18998 19003 0854B00D1255E4E600B9CDD0 /* SVGInlineFlowBox.h */, … … 37316 37321 B22279950D00BF220071B782 /* SVGAnimateTransformElement.h in Headers */, 37317 37322 B22279980D00BF220071B782 /* SVGAnimationElement.h in Headers */, 37323 0844B01D1255B4E600B9CDD0 /* SVGBoundingBoxComputation.h in Headers */, 37318 37324 B222799C0D00BF220071B782 /* SVGCircleElement.h in Headers */, 37319 37325 B222799F0D00BF220071B782 /* SVGClipPathElement.h in Headers */, -
trunk/Source/WebCore/rendering/svg/LegacyRenderSVGModelObject.h
r286962 r287873 63 63 SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); } 64 64 65 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation66 // LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); }67 LayoutRect visualOverflowRectEquivalent() const { return LayoutRect(); }68 69 65 protected: 70 66 LegacyRenderSVGModelObject(SVGElement&, RenderStyle&&); -
trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h
r287538 r287873 35 35 #include "RenderLayer.h" 36 36 #include "RenderLayerModelObject.h" 37 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 38 // #include "SVGBoundingBoxComputation.h" 37 #include "SVGBoundingBoxComputation.h" 39 38 #include "SVGElement.h" 40 39 #include "SVGRenderSupport.h" … … 70 69 LayoutRect frameRectEquivalent() const { return m_layoutRect; } 71 70 72 LayoutRect visualOverflowRectEquivalent() const 73 { 74 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 75 // return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); 76 return LayoutRect(); 77 } 71 LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); } 78 72 79 73 void applyTopLeftLocationOffsetEquivalent(LayoutPoint& point) const { point.moveBy(layoutLocation()); } -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r287731 r287873 194 194 updateLayerInformation(); 195 195 196 /* FIXME: [LBSE] Upstream SVGContainerLayout / SVGBoundingBoxComputation197 196 { 197 /* FIXME: [LBSE] Upstream SVGContainerLayout 198 198 SVGContainerLayout containerLayout(*this); 199 199 containerLayout.layoutChildren(needsLayout || SVGRenderSupport::filtersForceContainerLayout(*this)); 200 */ 200 201 201 202 SVGBoundingBoxComputation boundingBoxComputation(*this); … … 203 204 m_strokeBoundingBox = boundingBoxComputation.computeDecoratedBoundingBox(SVGBoundingBoxComputation::strokeBoundingBoxDecoration); 204 205 } 205 */206 206 207 207 // FIXME: [LBSE] Upstream SVGContainerLayout -- remove SVGRenderSupport::layoutChildren. -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h
r286842 r287873 27 27 #include "FloatRect.h" 28 28 #include "RenderReplaced.h" 29 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 30 // #include "SVGBoundingBoxComputation.h" 29 #include "SVGBoundingBoxComputation.h" 31 30 32 31 namespace WebCore { … … 73 72 FloatRect objectBoundingBox() const final { return m_objectBoundingBox; } 74 73 FloatRect strokeBoundingBox() const final { return m_strokeBoundingBox; } 74 FloatRect repaintRectInLocalCoordinates() const final { return SVGBoundingBoxComputation::computeRepaintBoundingBox(*this); } 75 75 76 // FIXME: [LBSE] Mark final, add repaintBoundingBox() to RenderObject 77 FloatRect repaintBoundingBox() const 78 { 79 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 80 // return SVGBoundingBoxComputation::computeRepaintBoundingBox(*this); 81 return m_strokeBoundingBox; 82 } 83 84 LayoutRect visualOverflowRectEquivalent() const 85 { 86 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 87 // return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); 88 return LayoutRect(); 89 } 76 LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); } 90 77 91 78 private: -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r287832 r287873 401 401 } 402 402 403 FloatRect RenderSVGShape::computeMarkerBoundingBox( ) const403 FloatRect RenderSVGShape::computeMarkerBoundingBox(const SVGBoundingBoxComputation::DecorationOptions&) const 404 404 { 405 405 if (m_markerPositions.isEmpty()) … … 418 418 unsigned size = m_markerPositions.size(); 419 419 for (unsigned i = 0; i < size; ++i) { 420 if (RenderSVGResourceMarker* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd)) 420 if (auto* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd)) { 421 // FIXME: [LBSE] Upstream RenderSVGResourceMarker changes 422 // boundaries.unite(marker->computeMarkerBoundingBox(options, marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth()))); 421 423 boundaries.unite(marker->markerBoundaries(marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth()))); 424 } 422 425 } 423 426 return boundaries; -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.h
r287832 r287873 31 31 #include "FloatRect.h" 32 32 #include "RenderSVGModelObject.h" 33 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 34 // #include "SVGBoundingBoxComputation.h" 33 #include "SVGBoundingBoxComputation.h" 35 34 #include "SVGGraphicsElement.h" 36 35 #include "SVGMarkerData.h" … … 81 80 FloatRect objectBoundingBox() const final { return m_fillBoundingBox; } 82 81 FloatRect strokeBoundingBox() const final { return m_strokeBoundingBox; } 82 FloatRect repaintRectInLocalCoordinates() const final { return SVGBoundingBoxComputation::computeRepaintBoundingBox(*this); } 83 83 84 FloatRect repaintRectInLocalCoordinates() const final 85 { 86 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 87 // return SVGBoundingBoxComputation::computeRepaintBoundingBox(*this); } 88 return FloatRect(); 89 } 90 91 FloatRect computeMarkerBoundingBox() const; 84 FloatRect computeMarkerBoundingBox(const SVGBoundingBoxComputation::DecorationOptions&) const; 92 85 93 86 protected:
Note:
See TracChangeset
for help on using the changeset viewer.