Skip to content

Commit

Permalink
[LBSE] Support outlines
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=269917

Reviewed by Nikolas Zimmermann.

Support outline painting by adding and using RenderSVGModelObject::paintSVGOutline as well
as using default LayoutRepainter mode of including outlines in repaint rectangle calculations.

* LayoutTests/platform/mac-sonoma-wk2-lbse-text/TestExpectations:
* Source/WebCore/rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
(WebCore::RenderSVGContainer::paint):
* Source/WebCore/rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paint):
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::paintSVGOutline):
* Source/WebCore/rendering/svg/RenderSVGModelObject.h:
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::layout):
(WebCore::RenderSVGShape::paint):

Canonical link: https://commits.webkit.org/275682@main
  • Loading branch information
rwlbuis committed Mar 5, 2024
1 parent 1ff489b commit 8807535
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ svg/transforms/svgsvgelement-transform.svg [ ImageOnlyFailure ]

# Outline / focus-ring support
svg/custom/focus-ring.svg [ Failure ]
svg/custom/rgba-color-outline.svg [ ImageOnlyFailure ]
svg/text/text-outline-rgba.html [ ImageOnlyFailure ]

# Text rendering visually different
imported/w3c/web-platform-tests/svg/import/fonts-desc-01-t-manual.svg [ ImageOnlyFailure ]
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void RenderSVGContainer::layout()
StackStats::LayoutCheckPoint layoutCheckPoint;
ASSERT(needsLayout());

LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && !isRenderSVGResourceMarker(), RepaintOutlineBounds::No);
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && !isRenderSVGResourceMarker());

// Update layer transform before laying out children (SVG needs access to the transform matrices during layout for on-screen text font-size calculations).
// Eventually re-update if the transform reference box, relevant for transform-origin, has changed during layout.
Expand Down Expand Up @@ -137,8 +137,7 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, const LayoutPoint& paintOff
return;

if (paintInfo.phase == PaintPhase::Outline || paintInfo.phase == PaintPhase::SelfOutline) {
// FIXME: [LBSE] Upstream outline painting
// paintSVGOutline(paintInfo, adjustedPaintOffset);
paintSVGOutline(paintInfo, adjustedPaintOffset);
return;
}

Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/rendering/svg/RenderSVGImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
return;

if (paintInfo.phase == PaintPhase::Outline || paintInfo.phase == PaintPhase::SelfOutline) {
// FIXME: [LBSE] Upstream outline painting
// paintSVGOutline(paintInfo, adjustedPaintOffset);
paintSVGOutline(paintInfo, adjustedPaintOffset);
return;
}

Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ Path RenderSVGModelObject::computeClipPath(AffineTransform& transform) const
return pathFromGraphicsElement(Ref { downcast<SVGGraphicsElement>(element()) });
}

void RenderSVGModelObject::paintSVGOutline(PaintInfo& paintInfo, const LayoutPoint& adjustedPaintOffset)
{
paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, borderBoxRectEquivalent().size()));
}

} // namespace WebCore

#endif // ENABLE(LAYER_BASED_SVG_ENGINE)
3 changes: 1 addition & 2 deletions Source/WebCore/rendering/svg/RenderSVGModelObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ class RenderSVGModelObject : public RenderLayerModelObject {
void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;

void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) const override;
// FIXME: [LBSE] Upstream SVG outline painting functionality
// void paintSVGOutline(PaintInfo&, const LayoutPoint& adjustedPaintOffset);
void paintSVGOutline(PaintInfo&, const LayoutPoint& adjustedPaintOffset);

// Returns false if the rect has no intersection with the applied clip rect. When the context specifies edge-inclusive
// intersection, this return value allows distinguishing between no intersection and zero-area intersection.
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ void RenderSVGRoot::layout()
}

clearOverflow();
if (!shouldApplyViewportClip()) {
if (!shouldApplyViewportClip())
addVisualOverflow(visualOverflowRectEquivalent());
addVisualEffectOverflow();
}
addVisualEffectOverflow();

invalidateBackgroundObscurationStatus();

Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/rendering/svg/RenderSVGShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void RenderSVGShape::layout()
{
StackStats::LayoutCheckPoint layoutCheckPoint;

LayoutRepainter repainter(*this, checkForRepaintDuringLayout(), RepaintOutlineBounds::No);
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
if (m_needsShapeUpdate) {
updateShapeFromElement();

Expand Down Expand Up @@ -244,8 +244,7 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
return;

if (paintInfo.phase == PaintPhase::Outline || paintInfo.phase == PaintPhase::SelfOutline) {
// FIXME: [LBSE] Upstream outline painting
// paintSVGOutline(paintInfo, adjustedPaintOffset);
paintSVGOutline(paintInfo, adjustedPaintOffset);
return;
}

Expand Down

0 comments on commit 8807535

Please sign in to comment.