Skip to content

Commit

Permalink
Do not update hasOutlineAutoAncestor when moving out a spanner's rend…
Browse files Browse the repository at this point in the history
…erer

https://bugs.webkit.org/show_bug.cgi?id=255956
rdar://107953410

Reviewed by Alan Baradlay.

When we move out a spanner's renderer, we might set the renderer as having
a hasOutlineAutoAncestor value of true and leave the spanner placeholder
with a hasOutlineAutoAncestor value of false. This is because when we move
out the spanner's renderer we set hasOutlineAutoAncestor based on its new
parent. However we want to maintain a value consistent with spanner's placholder.

* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
We want to check if the originalRenderer needs a repaint, not the placeholder.

* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::attachToRenderElementInternal):

Canonical link: https://commits.webkit.org/263501@main
  • Loading branch information
jace0x21 authored and Ahmad Saleem committed Apr 28, 2023
1 parent 63d0be6 commit 25d4c61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Source/WebCore/rendering/RenderObject.cpp
Expand Up @@ -926,21 +926,21 @@ void RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded(const RenderL
renderer = renderMultiColumnPlaceholder;
}

bool rendererHasOutlineAutoAncestor = renderer->hasOutlineAutoAncestor();
bool rendererHasOutlineAutoAncestor = renderer->hasOutlineAutoAncestor() || originalRenderer->hasOutlineAutoAncestor();
ASSERT(rendererHasOutlineAutoAncestor
|| renderer->outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On
|| originalRenderer->outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On
|| (is<RenderBoxModelObject>(*renderer) && downcast<RenderBoxModelObject>(*renderer).isContinuation()));
if (originalRenderer == &repaintContainer && rendererHasOutlineAutoAncestor)
repaintRectNeedsConverting = true;
if (rendererHasOutlineAutoAncestor)
continue;
// Issue repaint on the correct repaint container.
LayoutRect adjustedRepaintRect = repaintRect;
adjustedRepaintRect.inflate(renderer->outlineStyleForRepaint().outlineSize());
adjustedRepaintRect.inflate(originalRenderer->outlineStyleForRepaint().outlineSize());
if (!repaintRectNeedsConverting)
repaintContainer.repaintRectangle(adjustedRepaintRect);
else if (is<RenderLayerModelObject>(renderer)) {
const auto& rendererWithOutline = downcast<RenderLayerModelObject>(*renderer);
else if (is<RenderLayerModelObject>(originalRenderer)) {
const auto& rendererWithOutline = downcast<RenderLayerModelObject>(*originalRenderer);
adjustedRepaintRect = LayoutRect(repaintContainer.localToContainerQuad(FloatRect(adjustedRepaintRect), &rendererWithOutline).boundingBox());
rendererWithOutline.repaintRectangle(adjustedRepaintRect);
}
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Expand Up @@ -457,7 +457,8 @@ void RenderTreeBuilder::attachToRenderElementInternal(RenderElement& parent, Ren
cache->childrenChanged(&parent, newChild);

if (parent.hasOutlineAutoAncestor() || parent.outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On)
newChild->setHasOutlineAutoAncestor();
if (!is<RenderMultiColumnSet>(newChild->previousSibling()))
newChild->setHasOutlineAutoAncestor();
}

void RenderTreeBuilder::move(RenderBoxModelObject& from, RenderBoxModelObject& to, RenderObject& child, RenderObject* beforeChild, NormalizeAfterInsertion normalizeAfterInsertion)
Expand Down

0 comments on commit 25d4c61

Please sign in to comment.