Title: [289207] trunk/Source/WebCore
- Revision
- 289207
- Author
- [email protected]
- Date
- 2022-02-07 04:51:20 -0800 (Mon, 07 Feb 2022)
Log Message
[LBSE] Apply position / size to SVG layers
https://bugs.webkit.org/show_bug.cgi?id=236187
Reviewed by Rob Buis.
Teach RenderLayer::updateLayerPosition() about RenderSVGModelObject
derived renderers that create layers. Grab size and position information
from the SVG render tree, just as done for CSS boxes in the render tree.
To minimize the RenderLayer changes, and most importantly to let SVG
look like a regular CSS object from the outside a compatibility layer
is exposed offering methods such as 'frameRectEquivalent()',
'visualOverflowRectEquivalent()' and offers utility methods such as
'applyTopLeftLocationOffsetEquivalent(localPoint)'. The terminology
stems from CSS and is usually not present in SVG -- however to simplify
the RenderLayer implementation and emphazise the analogy between
RenderBox and RenderSVGModelObject the utility methods help a lot.
SVG no longer looks special and one doesn't need to think hard what
the best matching equivalent to a 'visualOverflowRect' in SVG, or
if coordinate system origins are identical or not, etc.
Covered by existing tests, no change in behaviour.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::recursiveUpdateLayerPositions):
(WebCore::RenderLayer::updateLayerPosition):
(WebCore::RenderLayer::calculateClipRects const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289206 => 289207)
--- trunk/Source/WebCore/ChangeLog 2022-02-07 11:47:58 UTC (rev 289206)
+++ trunk/Source/WebCore/ChangeLog 2022-02-07 12:51:20 UTC (rev 289207)
@@ -1,5 +1,36 @@
2022-02-07 Nikolas Zimmermann <[email protected]>
+ [LBSE] Apply position / size to SVG layers
+ https://bugs.webkit.org/show_bug.cgi?id=236187
+
+ Reviewed by Rob Buis.
+
+ Teach RenderLayer::updateLayerPosition() about RenderSVGModelObject
+ derived renderers that create layers. Grab size and position information
+ from the SVG render tree, just as done for CSS boxes in the render tree.
+
+ To minimize the RenderLayer changes, and most importantly to let SVG
+ look like a regular CSS object from the outside a compatibility layer
+ is exposed offering methods such as 'frameRectEquivalent()',
+ 'visualOverflowRectEquivalent()' and offers utility methods such as
+ 'applyTopLeftLocationOffsetEquivalent(localPoint)'. The terminology
+ stems from CSS and is usually not present in SVG -- however to simplify
+ the RenderLayer implementation and emphazise the analogy between
+ RenderBox and RenderSVGModelObject the utility methods help a lot.
+
+ SVG no longer looks special and one doesn't need to think hard what
+ the best matching equivalent to a 'visualOverflowRect' in SVG, or
+ if coordinate system origins are identical or not, etc.
+
+ Covered by existing tests, no change in behaviour.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::recursiveUpdateLayerPositions):
+ (WebCore::RenderLayer::updateLayerPosition):
+ (WebCore::RenderLayer::calculateClipRects const):
+
+2022-02-07 Nikolas Zimmermann <[email protected]>
+
[LBSE] Suppress non-foreground paint phases for SVG shapes & images
https://bugs.webkit.org/show_bug.cgi?id=236189
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (289206 => 289207)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-02-07 11:47:58 UTC (rev 289206)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-02-07 12:51:20 UTC (rev 289207)
@@ -107,8 +107,11 @@
#include "RenderReplica.h"
#include "RenderSVGContainer.h"
#include "RenderSVGForeignObject.h"
+#include "RenderSVGInline.h"
#include "RenderSVGModelObject.h"
#include "RenderSVGResourceClipper.h"
+#include "RenderSVGRoot.h"
+#include "RenderSVGText.h"
#include "RenderScrollbar.h"
#include "RenderScrollbarPart.h"
#include "RenderTableCell.h"
@@ -1062,6 +1065,17 @@
}
}
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ if (renderer().isSVGLayerAwareRenderer() && renderer().document().settings().layerBasedSVGEngineEnabled()) {
+ if (!is<RenderSVGRoot>(renderer()))
+ ASSERT(!renderer().isFixedPositioned());
+
+ // Only the outermost <svg> and / <foreignObject> are potentially scrollable.
+ if (is<RenderSVGModelObject>(renderer()) || is<RenderSVGText>(renderer()) || is<RenderSVGInline>(renderer()))
+ ASSERT(!m_scrollableArea);
+ }
+#endif
+
if (isComposited())
backing()->updateAfterLayout(flags.contains(ContainingClippingLayerChangedSize), flags.contains(NeedsFullRepaintInBacking));
@@ -1681,6 +1695,19 @@
}
box->applyTopLeftLocationOffset(localPoint);
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ } else if (is<RenderSVGModelObject>(renderer())) {
+ auto& svgRenderer = downcast<RenderSVGModelObject>(renderer());
+ auto newSize = enclosingIntRect(svgRenderer.frameRectEquivalent()).size();
+ if (newSize != size()) {
+ if (flags && renderer().hasNonVisibleOverflow())
+ flags->add(ContainingClippingLayerChangedSize);
+
+ setSize(newSize);
+ }
+
+ svgRenderer.applyTopLeftLocationOffsetEquivalent(localPoint);
+#endif
}
if (!renderer().isOutOfFlowPositioned()) {
@@ -4851,6 +4878,10 @@
LayoutRect result;
if (renderer().isInline() && is<RenderInline>(renderer()))
result = downcast<RenderInline>(renderer()).linesVisualOverflowBoundingBox();
+#if ENABLE(LAYER_BASED_SVG_ENGINE)
+ else if (is<RenderSVGModelObject>(renderer()))
+ result = downcast<RenderSVGModelObject>(renderer()).visualOverflowRectEquivalent();
+#endif
else if (is<RenderTableRow>(renderer())) {
auto& tableRow = downcast<RenderTableRow>(renderer());
// Our bounding box is just the union of all of our cells' border/overflow rects.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes