Changeset 286846 in webkit
- Timestamp:
- Dec 10, 2021, 5:51:02 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
rendering/svg/RenderSVGModelObject.cpp (modified) (3 diffs)
-
rendering/svg/RenderSVGModelObject.h (modified) (1 diff)
-
svg/SVGElement.cpp (modified) (2 diffs)
-
svg/SVGSVGElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286845 r286846 1 2021-12-10 Nikolas Zimmermann <nzimmermann@igalia.com> 2 3 [LBSE] Create RenderSVGRoot renderer for outermost <svg> and allow direct <rect> children 4 https://bugs.webkit.org/show_bug.cgi?id=233873 5 6 Reviewed by Rob Buis. 7 8 Construct RenderSVGRoot renderers for the outermost <svg> element when LBSE is enabled. 9 An 'allowlist' approach is used to only create renderers for those SVG elements that 10 are aware of LBSE: outermost <svg> element + <rect> element. For all other elements 11 no renderers will be created in LBSE for now. 12 13 This patch leaves the legacy engine unchanged (probed by EWS & local test runs), 14 and also LBSE shows no assertions/crashes/hangs in release/debug builds - tested 15 with "run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled". 16 17 Note that many layout tests will either timeout or show a different result, 18 due to the small capabilities of LBSE at present. Therefore it's beneficial to 19 decrease timeouts / use more workers when running layout tests. Otherwise they 20 will take a long time to complete. On my macOS Monterey M1 MacBook, following 21 parameters lead to a reasonable test execution time: 22 23 run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled --timeout=5000 \ 24 --no-sample-on-timeout --no-retry-failures --child-processes=15 \ 25 [--release / --debug] svg 26 27 Covered by existing tests. 28 29 * rendering/svg/RenderSVGModelObject.cpp: 30 (WebCore::RenderSVGModelObject::clippedOverflowRect const): 31 (WebCore::RenderSVGModelObject::nodeAtPoint): 32 * rendering/svg/RenderSVGModelObject.h: 33 (WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const): 34 * svg/SVGElement.cpp: 35 (WebCore::createSVGLayerAwareElementSet): 36 (WebCore::isSVGLayerAwareElement): 37 (WebCore::SVGElement::childShouldCreateRenderer const): 38 * svg/SVGSVGElement.cpp: 39 (WebCore::SVGSVGElement::createElementRenderer): 40 1 41 2021-12-10 Antti Koivisto <antti@apple.com> 2 42 -
trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
r285195 r286846 32 32 #include "RenderSVGModelObject.h" 33 33 34 #include "NotImplemented.h" 35 #include "RenderLayer.h" 34 36 #include "RenderLayerModelObject.h" 35 37 #include "RenderSVGResource.h" 38 #include "RenderView.h" 36 39 #include "SVGElementInlines.h" 37 40 #include "SVGNames.h" … … 49 52 } 50 53 51 LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const 52 { 54 LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const 55 { 56 #if ENABLE(LAYER_BASED_SVG_ENGINE) 57 if (document().settings().layerBasedSVGEngineEnabled()) { 58 if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent()) 59 return LayoutRect(); 60 61 ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled()); 62 return computeRect(visualOverflowRectEquivalent(), repaintContainer, context); 63 } 64 #else 65 UNUSED_PARAM(context); 66 #endif 67 53 68 return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); 54 69 } … … 112 127 bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) 113 128 { 129 #if ENABLE(LAYER_BASED_SVG_ENGINE) 130 if (document().settings().layerBasedSVGEngineEnabled()) { 131 // FIXME: [LBSE] Upstream RenderSVGModelObject inheritance changes (should inherit from RenderLayerModelObject). 132 notImplemented(); 133 return false; 134 } 135 #endif 136 114 137 ASSERT_NOT_REACHED(); 115 138 return false; -
trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h
r281239 r286846 63 63 SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); } 64 64 65 // FIXME: [LBSE] Upstream SVGBoundingBoxComputation 66 // LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); } 67 LayoutRect visualOverflowRectEquivalent() const { return LayoutRect(); } 68 65 69 protected: 66 70 RenderSVGModelObject(SVGElement&, RenderStyle&&); -
trunk/Source/WebCore/svg/SVGElement.cpp
r286843 r286846 525 525 } 526 526 527 #if ENABLE(LAYER_BASED_SVG_ENGINE) 528 static MemoryCompactLookupOnlyRobinHoodHashSet<AtomString> createSVGLayerAwareElementSet() 529 { 530 // List of all SVG elements whose renderers support the layer aware layout / painting / hit-testing mode ('LBSE-mode'). 531 using namespace SVGNames; 532 MemoryCompactLookupOnlyRobinHoodHashSet<AtomString> set; 533 for (auto& tag : { rectTag.get() }) 534 set.add(tag.localName()); 535 return set; 536 } 537 538 static inline bool isSVGLayerAwareElement(const SVGElement& element) 539 { 540 static NeverDestroyed<MemoryCompactLookupOnlyRobinHoodHashSet<AtomString>> set = createSVGLayerAwareElementSet(); 541 return set.get().contains(element.localName()); 542 } 543 #endif 544 527 545 bool SVGElement::childShouldCreateRenderer(const Node& child) const 528 546 { … … 534 552 // If the layer based SVG engine is enabled, all renderers that do not support the 535 553 // RenderLayer aware layout / painting / hit-testing mode ('LBSE-mode') have to be skipped. 536 // Currently all renderers are skipped.554 // FIXME: [LBSE] Upstream support for all elements, and remove 'isSVGLayerAwareElement' check afterwards. 537 555 if (document().settings().layerBasedSVGEngineEnabled()) 538 return false;556 return isSVGLayerAwareElement(svgChild); 539 557 #endif 540 558 -
trunk/Source/WebCore/svg/SVGSVGElement.cpp
r286843 r286846 399 399 RenderPtr<RenderElement> SVGSVGElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) 400 400 { 401 if (isOutermostSVGSVGElement()) 401 if (isOutermostSVGSVGElement()) { 402 #if ENABLE(LAYER_BASED_SVG_ENGINE) 403 if (document().settings().layerBasedSVGEngineEnabled()) 404 return createRenderer<RenderSVGRoot>(*this, WTFMove(style)); 405 #endif 402 406 return createRenderer<LegacyRenderSVGRoot>(*this, WTFMove(style)); 407 } 403 408 return createRenderer<RenderSVGViewportContainer>(*this, WTFMove(style)); 404 409 }
Note:
See TracChangeset
for help on using the changeset viewer.