LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jun 2006 03:13:43 +0000 (03:13 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jun 2006 03:13:43 +0000 (03:13 +0000)
        Reviewed by Hyatt.

        - repaint test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9121
          REGRESSION: [Incremental Repaint] DHTML movement test failures

        * fast/repaint/containing-block-position-change-expected.checksum: Added.
        * fast/repaint/containing-block-position-change-expected.png: Added.
        * fast/repaint/containing-block-position-change-expected.txt: Added.
        * fast/repaint/containing-block-position-change.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9121
          REGRESSION: [Incremental Repaint] DHTML movement test failures

        Test (repaint): fast/repaint/containing-block-position-change.html

        * manual-tests/containing-block-position-chage.html: Added.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::layoutBlock): Unrelated change: fixed typo from
        the RenderCanvas to RenderView rename.
        (WebCore::RenderBlock::removePositionedObject): Added a return immediately
        after removing the object.
        (WebCore::RenderBlock::removePositionedObjects): Added.
        * rendering/RenderBlock.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::setStyle): Added code to remove absolutely positioned
        descendants from the positioned objects list of their current containing block
        when they are going to have a new one as a result of this block's position
        property changing.
        * rendering/RenderObject.h:
        (WebCore::RenderObject::removePositionedObjects):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14757 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/repaint/containing-block-position-change-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/containing-block-position-change-expected.png [new file with mode: 0644]
LayoutTests/fast/repaint/containing-block-position-change-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/containing-block-position-change.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/manual-tests/containing-block-position-chage.html [new file with mode: 0644]
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h

index db137681ce8433e1ea5f6d4c34db512d44b60f3b..9a7df784d0842456ee5151890ca2ba3017fd7efa 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-06  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - repaint test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9121
+          REGRESSION: [Incremental Repaint] DHTML movement test failures
+
+        * fast/repaint/containing-block-position-change-expected.checksum: Added.
+        * fast/repaint/containing-block-position-change-expected.png: Added.
+        * fast/repaint/containing-block-position-change-expected.txt: Added.
+        * fast/repaint/containing-block-position-change.html: Added.
+
 2006-06-06  Darin Adler  <darin@apple.com>
 
         * fast/repaint/table-extra-bottom-grow.html: Removed unneeded line of code.
