Title: [286846] trunk/Source/WebCore
- Revision
- 286846
- Author
- zimmerm...@webkit.org
- Date
- 2021-12-10 05:51:02 -0800 (Fri, 10 Dec 2021)
Log Message
[LBSE] Create RenderSVGRoot renderer for outermost <svg> and allow direct <rect> children
https://bugs.webkit.org/show_bug.cgi?id=233873
Reviewed by Rob Buis.
Construct RenderSVGRoot renderers for the outermost <svg> element when LBSE is enabled.
An 'allowlist' approach is used to only create renderers for those SVG elements that
are aware of LBSE: outermost <svg> element + <rect> element. For all other elements
no renderers will be created in LBSE for now.
This patch leaves the legacy engine unchanged (probed by EWS & local test runs),
and also LBSE shows no assertions/crashes/hangs in release/debug builds - tested
with "run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled".
Note that many layout tests will either timeout or show a different result,
due to the small capabilities of LBSE at present. Therefore it's beneficial to
decrease timeouts / use more workers when running layout tests. Otherwise they
will take a long time to complete. On my macOS Monterey M1 MacBook, following
parameters lead to a reasonable test execution time:
run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled --timeout=5000 \
--no-sample-on-timeout --no-retry-failures --child-processes=15 \
[--release / --debug] svg
Covered by existing tests.
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::clippedOverflowRect const):
(WebCore::RenderSVGModelObject::nodeAtPoint):
* rendering/svg/RenderSVGModelObject.h:
(WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const):
* svg/SVGElement.cpp:
(WebCore::createSVGLayerAwareElementSet):
(WebCore::isSVGLayerAwareElement):
(WebCore::SVGElement::childShouldCreateRenderer const):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createElementRenderer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (286845 => 286846)
--- trunk/Source/WebCore/ChangeLog 2021-12-10 13:28:28 UTC (rev 286845)
+++ trunk/Source/WebCore/ChangeLog 2021-12-10 13:51:02 UTC (rev 286846)
@@ -1,3 +1,43 @@
+2021-12-10 Nikolas Zimmermann <nzimmerm...@igalia.com>
+
+ [LBSE] Create RenderSVGRoot renderer for outermost <svg> and allow direct <rect> children
+ https://bugs.webkit.org/show_bug.cgi?id=233873
+
+ Reviewed by Rob Buis.
+
+ Construct RenderSVGRoot renderers for the outermost <svg> element when LBSE is enabled.
+ An 'allowlist' approach is used to only create renderers for those SVG elements that
+ are aware of LBSE: outermost <svg> element + <rect> element. For all other elements
+ no renderers will be created in LBSE for now.
+
+ This patch leaves the legacy engine unchanged (probed by EWS & local test runs),
+ and also LBSE shows no assertions/crashes/hangs in release/debug builds - tested
+ with "run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled".
+
+ Note that many layout tests will either timeout or show a different result,
+ due to the small capabilities of LBSE at present. Therefore it's beneficial to
+ decrease timeouts / use more workers when running layout tests. Otherwise they
+ will take a long time to complete. On my macOS Monterey M1 MacBook, following
+ parameters lead to a reasonable test execution time:
+
+ run-webkit-tests --internal-feature=LayerBasedSVGEngineEnabled --timeout=5000 \
+ --no-sample-on-timeout --no-retry-failures --child-processes=15 \
+ [--release / --debug] svg
+
+ Covered by existing tests.
+
+ * rendering/svg/RenderSVGModelObject.cpp:
+ (WebCore::RenderSVGModelObject::clippedOverflowRect const):
+ (WebCore::RenderSVGModelObject::nodeAtPoint):
+ * rendering/svg/RenderSVGModelObject.h:
+ (WebCore::RenderSVGModelObject::visualOverflowRectEquivalent const):
+ * svg/SVGElement.cpp:
+ (WebCore::createSVGLayerAwareElementSet):
+ (WebCore::isSVGLayerAwareElement):
+ (WebCore::SVGElement::childShouldCreateRenderer const):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::createElementRenderer):
+
2021-12-10 Antti Koivisto <an...@apple.com>
[CSS Container Queries] Basic @container at-rule parsing support
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp (286845 => 286846)
--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp 2021-12-10 13:28:28 UTC (rev 286845)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp 2021-12-10 13:51:02 UTC (rev 286846)
@@ -31,8 +31,11 @@
#include "config.h"
#include "RenderSVGModelObject.h"
+#include "NotImplemented.h"
+#include "RenderLayer.h"
#include "RenderLayerModelObject.h"
#include "RenderSVGResource.h"
+#include "RenderView.h"
#include "SVGElementInlines.h"
#include "SVGNames.h"
#include "SVGResourcesCache.h"
@@ -48,8 +51,20 @@
{
}
-LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext) const
+LayoutRect RenderSVGModelObject::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
{
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ if (document().settings().layerBasedSVGEngineEnabled()) {
+ if (style().visibility() != Visibility::Visible && !enclosingLayer()->hasVisibleContent())
+ return LayoutRect();
+
+ ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled());
+ return computeRect(visualOverflowRectEquivalent(), repaintContainer, context);
+ }
+#else
+ UNUSED_PARAM(context);
+#endif
+
return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
}
@@ -111,6 +126,14 @@
bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction)
{
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ if (document().settings().layerBasedSVGEngineEnabled()) {
+ // FIXME: [LBSE] Upstream RenderSVGModelObject inheritance changes (should inherit from RenderLayerModelObject).
+ notImplemented();
+ return false;
+ }
+#endif
+
ASSERT_NOT_REACHED();
return false;
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h (286845 => 286846)
--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h 2021-12-10 13:28:28 UTC (rev 286845)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h 2021-12-10 13:51:02 UTC (rev 286846)
@@ -62,6 +62,10 @@
SVGElement& element() const { return downcast<SVGElement>(nodeForNonAnonymous()); }
+ // FIXME: [LBSE] Upstream SVGBoundingBoxComputation
+ // LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); }
+ LayoutRect visualOverflowRectEquivalent() const { return LayoutRect(); }
+
protected:
RenderSVGModelObject(SVGElement&, RenderStyle&&);
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (286845 => 286846)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2021-12-10 13:28:28 UTC (rev 286845)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2021-12-10 13:51:02 UTC (rev 286846)
@@ -524,6 +524,24 @@
invalidateInstances();
}
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+static MemoryCompactLookupOnlyRobinHoodHashSet<AtomString> createSVGLayerAwareElementSet()
+{
+ // List of all SVG elements whose renderers support the layer aware layout / painting / hit-testing mode ('LBSE-mode').
+ using namespace SVGNames;
+ MemoryCompactLookupOnlyRobinHoodHashSet<AtomString> set;
+ for (auto& tag : { rectTag.get() })
+ set.add(tag.localName());
+ return set;
+}
+
+static inline bool isSVGLayerAwareElement(const SVGElement& element)
+{
+ static NeverDestroyed<MemoryCompactLookupOnlyRobinHoodHashSet<AtomString>> set = createSVGLayerAwareElementSet();
+ return set.get().contains(element.localName());
+}
+#endif
+
bool SVGElement::childShouldCreateRenderer(const Node& child) const
{
if (!child.isSVGElement())
@@ -533,9 +551,9 @@
#if ENABLE(LAYER_BASED_SVG_ENGINE)
// If the layer based SVG engine is enabled, all renderers that do not support the
// RenderLayer aware layout / painting / hit-testing mode ('LBSE-mode') have to be skipped.
- // Currently all renderers are skipped.
+ // FIXME: [LBSE] Upstream support for all elements, and remove 'isSVGLayerAwareElement' check afterwards.
if (document().settings().layerBasedSVGEngineEnabled())
- return false;
+ return isSVGLayerAwareElement(svgChild);
#endif
static const QualifiedName* const invalidTextContent[] {
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (286845 => 286846)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2021-12-10 13:28:28 UTC (rev 286845)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2021-12-10 13:51:02 UTC (rev 286846)
@@ -398,8 +398,13 @@
RenderPtr<RenderElement> SVGSVGElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
- if (isOutermostSVGSVGElement())
+ if (isOutermostSVGSVGElement()) {
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ if (document().settings().layerBasedSVGEngineEnabled())
+ return createRenderer<RenderSVGRoot>(*this, WTFMove(style));
+#endif
return createRenderer<LegacyRenderSVGRoot>(*this, WTFMove(style));
+ }
return createRenderer<RenderSVGViewportContainer>(*this, WTFMove(style));
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes