LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 22:22:14 +0000 (22:22 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2006 22:22:14 +0000 (22:22 +0000)
        Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8273
        REGRESSION: Read only input text field renders at the wrong height when value attribute is not present

        * fast/forms/input-readonly-empty-expected.checksum: Added.
        * fast/forms/input-readonly-empty-expected.png: Added.
        * fast/forms/input-readonly-empty-expected.txt: Added.
        * fast/forms/input-readonly-empty.html: Added.

WebCore:

        Reviewed by Hyatt.

        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8273
        REGRESSION: Read only input text field renders at the wrong height when value attribute is not present

        Test: fast/forms/input-readonly-empty.html

        * rendering/RenderBlock.h: Added hasLineIfEmpty.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::hasLineIfEmpty): Added.  Checks for rootEditableElement as well as
         a shadowNode who has an input element as a parent.
        (WebCore::RenderBlock::getBaselineOfLastLineBox): Calls hasLineIfEmpty instead of just checking for the rootEditableElement.
        * rendering/bidi.cpp: (WebCore::RenderBlock::layoutInlineChildren): ditto.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/input-readonly-empty-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-empty-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-empty-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-empty.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/bidi.cpp

index 4f7ac84ca04cc1f8b53907d21393ceca3d8c7ec0..328cfb760ae1e49a286947c1b875ecb32020ad7a 100644 (file)
@@ -1,3 +1,13 @@
+2006-04-20  Adele Peterson  <adele@apple.com>
+
+        Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8273
+        REGRESSION: Read only input text field renders at the wrong height when value attribute is not present
+
+        * fast/forms/input-readonly-empty-expected.checksum: Added.
+        * fast/forms/input-readonly-empty-expected.png: Added.
+        * fast/forms/input-readonly-empty-expected.txt: Added.
+        * fast/forms/input-readonly-empty.html: Added.
+
 2006-04-19  Adele Peterson  <adele@apple.com>
 
         Updated test to use webkit-block-placeholder instead of khtml-block-placeholder.
diff --git a/LayoutTests/fast/forms/input-readonly-empty-expected.checksum b/LayoutTests/fast/forms/input-readonly-empty-expected.checksum
new file mode 100644 (file)
index 0000000..92c3f9f
--- /dev/null
@@ -0,0 +1 @@
+7f5f321dfc0b30800fd357f2fd274302
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/input-readonly-empty-expected.png b/LayoutTests/fast/forms/input-readonly-empty-expected.png
new file mode 100644 (file)
index 0000000..15c6407
Binary files /dev/null and b/LayoutTests/fast/forms/input-readonly-empty-expected.png differ
diff --git a/LayoutTests/fast/forms/input-readonly-empty-expected.txt b/LayoutTests/fast/forms/input-readonly-empty-expected.txt
new file mode 100644 (file)
index 0000000..8684834
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderCanvas 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
+      RenderText {#text} at (0,2) size 476x18
+        text run at (0,2) width 476: "This tests that empty readonly text fields have the right height and baseline. "
+      RenderTextField {INPUT} at (478,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+      RenderText {#text} at (0,0) size 0x0
+layer at (489,13) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
diff --git a/LayoutTests/fast/forms/input-readonly-empty.html b/LayoutTests/fast/forms/input-readonly-empty.html
new file mode 100644 (file)
index 0000000..ff9a201
--- /dev/null
@@ -0,0 +1,3 @@
+<html>
+This tests that empty readonly text fields have the right height and baseline. <input readonly>
+</html>
\ No newline at end of file
index 1d6429c3e844e482cdb9d43c79d371be3ec479db..6f054dad57bd1bc6dff02d87905ba2b40daea82d 100644 (file)
@@ -1,3 +1,19 @@
+2006-04-20  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Hyatt.
+
+        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8273
+        REGRESSION: Read only input text field renders at the wrong height when value attribute is not present
+
+        Test: fast/forms/input-readonly-empty.html
+
+        * rendering/RenderBlock.h: Added hasLineIfEmpty.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::hasLineIfEmpty): Added.  Checks for rootEditableElement as well as 
+         a shadowNode who has an input element as a parent.
+        (WebCore::RenderBlock::getBaselineOfLastLineBox): Calls hasLineIfEmpty instead of just checking for the rootEditableElement.
+        * rendering/bidi.cpp: (WebCore::RenderBlock::layoutInlineChildren): ditto.
+
 2006-04-20  Darin Adler  <darin@apple.com>
 
         Reviewed by Timothy.
index ff88eb94900f44501f220aec83a6abb493535f48..89b9565c550a740416ab5defae5e9009d26261b9 100644 (file)
@@ -3191,6 +3191,12 @@ void RenderBlock::calcBlocminMaxWidth()
     m_maxWidth = max(floatLeftWidth + floatRightWidth, m_maxWidth);
 }
 
+bool RenderBlock::hasLineIfEmpty() const
+{
+    return element() && (element()->isContentEditable() && element()->rootEditableElement() == element() ||
+                         element()->isShadowNode() && element()->shadowParentNode()->hasTagName(inputTag));
+}
+
 short RenderBlock::lineHeight(bool b, bool isRootLineBox) const
 {
     // Inline blocks are replaced elements. Otherwise, just pass off to
@@ -3259,7 +3265,7 @@ int RenderBlock::getBaselineOfLastLineBox() const
         return RenderFlow::getBaselineOfLastLineBox();
 
     if (childrenInline()) {
-        if (!firstLineBox() && element() && element()->isContentEditable() && element()->rootEditableElement() == element())
+        if (!firstLineBox() && hasLineIfEmpty())
             return RenderFlow::baselinePosition(true) + borderTop() + paddingTop();
         if (m_lastLineBox)
             return m_lastLineBox->yPos() + m_lastLineBox->baseline();
index fb0e1fdd3b6f700bf12fb4b50da949c86bc053d3..4914c9be52e861ef99a8daa1dc7be0190ba3635d 100644 (file)
@@ -276,6 +276,8 @@ private:
     Position positionForBox(InlineBox *box, bool start=true) const;
     Position positionForRenderer(RenderObject *renderer, bool start=true) const;
     
+    bool hasLineIfEmpty() const;
+    
 protected:
     struct FloatingObject {
         enum Type {
index 978a6359e36104282f254ae4c471704f152caf07..2b2feac8e7c551b031de0fd4a95d0e7e0c44fab2 100644 (file)
@@ -1722,7 +1722,7 @@ IntRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
             repaintRect.intersect(IntRect(0, 0, m_width, m_height));
     }
 
-    if (!firstLineBox() && element() && element()->isContentEditable() && element()->rootEditableElement() == element())
+    if (!firstLineBox() && hasLineIfEmpty())
         m_height += lineHeight(true);
 
     // See if we have any lines that spill out of our block.  If we do, then we will possibly need to