diff --git a/LayoutTests/fast/repaint/containing-block-position-change-expected.checksum b/LayoutTests/fast/repaint/containing-block-position-change-expected.checksum
new file mode 100644 (file)
index 0000000..57ed8d5
--- /dev/null
@@ -0,0 +1,2 @@
+0d579996e21fefc513669fe5b7172d9b
+\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/containing-block-position-change-expected.png b/LayoutTests/fast/repaint/containing-block-position-change-expected.png
new file mode 100644 (file)
index 0000000..47f8d47
Binary files /dev/null and b/LayoutTests/fast/repaint/containing-block-position-change-expected.png differ
diff --git a/LayoutTests/fast/repaint/containing-block-position-change-expected.txt b/LayoutTests/fast/repaint/containing-block-position-change-expected.txt
new file mode 100644 (file)
index 0000000..3e2ee9a
--- /dev/null
@@ -0,0 +1,21 @@
+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
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 151x18
+          text run at (0,0) width 151: "This is a repaint test for "
+        RenderInline {I} at (0,0) size 749x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (151,0) size 348x18
+              text run at (151,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=9121"
+          RenderText {#text} at (499,0) size 749x36
+            text run at (499,0) width 4: " "
+            text run at (503,0) width 246: "REGRESSION: [Incremental Repaint]"
+            text run at (0,18) width 200: "DHTML movement test failures"
+        RenderText {#text} at (200,18) size 4x18
+          text run at (200,18) width 4: "."
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+layer at (158,70) size 50x50
+  RenderBlock (positioned) {DIV} at (100,0) size 50x50 [bgcolor=#0000FF]
diff --git a/LayoutTests/fast/repaint/containing-block-position-change.html b/LayoutTests/fast/repaint/containing-block-position-change.html
new file mode 100644 (file)
index 0000000..9112161
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+       <script src="repaint.js" type="text/javascript"></script>
+       <script type="text/javascript">
+          function repaintTest()
+          {
+           document.getElementById('t').style.position = 'relative';
+          }
+       </script>
+</head>
+<body onload="runRepaintTest();">
+    <p>
+        This is a repaint test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9121">http://bugzilla.opendarwin.org/show_bug.cgi?id=9121</a>
+        REGRESSION: [Incremental Repaint] DHTML movement test failures</i>.
+    </p>
+    <hr>
+    <div id="t" style="position: static; left: 50px;">
+        <div style="width: 50px; height: 50px; background: blue; position: absolute; left: 100px;"></div>
+    </div>
+</body>
+</html>
index fc44cd7655ce9a4739caf28fb3cd4d6665364ea5..47c4c9656ddbd7c1926e2ded38e958935b1a837a 100644 (file)
@@ -1,3 +1,28 @@
+2006-06-06  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Hyatt.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9121
+          REGRESSION: [Incremental Repaint] DHTML movement test failures
+
+        Test (repaint): fast/repaint/containing-block-position-change.html
+
+        * manual-tests/containing-block-position-chage.html: Added.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::layoutBlock): Unrelated change: fixed typo from
+        the RenderCanvas to RenderView rename.
+        (WebCore::RenderBlock::removePositionedObject): Added a return immediately
+        after removing the object.
+        (WebCore::RenderBlock::removePositionedObjects): Added.
+        * rendering/RenderBlock.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::setStyle): Added code to remove absolutely positioned
+        descendants from the positioned objects list of their current containing block
+        when they are going to have a new one as a result of this block's position
+        property changing. 
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::removePositionedObjects):
+
 2006-06-06  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by levi
index b9202cb52f2e1d0e7bac956cc3bddcc69fe059d6..25d86f391d16834e18a286e966f8bd7df6d6f729 100644 (file)
@@ -199,18 +199,13 @@ CSSGrammar.cpp : css/CSSGrammar.y
        rm -f CSSGrammar.cpp.h CSSGrammar.hpp
 
 # XPath grammar
-ifeq ($(findstring XPATH_SUPPORT,$(FEATURE_DEFINES)), XPATH_SUPPORT)
+
 XPathGrammar.cpp : xpath/impl/XPathGrammar.y $(PROJECT_FILE)
        bison -d -p xpathyy $< -o $@
        touch XPathGrammar.cpp.h
        touch XPathGrammar.hpp
        cat XPathGrammar.cpp.h XPathGrammar.hpp > XPathGrammar.h
        rm -f XPathGrammar.cpp.h XPathGrammar.hpp
-else
-XPathGrammar.cpp : $(PROJECT_FILE)
-       echo > XPathGrammar.cpp
-       echo > XPathGrammar.h
-endif
 
 # user agent style sheets
 
diff --git a/WebCore/manual-tests/containing-block-position-chage.html b/WebCore/manual-tests/containing-block-position-chage.html
new file mode 100644 (file)
index 0000000..6741ce4
--- /dev/null
@@ -0,0 +1,35 @@
+<html>
+<head>
+    <title></title>
+    <style type="text/css">
+        #t { position: absolute; width: 100px; height: 100px; background: green; left: -120px; }
+    </style>
+    <script type="text/javascript">
+        function test()
+        {
+            var container = document.getElementById("rel");
+            var target = document.getElementById("t");
+            document.body.offsetTop;   // force layout
+            container.style.position = "relative";
+            document.body.offsetTop;   // force layout
+            target.style.left = "0";
+        }
+    </script>
+</head>
+<body onload="test()">
+    <p>
+        This is a test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9121">http://bugzilla.opendarwin.org/show_bug.cgi?id=9121</a>
+        REGRESSION: [Incremental Repaint] DHTML movement test failures</i>.
+    </p>
+    <p>
+        Do not resize the window. If you did, reload the test.
+    </p>
+    <p>
+        There should be a green square below, aligned with the left margin of the page.
+    </p>
+    <hr>
+    <div id="rel" style="position: static;">
+        <span id="t"></span>
+    </div>
+</body>
+</html>
index 375fbc04be3ccc38eddfe8ff47dd1c3ef2ea7cee..77c63d3def4b96c71a07159bd8d863737f8d7e00 100644 (file)
@@ -553,7 +553,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
         didFullRepaint = repaintAfterLayoutIfNeeded(oldBounds, oldFullBounds);
     if (!didFullRepaint && !repaintRect.isEmpty()) {
         RenderView* v = view();
-        if (v && v->view()) {
+        if (v && v->frameView()) {
             repaintRect.inflate(maximalOutlineSize(PaintPhaseOutline));
             v->frameView()->addRepaintInfo(this, repaintRect); // We need to do a partial repaint of our content.
         }
@@ -1767,13 +1767,33 @@ void RenderBlock::removePositionedObject(RenderObject *o)
     if (m_positionedObjects) {
         DeprecatedPtrListIterator<RenderObject> it(*m_positionedObjects);
         while (it.current()) {
-            if (it.current() == o)
+            if (it.current() == o) {
                 m_positionedObjects->removeRef(it.current());
+                return;
+            }
             ++it;
         }
     }
 }
 
+void RenderBlock::removePositionedObjects(RenderBlock* o)
+{
+    if (!m_positionedObjects)
+        return;
+    
+    DeprecatedPtrListIterator<RenderObject> it(*m_positionedObjects);
+    while (it.current()) {
+        if (!o || it.current()->hasAncestor(o)) {
+            if (o) {
+                it.current()->setChildNeedsLayout(true, false);
+                it.current()->layer()->computeRepaintRects();
+            }
+            m_positionedObjects->removeRef(it.current());
+        } else
+            ++it;
+    }
+}
+
 void RenderBlock::insertFloatingObject(RenderObject *o)
 {
     // Create the list of special objects if we don't aleady have one
index cac6a2a2fd8225a66cbbc8a87a86593616abec0c..a6fb8f36c60cfcd1e27228879f2cee9070a80113 100644 (file)
@@ -120,6 +120,7 @@ public:
     void layoutPositionedObjects( bool relayoutChildren );
     void insertPositionedObject(RenderObject *o);
     void removePositionedObject(RenderObject *o);
+    virtual void removePositionedObjects(RenderBlock*);
 
     virtual void positionListMarker() { }
 
index 621739cf81f47ce5781de9f912dccebb4864b59a..f3abe405713cdc24a612b53773870f1c08d9afbe 100644 (file)
@@ -2057,8 +2057,28 @@ void RenderObject::setStyle(RenderStyle *style)
 
         // When a layout hint happens and an object's position style changes, we have to do a layout
         // to dirty the render tree using the old position value now.
-        if (d == RenderStyle::Layout && m_parent && m_style->position() != style->position())
+        if (d == RenderStyle::Layout && m_parent && m_style->position() != style->position()) {
             markContainingBlocksForLayout();
+            if (isRenderBlock()) {
+                if (style->position() == StaticPosition) {
+                    // Clear our positioned objects list. Our absolutely positioned descendants will be
+                    // inserted into our containing block's positioned objects list during layout.
+                    removePositionedObjects(0);
+                } else if (m_style->position() == StaticPosition) {
+                    // Remove our absolutely positioned descendants from their current containing block.
+                    // They will be inserted into our positioned objects list during layout.
+                    RenderObject* cb = parent();
+                    while (cb && (cb->style()->position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isRoot() && !cb->isRenderView()) {
+                        if (cb->style()->position() == RelativePosition && cb->isInline() && !cb->isReplaced()) {
+                            cb =  cb->containingBlock();
+                            break;
+                        }
+                        cb = cb->parent();
+                    }
+                    cb->removePositionedObjects(static_cast<RenderBlock*>(this));
+                }
+            }
+        }
         
         if (isFloating() && (m_style->floating() != style->floating()))
             // For changes in float styles, we need to conceivably remove ourselves
index 33042884cd59d33390a2449db93d1024bfe116e6..f54d541e52c416f940687c9220fd008620af76a8 100644 (file)
@@ -747,6 +747,8 @@ public:
     virtual bool hasOverhangingFloats() { return false; }
     virtual IntRect floatRect() const { return borderBox(); }
 
+    virtual void removePositionedObjects(RenderBlock*) { }
+
     bool avoidsFloats() const;
     bool usesLineWidth() const;