2008-11-12 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Dan Bernstein

        https://bugs.webkit.org/show_bug.cgi?id=22212

        Rename absoluteOutlineBox() to absoluteOutlineBounds(), to indicate that
        it may be the bounding outline box of a transformed element, and fix it
        to respect transforms by mapping the outline box to an absolute quad and
        taking the enclosing rect.

        RenderBox::localToAbsoluteQuad() can no longer assert that there is no
        LayoutState, but LayoutState cannot be used during quad mapping (it knows
        nothing about transforms).

        Finally, fix a bug in RenderBox::localToAbsoluteQuad() which was getting
        borderTopExtra() from the object, rather than its container (as localToAbsolute()
        does).

        Test: fast/repaint/transform-absolute-child.html

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a77d2903
2008-11-12 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein
https://bugs.webkit.org/show_bug.cgi?id=22212
Repaint test for a transform change on an element with a positioned child.
* fast/repaint/transform-absolute-child.html: Added.
* platform/mac/fast/repaint/transform-absolute-child-expected.checksum: Added.
* platform/mac/fast/repaint/transform-absolute-child-expected.png: Added.
* platform/mac/fast/repaint/transform-absolute-child-expected.txt: Added.
2008-11-12 Geoffrey Garen <ggaren@apple.com>
Roll in r38322, now that test failures have been fixed.
......
<!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>Transform with Abs. Pos child</title>
<style type="text/css" media="screen">
#box {
position: relative;
margin: 50px;
width: 200px;
height: 200px;
border: 2px solid black;
-webkit-transform: rotate(0deg);
}
#box.rotated {
-webkit-transform: rotate(40deg);
}
#child {
position: absolute;
width: 400px;
height: 50px;
top: 75px;
left: 75px;
background-color: gray;
}
</style>
<script src="repaint.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function repaintTest()
{
document.getElementById('box').className = 'rotated';
}
</script>
</head>
<body onload="runRepaintTest()">
<div id="box">
<div id="child">
</div>
</div>
</body>
</html>
2676efdfc0f7fbca1ad5659e7714b6bd
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x304
RenderBlock {HTML} at (0,0) size 800x304
RenderBody {BODY} at (8,50) size 784x204
layer at (58,50) size 204x204
RenderBlock (relative positioned) {DIV} at (50,0) size 204x204 [border: (2px solid #000000)]
layer at (135,127) size 400x50
RenderBlock (positioned) {DIV} at (77,77) size 400x50 [bgcolor=#808080]
......@@ -7,6 +7,59 @@
* platform/graphics/FloatQuad.cpp:
2008-11-12 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dan Bernstein
https://bugs.webkit.org/show_bug.cgi?id=22212
Rename absoluteOutlineBox() to absoluteOutlineBounds(), to indicate that
it may be the bounding outline box of a transformed element, and fix it
to respect transforms by mapping the outline box to an absolute quad and
taking the enclosing rect.
RenderBox::localToAbsoluteQuad() can no longer assert that there is no
LayoutState, but LayoutState cannot be used during quad mapping (it knows
nothing about transforms).
Finally, fix a bug in RenderBox::localToAbsoluteQuad() which was getting
borderTopExtra() from the object, rather than its container (as localToAbsolute()
does).
Test: fast/repaint/transform-absolute-child.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::localToAbsoluteQuad):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
* rendering/RenderForeignObject.cpp:
(WebCore::RenderForeignObject::layout):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::setHasVisibleContent):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
(WebCore::RenderObject::absoluteOutlineBounds):
* rendering/RenderObject.h:
* rendering/RenderPath.cpp:
(WebCore::RenderPath::layout):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::layout):
* rendering/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
* rendering/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::layout):
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
* rendering/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):
* rendering/RenderSVGViewportContainer.cpp:
(WebCore::RenderSVGViewportContainer::layout):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
2008-11-12 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt
......@@ -589,7 +589,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
bool checkForRepaint = m_everHadLayout && checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
LayoutStateMaintainer statePusher(view(), this, IntSize(xPos(), yPos()), !m_hasColumns && !hasReflection());
......
......@@ -1054,9 +1054,6 @@ FloatPoint RenderBox::absoluteToLocal(FloatPoint containerPoint, bool fixed, boo
FloatQuad RenderBox::localToAbsoluteQuad(const FloatQuad& localQuad, bool fixed) const
{
// We don't expect localToAbsoluteQuad() to be called during layout (yet)
ASSERT(!view() || !view()->layoutState());
if (style()->position() == FixedPosition)
fixed = true;
......@@ -1072,7 +1069,7 @@ FloatQuad RenderBox::localToAbsoluteQuad(const FloatQuad& localQuad, bool fixed)
// Take into account space above a vertically aligned table cell
// (see localToAbsoluteForContent())
quad.move(0.0f, static_cast<float>(borderTopExtra()));
quad.move(0.0f, static_cast<float>(o->borderTopExtra()));
return o->localToAbsoluteQuad(quad, fixed);
}
......
......@@ -216,7 +216,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
LayoutStateMaintainer statePusher(view(), this, IntSize(m_x, m_y), !hasReflection());
......
......@@ -102,7 +102,7 @@ void RenderForeignObject::layout()
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = m_absoluteBounds;
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
calculateLocalTransform();
......
......@@ -228,7 +228,7 @@ void RenderLayer::updateLayerPositions(bool doFullRepaint, bool checkForRepaint)
ASSERT(!view->layoutState());
IntRect newRect = m_object->absoluteClippedOverflowRect();
IntRect newOutlineBox = m_object->absoluteOutlineBox();
IntRect newOutlineBox = m_object->absoluteOutlineBounds();
if (checkForRepaint) {
if (view && !view->printing()) {
if (m_needsFullRepaint) {
......@@ -285,7 +285,7 @@ void RenderLayer::setHasVisibleContent(bool b)
m_hasVisibleContent = b;
if (m_hasVisibleContent) {
m_repaintRect = renderer()->absoluteClippedOverflowRect();
m_outlineBox = renderer()->absoluteOutlineBox();
m_outlineBox = renderer()->absoluteOutlineBounds();
if (!isOverflowOnly())
dirtyStackingContextZOrderLists();
}
......
......@@ -1898,7 +1898,7 @@ bool RenderObject::repaintAfterLayoutIfNeeded(const IntRect& oldBounds, const In
if (!fullRepaint && style()->borderFit() == BorderFitLines)
fullRepaint = true;
if (!fullRepaint) {
newOutlineBox = absoluteOutlineBox();
newOutlineBox = absoluteOutlineBounds();
if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaintBackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBox)))
fullRepaint = true;
}
......@@ -3146,13 +3146,15 @@ void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const
rect.inflate(outlineSize);
}
IntRect RenderObject::absoluteOutlineBox() const
IntRect RenderObject::absoluteOutlineBounds() const
{
IntRect box = borderBox();
FloatPoint absPos = localToAbsolute();
box.move(absPos.x(), absPos.y());
box.move(view()->layoutDelta());
adjustRectForOutlineAndShadow(box);
FloatQuad absOutlineQuad = localToAbsoluteQuad(FloatRect(box));
box = absOutlineQuad.enclosingBoundingBox();
box.move(view()->layoutDelta());
return box;
}
......
......@@ -607,7 +607,8 @@ public:
virtual int height() const { return 0; }
virtual IntRect borderBox() const { return IntRect(0, 0, width(), height()); }
IntRect absoluteOutlineBox() const;
// Bounds of the outline box in absolute coords. Respects transforms
IntRect absoluteOutlineBounds() const;
// The height of a block when you include normal flow overflow spillage out of the bottom
// of the block (e.g., a <div style="height:25px"> that has a 100px tall image inside
......
......@@ -127,7 +127,7 @@ void RenderPath::layout()
bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout();
if (checkForRepaint) {
oldBounds = m_absoluteBounds;
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
calculateLocalTransform();
......
......@@ -80,7 +80,7 @@ void RenderReplaced::layout()
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
m_height = minimumReplacedHeight();
......
......@@ -237,7 +237,7 @@ void RenderSVGContainer::layout()
bool checkForRepaint = checkForRepaintDuringLayout() && selfWillPaint();
if (checkForRepaint) {
oldBounds = m_absoluteBounds;
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
calculateLocalTransform();
......
......@@ -141,7 +141,7 @@ void RenderSVGImage::layout()
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
calculateLocalTransform();
......
......@@ -95,7 +95,7 @@ void RenderSVGRoot::layout()
IntRect oldOutlineBox;
bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout();
if (checkForRepaint)
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
calcWidth();
calcHeight();
......
......@@ -89,7 +89,7 @@ void RenderSVGText::layout()
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = m_absoluteBounds;
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
// Best guess for a relative starting point
......
......@@ -57,7 +57,7 @@ void RenderSVGViewportContainer::layout()
IntRect oldOutlineBox;
bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout();
if (checkForRepaint)
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
calcBounds();
......
......@@ -262,7 +262,7 @@ void RenderTable::layout()
bool checkForRepaint = checkForRepaintDuringLayout();
if (checkForRepaint) {
oldBounds = absoluteClippedOverflowRect();
oldOutlineBox = absoluteOutlineBox();
oldOutlineBox = absoluteOutlineBounds();
}
LayoutStateMaintainer statePusher(view(), this, IntSize(m_x, m_y));
......
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