haikuwebkit/LayoutTests/compositing/sub-layer-focus-ring-expect...

41 lines
595 B
HTML
Raw Permalink Normal View History

Focus ring for a child layer is incorrectly offset by ancestor composited layer's position https://bugs.webkit.org/show_bug.cgi?id=110895 Reviewed by Simon Fraser. Source/WebCore: Test: compositing/sub-layer-focus-ring.html The problem occurs in RenderBlock::addFocusRingRects() where the absolute position of a sub-layer is used to calculate the focus ring rect of the layer. Should use the relative position to the current paintContainer instead. To fix the issue: - RenderLayer passes LayerPaintingInfo.rootLayer to PaintInfo.paintContainer - Let RenderObject::paintFocusRing() and RenderObject::paintOutline() take PaintInfo instead of GraphicsContext* so that the paintContainer can be passed - RenderBlock::addFocusRingRects() uses localToContainerPoint(FloatPoint(), paintContainer) instead of localToAbsolute() to calculate the focus ring rect of a sublayer. * rendering/PaintInfo.h: (WebCore): (WebCore::PaintInfo::PaintInfo): Add a field paintContainer (the RenderLayerModelObject which originates the current painting) (PaintInfo): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): (WebCore::RenderBlock::paintContinuationOutlines): (WebCore::RenderBlock::addFocusRingRects): Use the added paintContainer parameter to calculate the relative offset of the child layer. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintBackgroundForFragments): Pass LayerPaintingInfo.rootLayer to PaintInfo.paintContainer. (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): Ditto. (WebCore::RenderLayer::paintOutlineForFragments): Ditto. (WebCore::RenderLayer::paintMaskForFragments): Ditto. * rendering/RenderLayer.cpp: * rendering/RenderObject.cpp: (WebCore::RenderObject::paintFocusRing): Now takes PaintInfo instead of GraphicsContext*. Pass paintInfo.paintContainer to addFocusRingRects(). (WebCore::RenderObject::paintOutline): Now takes PaintInfo instead of GraphicsContext*. (WebCore::RenderObject::absoluteFocusRingQuads): * rendering/RenderObject.h: (WebCore::RenderObject::addFocusRingRects): Add paintContainer parameter. LayoutTests: New ref test for the bug. * compositing/sub-layer-focus-ring-expected.html: Added. * compositing/sub-layer-focus-ring.html: Added. Canonical link: https://commits.webkit.org/129422@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-02-28 20:38:23 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
.composited {
-webkit-transform: translateZ(0);
}
.outer {
position: absolute;
width: 500px;
height: 300px;
top: 60px;
left: 100px;
background-color: yellow;
}
.outlined {
outline: red auto thin;
width: 150px;
height: 50px;
background-color: lightgrey;
}
.inner {
width: 80px;
height: 100px;
}
</style>
</head>
<body>
<!-- Still let outer layer composited to avoid the minor edge pixel diffs. -->
<div class="composited outer">
<div class="outlined">
<div class="inner"></div>
</div>
</div>
</body>
</html>