2009-09-29 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dan Bernstein.

        ASSERTION FAILED: !repaintContainer || repaintContainer == this
        https://bugs.webkit.org/show_bug.cgi?id=29755

        Generalize the fix for this bug to account for cases where there may be multiple
        containing blocks between the repaint container, and the container of the element
        being repainted.

        Test: compositing/repaint/opacity-between-absolute2.html

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::mapLocalToContainer):
        Call offsetFromAncestorContainer() to get the correct offset.

        (WebCore::RenderBox::computeRectForRepaint): Ditto
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::computeRectForRepaint): Ditto.

        * rendering/RenderObject.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::offsetFromAncestorContainer):
        New method that computes an offset from some object in the ancestor container() chain.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 026bca0d
2009-09-29 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein.
ASSERTION FAILED: !repaintContainer || repaintContainer == this
https://bugs.webkit.org/show_bug.cgi?id=29755
Testcase with multiple containers between the absolutely positioned div and its positioned
ancestor.
* compositing/repaint/opacity-between-absolute2.html: Added.
* platform/mac/compositing/repaint/opacity-between-absolute2-expected.checksum: Added.
* platform/mac/compositing/repaint/opacity-between-absolute2-expected.png: Added.
* platform/mac/compositing/repaint/opacity-between-absolute2-expected.txt: Added.
2009-09-30 Renata Hodovan <hodovan.renata@stud.u-szeged.hu>
Reviewed by Simon Hausmann.
......
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Opacity between absolutes</title>
<style type="text/css" media="screen">
.container {
position: relative;
height: 200px;
width: 200px;
border: 1px solid black;
-webkit-transform: translateZ(0);
}
.fader {
height: 50px;
width: 50px;
margin: 20px;
border: 1px solid black;
-webkit-transition: opacity 100s;
}
.container:hover .fader {
opacity: 0.5;
}
.inner {
position: absolute;
left: 100px;
top: 100px;
height: 80px;
width: 80px;
background-color: gray;
}
.inner:hover {
background-color: orange !important;
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function runTest()
{
// Kick off an opacity fade to make .fader into a compositing layer
var container = document.querySelectorAll('.fader')[1];
container.style.opacity = 0.99;
window.setTimeout(function() {
// Now test redraw on .inner
var inner = document.querySelectorAll('.inner')[0];
inner.style.backgroundColor = 'green';
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 0);
}
window.addEventListener('load', runTest, false)
</script>
</head>
<body>
<p>This test should not assert, and you should see a fully green square.</p>
<div class="container">
<div class="fader">
<div class="fader">
<div class="inner">
</div>
</div>
</div>
</div>
</body>
</html>
0f88c69b4a690d65de89c780c09c0d0a
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x260
RenderBlock {HTML} at (0,0) size 800x260
RenderBody {BODY} at (8,16) size 784x236
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 423x18
text run at (0,0) width 423: "This test should not assert, and you should see a fully green square."
layer at (8,50) size 202x202
RenderBlock (relative positioned) {DIV} at (0,34) size 202x202 [border: (1px solid #000000)]
RenderBlock {DIV} at (21,21) size 52x52 [border: (1px solid #000000)]
layer at (50,92) size 52x52
RenderBlock {DIV} at (21,21) size 52x52 [border: (1px solid #000000)]
layer at (109,151) size 80x80
RenderBlock (positioned) {DIV} at (101,101) size 80x80 [bgcolor=#008000]
2009-09-29 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein.
ASSERTION FAILED: !repaintContainer || repaintContainer == this
https://bugs.webkit.org/show_bug.cgi?id=29755
Generalize the fix for this bug to account for cases where there may be multiple
containing blocks between the repaint container, and the container of the element
being repainted.
Test: compositing/repaint/opacity-between-absolute2.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer):
Call offsetFromAncestorContainer() to get the correct offset.
(WebCore::RenderBox::computeRectForRepaint): Ditto
* rendering/RenderInline.cpp:
(WebCore::RenderInline::computeRectForRepaint): Ditto.
* rendering/RenderObject.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::offsetFromAncestorContainer):
New method that computes an offset from some object in the ancestor container() chain.
2009-09-30 Andras Becsi <becsi.andras@stud.u-szeged.hu>
Reviewed by Simon Hausmann.
......@@ -961,10 +961,10 @@ void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool
transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
if (containerSkipped) {
// There can't be a transfrom between repaintContainer and o, because transforms create containers, so it should be safe
// There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe
// to just subtract the delta between the repaintContainer and o.
IntSize repaintContainerOffset = repaintContainer->offsetFromContainer(o);
transformState.move(-repaintContainerOffset.width(), -repaintContainerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
return;
}
......@@ -1201,7 +1201,7 @@ void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, In
if (containerSkipped) {
// If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates.
IntSize containerOffset = repaintContainer->offsetFromContainer(o);
IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
rect.move(-containerOffset);
return;
}
......
......@@ -697,7 +697,7 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer,
if (containerSkipped) {
// If the repaintContainer is below o, then we need to map the rect into repaintContainer's coordinates.
IntSize containerOffset = repaintContainer->offsetFromContainer(o);
IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
rect.move(-containerOffset);
return;
}
......
......@@ -1755,6 +1755,23 @@ IntSize RenderObject::offsetFromContainer(RenderObject* o) const
return offset;
}
IntSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const
{
IntSize offset;
const RenderObject* currContainer = this;
do {
RenderObject* nextContainer = currContainer->container();
ASSERT(nextContainer); // This means we reached the top without finding container.
if (!nextContainer)
break;
ASSERT(!currContainer->hasTransform());
offset += currContainer->offsetFromContainer(nextContainer);
currContainer = nextContainer;
} while (currContainer != container);
return offset;
}
IntRect RenderObject::localCaretRect(InlineBox*, int, int* extraWidthToEndOfLine)
{
if (extraWidthToEndOfLine)
......
......@@ -541,6 +541,8 @@ public:
// Return the offset from the container() renderer (excluding transforms)
virtual IntSize offsetFromContainer(RenderObject*) const;
// Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
IntSize offsetFromAncestorContainer(RenderObject*) const;
virtual void absoluteRects(Vector<IntRect>&, int, int) { }
// FIXME: useTransforms should go away eventually
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment