Commit 89557c51 authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Dave Hyatt.

        - fix https://bugs.webkit.org/show_bug.cgi?id=19717
          <rdar://problem/6026832> REGRESSION (r31876): menu items render horizontally at the Economist

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutOnlyPositionedObjects): In the
        positioned movement only case, call
        tryLayoutDoingPositionedMovementOnly() and fall back on doing a full
        layout if that fails.
        (WebCore::RenderBlock::layoutPositionedObjects): Ditto.
        * rendering/RenderBox.h:
        (WebCore::RenderBox::tryLayoutDoingPositionedMovementOnly): Renamed
        layoutDoingPositionedMovementOnly to this, and made this function
        check if the width changed. If it did, return, leaving the object
        dirty. The caller can then call layout(). The width can change even
        in the "positioned movement only" case if the object is shrink-to-fit
        and the available width constraint is met. (This was the case in the
        bug).
        * rendering/RenderObject.h:
        (WebCore::RenderObject::tryLayoutDoingPositionedMovementOnly):
        Renamed layoutDoingPositionedMovementOnly() to this.

LayoutTests:

        Reviewed by Dave Hyatt.

        - test for https://bugs.webkit.org/show_bug.cgi?id=19717
          <rdar://problem/6026832> REGRESSION (r31876): menu items render horizontally at the Economist

        * fast/block/positioning/move-with-auto-width.html: Added.
        * platform/mac/fast/block/positioning/move-with-auto-width-expected.checksum: Added.
        * platform/mac/fast/block/positioning/move-with-auto-width-expected.png: Added.
        * platform/mac/fast/block/positioning/move-with-auto-width-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c27acb4d
2008-09-04 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- test for https://bugs.webkit.org/show_bug.cgi?id=19717
<rdar://problem/6026832> REGRESSION (r31876): menu items render horizontally at the Economist
* fast/block/positioning/move-with-auto-width.html: Added.
* platform/mac/fast/block/positioning/move-with-auto-width-expected.checksum: Added.
* platform/mac/fast/block/positioning/move-with-auto-width-expected.png: Added.
* platform/mac/fast/block/positioning/move-with-auto-width-expected.txt: Added.
2008-09-04 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
......
<div style="width: 60px; height: 40px; position: relative;">
<div style="width: 20px; height: 40px; background-color: red; margin-left: 20px;"></div>
<div id="target" style="position: absolute; top: 0; left: 0; font-family: Ahem; font-size: 20px; color: green;">
X X
</div>
</div>
<script>
document.body.offsetTop;
document.getElementById("target").style.left = "20px";
</script>
b23acd05a3e0aaf21e784a5cce900fe9
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
layer at (8,8) size 60x40
RenderBlock (relative positioned) {DIV} at (0,0) size 60x40
RenderBlock {DIV} at (20,0) size 20x40 [bgcolor=#FF0000]
layer at (28,8) size 40x40
RenderBlock (positioned) {DIV} at (20,0) size 40x40 [color=#008000]
RenderText {#text} at (0,0) size 20x40
text run at (0,0) width 20: "X"
text run at (0,20) width 20: "X"
2008-09-04 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- fix https://bugs.webkit.org/show_bug.cgi?id=19717
<rdar://problem/6026832> REGRESSION (r31876): menu items render horizontally at the Economist
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutOnlyPositionedObjects): In the
positioned movement only case, call
tryLayoutDoingPositionedMovementOnly() and fall back on doing a full
layout if that fails.
(WebCore::RenderBlock::layoutPositionedObjects): Ditto.
* rendering/RenderBox.h:
(WebCore::RenderBox::tryLayoutDoingPositionedMovementOnly): Renamed
layoutDoingPositionedMovementOnly to this, and made this function
check if the width changed. If it did, return, leaving the object
dirty. The caller can then call layout(). The width can change even
in the "positioned movement only" case if the object is shrink-to-fit
and the available width constraint is met. (This was the case in the
bug).
* rendering/RenderObject.h:
(WebCore::RenderObject::tryLayoutDoingPositionedMovementOnly):
Renamed layoutDoingPositionedMovementOnly() to this.
2008-09-03 Eric Seidel <eric@webkit.org>
No review, build fix only.
......
......@@ -1344,8 +1344,9 @@ bool RenderBlock::layoutOnlyPositionedObjects()
view()->disableLayoutState();
if (needsPositionedMovementLayout()) {
calcWidth();
calcHeight();
tryLayoutDoingPositionedMovementOnly();
if (needsLayout())
return false;
}
// All we have to is lay out our positioned objects.
......@@ -1381,11 +1382,11 @@ void RenderBlock::layoutPositionedObjects(bool relayoutChildren)
if (relayoutChildren && (r->style()->paddingLeft().isPercent() || r->style()->paddingRight().isPercent()))
r->setPrefWidthsDirty(true, false);
// We don't have to do a full layout. We just have to update our position.
// We don't have to do a full layout. We just have to update our position. Try that first. If we have shrink-to-fit width
// and we hit the available width constraint, the layoutIfNeeded() will catch it and do a full layout.
if (r->needsPositionedMovementLayoutOnly())
r->layoutDoingPositionedMovementOnly();
else
r->layoutIfNeeded();
r->tryLayoutDoingPositionedMovementOnly();
r->layoutIfNeeded();
}
}
}
......
......@@ -159,8 +159,13 @@ public:
// Called when a positioned object moves but doesn't change size. A simplified layout is done
// that just updates the object's position.
virtual void layoutDoingPositionedMovementOnly() {
virtual void tryLayoutDoingPositionedMovementOnly()
{
int oldWidth = m_width;
calcWidth();
// If we shrink to fit our width may have changed, so we still need full layout.
if (oldWidth != m_width)
return;
calcHeight();
setNeedsLayout(false);
}
......
......@@ -507,9 +507,9 @@ public:
/* This function performs a layout only if one is needed. */
void layoutIfNeeded() { if (needsLayout()) layout(); }
// Called when a positioned object moves but doesn't change size. A simplified layout is done
// that just updates the object's position.
virtual void layoutDoingPositionedMovementOnly() {};
// Called when a positioned object moves but doesn't necessarily change size. A simplified layout is attempted
// that just updates the object's position. If the size does change, the object remains dirty.
virtual void tryLayoutDoingPositionedMovementOnly() { }
// used for element state updates that cannot be fixed with a
// repaint and do not need a relayout
......
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