Changeset 292382 in webkit
- Timestamp:
- Apr 5, 2022 1:03:38 AM (4 months ago)
- Location:
- trunk
- Files:
-
- 7 added
- 7 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-geometry-box-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-geometry-box.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-shape-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-shape.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-url-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/motion/offset-path-url.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/rendering/PathOperation.cpp (added)
-
Source/WebCore/rendering/PathOperation.h (modified) (5 diffs)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (2 diffs)
-
Source/WebCore/style/StyleBuilderConverter.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r292376 r292382 1 2022-04-05 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Support rendering url(), CSS basic shapes other than path(), and coord-box for offset-path 4 https://bugs.webkit.org/show_bug.cgi?id=233382 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/motion/offset-path-shape-expected.html: Added. 9 * web-platform-tests/css/motion/offset-path-shape.html: Added. 10 * web-platform-tests/css/motion/offset-path-url-expected.html: Added. 11 * web-platform-tests/css/motion/offset-path-url.html: Added. 12 1 13 2022-04-04 Ziran Sun <zsun@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r292381 r292382 1 2022-04-05 Nikolaos Mouchtaris <nmouchtaris@apple.com> 2 3 Support rendering url(), CSS basic shapes other than path(), and coord-box for offset-path 4 https://bugs.webkit.org/show_bug.cgi?id=233382 5 6 Reviewed by Simon Fraser. 7 8 Introduce support for url(), CSS basic shapes, and coord-box. Url() allows references to SVG 9 shapes, so we check for either an SVGPathElement or SVGGeometryElement (which includes 10 circles, polygons, etc.). We can then get a Path object for that particular SVGElement 11 using pathFromGraphicsElement(). For coord-box, we check the value for the BoxPathOperation 12 (if it exists) in updateTransform(), and choose the corresponding reference box to the 13 referenceBox() value of the BoxPathOperation. 14 15 Tests: imported/w3c/web-platform-tests/css/motion/offset-path-shape.html 16 imported/w3c/web-platform-tests/css/motion/offset-path-url.html 17 18 * Sources.txt: 19 * rendering/PathOperation.cpp: Added. 20 (WebCore::ReferencePathOperation::create): 21 (WebCore::ReferencePathOperation::ReferencePathOperation): 22 (WebCore::ReferencePathOperation::element const): 23 * rendering/PathOperation.h: 24 * rendering/RenderLayer.cpp: 25 (WebCore::RenderLayer::updateTransform): 26 * rendering/style/RenderStyle.cpp: 27 (WebCore::getPathFromPathOperation): 28 * style/StyleBuilderConverter.h: 29 (WebCore::Style::BuilderConverter::convertPathOperation): 30 1 31 2022-04-05 Megan Gardner <megan_gardner@apple.com> 2 32 -
trunk/Source/WebCore/Sources.txt
r292210 r292382 2328 2328 rendering/MarkedText.cpp 2329 2329 rendering/OrderIterator.cpp 2330 rendering/PathOperation.cpp 2330 2331 rendering/PointerEventsHitRules.cpp 2331 2332 rendering/ReferencedSVGResources.cpp -
trunk/Source/WebCore/rendering/PathOperation.h
r286086 r292382 39 39 namespace WebCore { 40 40 41 class SVGElement; 42 41 43 class PathOperation : public RefCounted<PathOperation> { 42 44 public: … … 67 69 class ReferencePathOperation final : public PathOperation { 68 70 public: 69 static Ref<ReferencePathOperation> create(const String& url, const String& fragment) 70 { 71 return adoptRef(*new ReferencePathOperation(url, fragment)); 72 } 73 71 static Ref<ReferencePathOperation> create(const String& url, const String& fragment, const RefPtr<SVGElement>); 74 72 const String& url() const { return m_url; } 75 73 const String& fragment() const { return m_fragment; } 74 const SVGElement* element() const; 76 75 77 76 private: … … 84 83 } 85 84 86 ReferencePathOperation(const String& url, const String& fragment) 87 : PathOperation(Reference) 88 , m_url(url) 89 , m_fragment(fragment) 90 { 91 } 85 ReferencePathOperation(const String& url, const String& fragment, const RefPtr<SVGElement>); 92 86 93 87 String m_url; 94 88 String m_fragment; 89 RefPtr<SVGElement> m_element; 95 90 }; 96 91 … … 143 138 return path; 144 139 } 140 141 void setPathForReferenceRect(const FloatRoundedRect& boundingRect) 142 { 143 m_path.clear(); 144 m_path.addRoundedRect(boundingRect); 145 } 146 147 const Path getPath() const { return m_path; } 145 148 CSSBoxType referenceBox() const { return m_referenceBox; } 146 149 … … 159 162 { 160 163 } 161 164 Path m_path; 162 165 CSSBoxType m_referenceBox; 163 166 }; -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r292364 r292382 1335 1335 // FIXME: [LBSE] Upstream reference box computation for RenderSVGModelObject derived renderers 1336 1336 FloatRect referenceBox; 1337 if (is<RenderBox>(renderer())) 1337 if (is<RenderBox>(renderer())) { 1338 1338 referenceBox = snapRectToDevicePixels(downcast<RenderBox>(renderer()).referenceBox(transformBoxToCSSBoxType(renderer().style().transformBox())), renderer().document().deviceScaleFactor()); 1339 if (auto pathOperation = renderer().style().offsetPath()) { 1340 if (is<BoxPathOperation>(pathOperation)) { 1341 auto boxPathOperation = downcast<BoxPathOperation>(pathOperation); 1342 boxPathOperation->setPathForReferenceRect(FloatRoundedRect(snapRectToDevicePixels(downcast<RenderBox>(renderer()).referenceBox(boxPathOperation->referenceBox()), renderer().document().deviceScaleFactor()))); 1343 } 1344 } 1345 } 1339 1346 1340 1347 renderer().applyTransform(*m_transform, referenceBox); -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r291946 r292382 42 42 #include "RenderObject.h" 43 43 #include "RenderTheme.h" 44 #include "SVGPathData.h" 44 45 #include "ScaleTransformOperation.h" 45 46 #include "ShadowData.h" … … 1524 1525 static std::optional<Path> getPathFromPathOperation(const FloatRect& box, const PathOperation& operation) 1525 1526 { 1526 if (operation.type() == PathOperation::Shape) 1527 switch (operation.type()) { 1528 case PathOperation::Shape: 1527 1529 return downcast<ShapePathOperation>(operation).pathForReferenceRect(box); 1528 1529 // FIXME: support Reference and Box type. 1530 // https://bugs.webkit.org/show_bug.cgi?id=233382 1531 return std::nullopt; 1530 case PathOperation::Reference: 1531 if (!is<SVGPathElement>(downcast<ReferencePathOperation>(operation).element()) && !is<SVGGeometryElement>(downcast<ReferencePathOperation>(operation).element())) 1532 return std::nullopt; 1533 return pathFromGraphicsElement(downcast<ReferencePathOperation>(operation).element()); 1534 case PathOperation::Box: 1535 return downcast<BoxPathOperation>(operation).getPath(); 1536 case PathOperation::Ray: 1537 // FIXME: implement ray- https://bugs.webkit.org/show_bug.cgi?id=233344 1538 return std::nullopt; 1539 } 1532 1540 } 1533 1541 -
trunk/Source/WebCore/style/StyleBuilderConverter.h
r291956 r292382 56 56 #include "QuotesData.h" 57 57 #include "RuntimeEnabledFeatures.h" 58 #include "SVGElementTypeHelpers.h" 59 #include "SVGPathElement.h" 58 60 #include "SVGURIReference.h" 59 61 #include "Settings.h" … … 634 636 String fragment = SVGURIReference::fragmentIdentifierFromIRIString(cssURLValue, builderState.document()); 635 637 // FIXME: It doesn't work with external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=126133) 636 return ReferencePathOperation::create(cssURLValue, fragment); 638 auto target = SVGURIReference::targetElementFromIRIString(cssURLValue, builderState.document()); 639 return ReferencePathOperation::create(cssURLValue, fragment, downcast<SVGElement>(target.element.get())); 637 640 } 638 641 ASSERT(primitiveValue.valueID() == CSSValueNone);
Note: See TracChangeset
for help on using the changeset viewer.