Reviewed by Darin, landed by ap.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jun 2006 15:52:01 +0000 (15:52 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jun 2006 15:52:01 +0000 (15:52 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9316
          REGRESSION: text field width shrinks on first keystroke

        Test: fast/forms/floating-textfield-relayout.html

        * page/FrameView.cpp:
        (WebCore::FrameView::layoutRoot): Added. During subtree relayout, returns
        the subtree root. Otherwise returns 0.
        (WebCore::FrameView::layoutPending): Made const.
        * page/FrameView.h:
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calcWidth): Added early return if this is the root
        of a subtree being laid out.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/floating-textfield-relayout-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/floating-textfield-relayout-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/floating-textfield-relayout-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/floating-textfield-relayout.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/rendering/RenderBox.cpp

index 3a75552..8fe8bf8 100644 (file)
@@ -1,5 +1,17 @@
 2006-06-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
+        Reviewed by Darin. landed by ap.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9316
+          REGRESSION: text field width shrinks on first keystroke
+
+        * fast/forms/floating-textfield-relayout-expected.checksum: Added.
+        * fast/forms/floating-textfield-relayout-expected.png: Added.
+        * fast/forms/floating-textfield-relayout-expected.txt: Added.
+        * fast/forms/floating-textfield-relayout.html: Added.
+
+2006-06-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
         Reviewed by Hyatt.
 
         - updated test results for http://bugzilla.opendarwin.org/show_bug.cgi?id=9531
diff --git a/LayoutTests/fast/forms/floating-textfield-relayout-expected.checksum b/LayoutTests/fast/forms/floating-textfield-relayout-expected.checksum
new file mode 100644 (file)
index 0000000..c58d973
--- /dev/null
@@ -0,0 +1,2 @@
+4466cd49965bbccb0819083a4767c0e1
+\ No newline at end of file
diff --git a/LayoutTests/fast/forms/floating-textfield-relayout-expected.png b/LayoutTests/fast/forms/floating-textfield-relayout-expected.png
new file mode 100644 (file)
index 0000000..0139054
Binary files /dev/null and b/LayoutTests/fast/forms/floating-textfield-relayout-expected.png differ
diff --git a/LayoutTests/fast/forms/floating-textfield-relayout-expected.txt b/LayoutTests/fast/forms/floating-textfield-relayout-expected.txt
new file mode 100644 (file)
index 0000000..130b441
--- /dev/null
@@ -0,0 +1,26 @@
+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 104x18
+          text run at (0,0) width 104: "This is a test for "
+        RenderInline {I} at (0,0) size 750x36
+          RenderInline {A} at (0,0) size 348x18 [color=#0000EE]
+            RenderText {#text} at (104,0) size 348x18
+              text run at (104,0) width 348: "http://bugzilla.opendarwin.org/show_bug.cgi?id=9316"
+          RenderText {#text} at (452,0) size 750x36
+            text run at (452,0) width 4: " "
+            text run at (456,0) width 294: "REGRESSION: text field width shrinks on first"
+            text run at (0,18) width 59: "keystroke"
+        RenderText {#text} at (59,18) size 4x18
+          text run at (59,18) width 4: "."
+      RenderBlock {HR} at (0,52) size 784x2 [border: (1px inset #000000)]
+layer at (8,70) size 784x0
+  RenderBlock (relative positioned) {DIV} at (0,62) size 784x0
+    RenderTextField {INPUT} at (0,2) size 392x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+layer at (11,75) size 386x13
+  RenderBlock {DIV} at (3,3) size 386x13
+    RenderText {#text} at (1,0) size 18x13
+      text run at (1,0) width 18: "foo"
diff --git a/LayoutTests/fast/forms/floating-textfield-relayout.html b/LayoutTests/fast/forms/floating-textfield-relayout.html
new file mode 100644 (file)
index 0000000..b587a8a
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+<head>
+    <title></title>
+    <script type="text/javascript">
+        function test()
+        {
+            document.body.offsetTop;
+            var field = document.getElementById('field');
+            field.value = "foo";
+        }
+    </script>
+</head>
+<body onload="test()">
+    <p>
+        This is a test for <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9316">http://bugzilla.opendarwin.org/show_bug.cgi?id=9316</a>
+        REGRESSION: text field width shrinks on first keystroke</i>.
+    </p>
+    <hr>
+    <div style="position: relative;">
+        <input id="field" style="width: 50%; float: left">
+    </div>
+</body>
index 19bda3a..83bc169 100644 (file)
@@ -1,5 +1,23 @@
 2006-06-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
+        Reviewed by Darin, landed by ap.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9316
+          REGRESSION: text field width shrinks on first keystroke
+
+        Test: fast/forms/floating-textfield-relayout.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layoutRoot): Added. During subtree relayout, returns
+        the subtree root. Otherwise returns 0.
+        (WebCore::FrameView::layoutPending): Made const.
+        * page/FrameView.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::calcWidth): Added early return if this is the root
+        of a subtree being laid out. 
+
+2006-06-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
         Reviewed by Hyatt.
 
         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9531
index 789ef8d..666d715 100644 (file)
@@ -312,6 +312,11 @@ void FrameView::addRepaintInfo(RenderObject* o, const IntRect& r)
     d->repaintRects->append(new RenderObject::RepaintInfo(o, r));
 }
 
+Node* FrameView::layoutRoot() const
+{
+    return layoutPending() ? 0 : d->layoutRoot.get();
+}
+
 void FrameView::layout(bool allowSubtree)
 {
     d->layoutTimer.stop();
@@ -1186,7 +1191,7 @@ void FrameView::scheduleRelayoutOfSubtree(Node* n)
     }
 }
 
-bool FrameView::layoutPending()
+bool FrameView::layoutPending() const
 {
     return d->layoutTimer.isActive();
 }
index bc882ad..de7fd64 100644 (file)
@@ -117,6 +117,7 @@ public:
 
     void layout(bool allowSubtree = true);
 
+    Node* layoutRoot() const;
     int layoutCount() const;
 
     bool needsFullRepaint() const;
@@ -156,7 +157,7 @@ public:
     void scheduleRelayoutOfSubtree(Node*);
     void unscheduleRelayout();
     bool haveDelayedLayoutScheduled();
-    bool layoutPending();
+    bool layoutPending() const;
 
     void scheduleHoverStateUpdate();
 
index d7804f4..0e13ba6 100644 (file)
@@ -973,6 +973,10 @@ void RenderBox::calcWidth()
         return;
     }
     
+    // If layout is limited to a subtree, the subtree root's width does not change.
+    if (node() && view()->frameView() && view()->frameView()->layoutRoot() == node())
+        return;
+
     // The parent box is flexing us, so it has increased or decreased our
     // width.  Use the width from the style context.
     if (m_overrideSize != -1 && parent()->style()->boxOrient() == HORIZONTAL