[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

adele at apple.com adele at apple.com
Wed Dec 22 15:53:02 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f1ec7260435ee734b30389e5852d4397567644fc
Author: adele at apple.com <adele at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 02:09:43 2010 +0000

    WebCore: Fix for: https://bugs.webkit.org/show_bug.cgi?id=49452
    Placeholder should not be swapped in and out of the text control's inner text element
    
    Reviewed by Darin Adler.
    
    There's no need to swap the placeholder text in and out of the inner text element.  Instead, just paint the text.
    This reduces complexity and makes it easier to make independent decisions about the placeholder text and the text control value.
    
    * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setValueFromRenderer):
    Since updatePlaceholderVisibility checks the value, set the value before calling updatePlaceholderVisibility.
    * rendering/RenderTextControl.cpp:
    (WebCore::RenderTextControl::updatePlaceholderVisibility): Remove code that set the inner text value with the placeholder text.
    (WebCore::RenderTextControl::paintObject):  Paint the placeholder text during the background phase.
    * rendering/RenderTextControl.h:
    * rendering/RenderTextControlMultiLine.cpp:
    (WebCore::RenderTextControlMultiLine::nodeAtPoint): Remove custom hit testing that tried to avoid hitting the placeholder text at the wrong time.
    (WebCore::RenderTextControlMultiLine::updateFromElement):  Remove code that set the inner text value with the placeholder text.
    (WebCore::RenderTextControlMultiLine::createInnerTextStyle): Remove code that created the inner text style based on the placeholder pseudoelement.
    (WebCore::RenderTextControlMultiLine::textBoxInsetLeft): Added.
    (WebCore::RenderTextControlMultiLine::textBoxInsetRight): Added.
    * rendering/RenderTextControlMultiLine.h:
    * rendering/RenderTextControlSingleLine.cpp:
    (WebCore::RenderTextControlSingleLine::updateFromElement): Remove code that set the inner text value with the placeholder text.
    (WebCore::RenderTextControlSingleLine::createInnerTextStyle): Remove code that created the inner text style based on the placeholder pseudoelement.
    (WebCore::RenderTextControlSingleLine::textBoxInsetLeft): Added.
    (WebCore::RenderTextControlSingleLine::textBoxInsetRight): Added.
    * rendering/RenderTextControlSingleLine.h:
    * rendering/TextControlInnerElements.cpp: Removed custom hit testing that tried to avoid hitting the placeholder text at the wrong time.
    
    LayoutTests: Test for: https://bugs.webkit.org/show_bug.cgi?id=49452
    Placeholder should not be swapped in and out of the text control's inner text element
    
    Reviewed by Darin Adler.
    
    The only visual change that occurred is in pseudo-cache-stale.html.  The placeholder text did not
    use to paint over the spot where the cancel button will display.  Since the cancel button is not
    present when the placeholder is drawn, now the placeholder text can draw to the edge of the field.
    
    * platform/mac/fast/css/pseudo-cache-stale-expected.checksum:
    * platform/mac/fast/css/pseudo-cache-stale-expected.png:
    * platform/mac/fast/css/pseudo-cache-stale-expected.txt:
    * platform/mac/fast/forms/isindex-placeholder-expected.txt:
    * platform/mac/fast/forms/password-placeholder-expected.txt:
    * platform/mac/fast/forms/password-placeholder-text-security-expected.txt:
    * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt:
    * platform/mac/fast/forms/placeholder-set-attribute-expected.txt:
    * platform/mac/fast/forms/placeholder-stripped-expected.txt:
    * platform/mac/fast/forms/search-placeholder-value-changed-expected.txt:
    * platform/mac/fast/forms/search-styled-expected.txt:
    * platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt:
    * platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72052 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5be8799..93cf2bb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,28 @@
+2010-11-15 Adele Peterson  <adele at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Test for: https://bugs.webkit.org/show_bug.cgi?id=49452
+        Placeholder should not be swapped in and out of the text control's inner text element
+
+        The only visual change that occurred is in pseudo-cache-stale.html.  The placeholder text did not
+        use to paint over the spot where the cancel button will display.  Since the cancel button is not
+        present when the placeholder is drawn, now the placeholder text can draw to the edge of the field.
+
+        * platform/mac/fast/css/pseudo-cache-stale-expected.checksum:
+        * platform/mac/fast/css/pseudo-cache-stale-expected.png:
+        * platform/mac/fast/css/pseudo-cache-stale-expected.txt:
+        * platform/mac/fast/forms/isindex-placeholder-expected.txt:
+        * platform/mac/fast/forms/password-placeholder-expected.txt:
+        * platform/mac/fast/forms/password-placeholder-text-security-expected.txt:
+        * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt:
+        * platform/mac/fast/forms/placeholder-set-attribute-expected.txt:
+        * platform/mac/fast/forms/placeholder-stripped-expected.txt:
+        * platform/mac/fast/forms/search-placeholder-value-changed-expected.txt:
+        * platform/mac/fast/forms/search-styled-expected.txt:
+        * platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt:
+        * platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt:
+
 2010-11-15  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Geoff Garen.
diff --git a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.checksum b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.checksum
index 9b0ac87..fb01200 100644
--- a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.checksum
+++ b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.checksum
@@ -1 +1 @@
-b22ad20cdd4a8b52a334434c3ae0026b
\ No newline at end of file
+9366e258b90951ee374befbc02a391b3
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.png b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.png
index 81a1865..b6d5178 100644
Binary files a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.png and b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.txt b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.txt
index d37f70d..3ba9697 100644
--- a/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.txt
@@ -19,7 +19,5 @@ layer at (0,0) size 800x600
             RenderBlock {DIV} at (106,0) size 13x11
         RenderText {#text} at (0,0) size 0x0
         RenderText {#text} at (0,0) size 0x0
-layer at (21,87) size 98x13 scrollWidth 116
-  RenderBlock {DIV} at (8,0) size 98x13 [color=#008000]
-    RenderText {#text} at (1,0) size 114x13
-      text run at (1,0) width 114: "This should be green"
+layer at (21,87) size 98x13
+  RenderBlock {DIV} at (8,0) size 98x13
diff --git a/LayoutTests/platform/mac/fast/forms/isindex-placeholder-expected.txt b/LayoutTests/platform/mac/fast/forms/isindex-placeholder-expected.txt
index 93ec355..663124d 100644
--- a/LayoutTests/platform/mac/fast/forms/isindex-placeholder-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/isindex-placeholder-expected.txt
@@ -34,10 +34,6 @@ layer at (0,0) size 800x600
             RenderTextControl {INPUT} at (324,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
         RenderBlock {HR} at (0,41) size 784x2 [border: (1px inset #000000)]
 layer at (335,83) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 63x13
-      text run at (1,0) width 63: "placeholder"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (335,168) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#008000]
-    RenderText {#text} at (1,0) size 63x13
-      text run at (1,0) width 63: "placeholder"
+  RenderBlock {DIV} at (3,3) size 119x13
diff --git a/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt b/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt
index 47d62d7..8bcd572 100644
--- a/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt
@@ -6,6 +6,4 @@ layer at (0,0) size 800x600
       RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
       RenderText {#text} at (0,0) size 0x0
 layer at (13,13) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 36x13
-      text run at (1,0) width 36: "foobar"
+  RenderBlock {DIV} at (3,3) size 119x13
diff --git a/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt b/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt
index a6894ed..552a705 100644
--- a/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt
@@ -22,14 +22,10 @@ layer at (0,0) size 800x600
       RenderTextControl {INPUT} at (592,66) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
       RenderBR {BR} at (719,80) size 0x0
 layer at (370,31) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 63x13
-      text run at (1,0) width 63: "placeholder"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (420,54) size 119x13
   RenderBlock {DIV} at (3,3) size 119x13
     RenderText {#text} at (1,0) size 25x13
       text run at (1,0) width 25: "\x{2022}\x{2022}\x{2022}\x{2022}"
 layer at (603,77) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 63x13
-      text run at (1,0) width 63: "placeholder"
+  RenderBlock {DIV} at (3,3) size 119x13
diff --git a/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt b/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
index 5d4984c..4c1819b 100644
--- a/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
@@ -27,26 +27,14 @@ layer at (0,0) size 800x600
       RenderTextControl {INPUT} at (2,43) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
       RenderText {#text} at (0,0) size 0x0
 layer at (13,31) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#640000]
-    RenderText {#text} at (1,0) size 22x13
-      text run at (1,0) width 22: "text"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (154,31) size 98x13
-  RenderBlock {DIV} at (8,0) size 98x13 [color=#640000]
-    RenderText {#text} at (1,0) size 35x13
-      text run at (1,0) width 35: "search"
+  RenderBlock {DIV} at (8,0) size 98x13
 layer at (279,31) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#640000]
-    RenderText {#text} at (1,0) size 51x13
-      text run at (1,0) width 51: "password"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (412,31) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#B80000]
-    RenderText {#text} at (1,0) size 70x13
-      text run at (1,0) width 70: "disabled text"
+  RenderBlock {DIV} at (3,3) size 119x13 [color=#545454]
 layer at (545,31) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 38x13
-      text run at (1,0) width 38: "default"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (13,54) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 86x13
-      text run at (1,0) width 86: "default disabled"
+  RenderBlock {DIV} at (3,3) size 119x13
diff --git a/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt b/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt
index ea03b1f..ace1b14 100644
--- a/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt
@@ -9,6 +9,4 @@ layer at (0,0) size 800x600
       RenderBlock {P} at (0,34) size 784x23
         RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
 layer at (13,47) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 62x13
-      text run at (1,0) width 62: "Placeholder"
+  RenderBlock {DIV} at (3,3) size 119x13
diff --git a/LayoutTests/platform/mac/fast/forms/placeholder-stripped-expected.txt b/LayoutTests/platform/mac/fast/forms/placeholder-stripped-expected.txt
index 2499cd9..abae4d8 100644
--- a/LayoutTests/platform/mac/fast/forms/placeholder-stripped-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/placeholder-stripped-expected.txt
@@ -15,16 +15,12 @@ layer at (0,0) size 800x202
         RenderBR {BR} at (165,68) size 0x18
         RenderText {#text} at (0,0) size 0x0
 layer at (13,73) size 119x13
-  RenderBlock {DIV} at (3,3) size 119x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 109x13
-      text run at (1,0) width 109: "first line second line"
+  RenderBlock {DIV} at (3,3) size 119x13
 layer at (13,96) size 119x13
   RenderBlock {DIV} at (3,3) size 119x13
 layer at (10,116) size 161x32 clip at (11,117) size 159x30
   RenderTextControl {TEXTAREA} at (2,48) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9]
-      RenderText {#text} at (0,0) size 109x13
-        text run at (0,0) width 109: "first line second line"
+    RenderBlock {DIV} at (3,3) size 155x13
 layer at (10,156) size 161x32 clip at (11,157) size 159x30
   RenderTextControl {TEXTAREA} at (2,88) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 155x13
diff --git a/LayoutTests/platform/mac/fast/forms/search-placeholder-value-changed-expected.txt b/LayoutTests/platform/mac/fast/forms/search-placeholder-value-changed-expected.txt
index 2974f67..ddfda65 100644
--- a/LayoutTests/platform/mac/fast/forms/search-placeholder-value-changed-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/search-placeholder-value-changed-expected.txt
@@ -10,6 +10,4 @@ layer at (0,0) size 800x600
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0
 layer at (21,13) size 98x13
-  RenderBlock {DIV} at (8,0) size 98x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 63x13
-      text run at (1,0) width 63: "Test Passed"
+  RenderBlock {DIV} at (8,0) size 98x13
diff --git a/LayoutTests/platform/mac/fast/forms/search-styled-expected.txt b/LayoutTests/platform/mac/fast/forms/search-styled-expected.txt
index 6eccf72..07a972c 100644
--- a/LayoutTests/platform/mac/fast/forms/search-styled-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/search-styled-expected.txt
@@ -8,7 +8,5 @@ layer at (0,0) size 800x39
           RenderBlock {DIV} at (0,0) size 22x11
           RenderBlock {DIV} at (106,0) size 13x11
       RenderText {#text} at (0,0) size 0x0
-layer at (35,13) size 84x13 scrollWidth 95
-  RenderBlock {DIV} at (22,0) size 84x13 [color=#A9A9A9]
-    RenderText {#text} at (1,0) size 93x13
-      text run at (1,0) width 93: "Search for Events"
+layer at (35,13) size 84x13
+  RenderBlock {DIV} at (22,0) size 84x13
diff --git a/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt b/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
index 3176531..4a57fb8 100644
--- a/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
@@ -15,21 +15,13 @@ layer at (0,0) size 800x600
       RenderText {#text} at (0,0) size 0x0
 layer at (10,28) size 161x32 clip at (11,29) size 159x30
   RenderTextControl {TEXTAREA} at (2,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#640000]
-      RenderText {#text} at (0,0) size 22x13
-        text run at (0,0) width 22: "text"
+    RenderBlock {DIV} at (3,3) size 155x13
 layer at (179,28) size 161x32 clip at (180,29) size 159x30
   RenderTextControl {TEXTAREA} at (171,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#B80000]
-      RenderText {#text} at (0,0) size 70x13
-        text run at (0,0) width 70: "disabled text"
+    RenderBlock {DIV} at (3,3) size 155x13 [color=#545454]
 layer at (348,28) size 161x32 clip at (349,29) size 159x30
   RenderTextControl {TEXTAREA} at (340,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9]
-      RenderText {#text} at (0,0) size 38x13
-        text run at (0,0) width 38: "default"
+    RenderBlock {DIV} at (3,3) size 155x13
 layer at (517,28) size 161x32 clip at (518,29) size 159x30
   RenderTextControl {TEXTAREA} at (509,20) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9]
-      RenderText {#text} at (0,0) size 86x13
-        text run at (0,0) width 86: "default disabled"
+    RenderBlock {DIV} at (3,3) size 155x13 [color=#545454]
diff --git a/LayoutTests/platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt b/LayoutTests/platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt
index 11662b8..e4f5d4e 100644
--- a/LayoutTests/platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/textarea-placeholder-set-attribute-expected.txt
@@ -9,6 +9,4 @@ layer at (0,0) size 800x600
       RenderBlock {P} at (0,34) size 784x36
 layer at (10,44) size 161x32 clip at (11,45) size 159x30
   RenderTextControl {TEXTAREA} at (2,2) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    RenderBlock {DIV} at (3,3) size 155x13 [color=#A9A9A9]
-      RenderText {#text} at (0,0) size 62x13
-        text run at (0,0) width 62: "Placeholder"
+    RenderBlock {DIV} at (3,3) size 155x13
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 936ed2d..05f5d5c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,34 @@
+2010-11-15  Adele Peterson  <adele at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for: https://bugs.webkit.org/show_bug.cgi?id=49452
+        Placeholder should not be swapped in and out of the text control's inner text element
+
+        There's no need to swap the placeholder text in and out of the inner text element.  Instead, just paint the text.
+        This reduces complexity and makes it easier to make independent decisions about the placeholder text and the text control value.
+
+        * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setValueFromRenderer):
+        Since updatePlaceholderVisibility checks the value, set the value before calling updatePlaceholderVisibility.
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::updatePlaceholderVisibility): Remove code that set the inner text value with the placeholder text.
+        (WebCore::RenderTextControl::paintObject):  Paint the placeholder text during the background phase.
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::nodeAtPoint): Remove custom hit testing that tried to avoid hitting the placeholder text at the wrong time.
+        (WebCore::RenderTextControlMultiLine::updateFromElement):  Remove code that set the inner text value with the placeholder text.
+        (WebCore::RenderTextControlMultiLine::createInnerTextStyle): Remove code that created the inner text style based on the placeholder pseudoelement.
+        (WebCore::RenderTextControlMultiLine::textBoxInsetLeft): Added.
+        (WebCore::RenderTextControlMultiLine::textBoxInsetRight): Added.
+        * rendering/RenderTextControlMultiLine.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::updateFromElement): Remove code that set the inner text value with the placeholder text.
+        (WebCore::RenderTextControlSingleLine::createInnerTextStyle): Remove code that created the inner text style based on the placeholder pseudoelement.
+        (WebCore::RenderTextControlSingleLine::textBoxInsetLeft): Added.
+        (WebCore::RenderTextControlSingleLine::textBoxInsetRight): Added.
+        * rendering/RenderTextControlSingleLine.h:
+        * rendering/TextControlInnerElements.cpp: Removed custom hit testing that tried to avoid hitting the placeholder text at the wrong time.
+
 2010-11-15  Andreas Kling  <kling at webkit.org>
 
         Unreviewed buildfix (Qt WebKit2 minimal)
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b5fc023..e79069d 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1125,8 +1125,8 @@ void HTMLInputElement::setValueFromRenderer(const String& value)
     // File upload controls will always use setFileListFromRenderer.
     ASSERT(deprecatedInputType() != FILE);
     m_data.setSuggestedValue(String());
-    updatePlaceholderVisibility(false);
     InputElement::setValueFromRenderer(m_data, this, this, value);
+    updatePlaceholderVisibility(false);
     setNeedsValidityCheck();
 
     // Clear autofill flag (and yellow background) on user edit.
diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp
index b3d4df0..9b9e51a 100644
--- a/WebCore/rendering/RenderTextControl.cpp
+++ b/WebCore/rendering/RenderTextControl.cpp
@@ -578,14 +578,52 @@ void RenderTextControl::updatePlaceholderVisibility(bool placeholderShouldBeVisi
 {
     bool oldPlaceholderVisible = m_placeholderVisible;
     m_placeholderVisible = placeholderShouldBeVisible;
-    if (oldPlaceholderVisible != m_placeholderVisible || placeholderValueChanged) {
-        // Sets the inner text style to the normal style or :placeholder style.
-        setInnerTextStyle(createInnerTextStyle(textBaseStyle()));
+    if (oldPlaceholderVisible != m_placeholderVisible || placeholderValueChanged)
+        repaint();
+}
 
-        // updateFromElement() of the subclasses updates the text content
-        // to the element's value(), placeholder(), or the empty string.
-        updateFromElement();
+void RenderTextControl::paintPlaceholder(PaintInfo& paintInfo, int tx, int ty)
+{
+    if (style()->visibility() != VISIBLE)
+        return;
+    
+    IntRect clipRect(tx + borderLeft(), ty + borderTop(), width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop());
+    if (clipRect.isEmpty())
+        return;
+    
+    paintInfo.context->save();
+    
+    paintInfo.context->clip(clipRect);
+    
+    RefPtr<RenderStyle> placeholderStyle = getCachedPseudoStyle(INPUT_PLACEHOLDER);
+    if (!placeholderStyle)
+        placeholderStyle = style();
+    
+    paintInfo.context->setFillColor(placeholderStyle->visitedDependentColor(CSSPropertyColor), placeholderStyle->colorSpace());
+    
+    String placeholderText = static_cast<HTMLTextFormControlElement*>(node())->strippedPlaceholder();
+    TextRun textRun(placeholderText.characters(), placeholderText.length(), 0, 0, 0, !placeholderStyle->isLeftToRightDirection(), placeholderStyle->unicodeBidi() == Override, false, false);
+    
+    RenderBox* textRenderer = innerTextElement() ? innerTextElement()->renderBox() : 0;
+    if (textRenderer) {
+        IntPoint textPoint;
+        textPoint.setY(ty + borderTop() + paddingTop() + textRenderer->paddingTop() + placeholderStyle->font().ascent());
+        if (placeholderStyle->isLeftToRightDirection())
+            textPoint.setX(tx + textBlockInsetLeft());
+        else
+            textPoint.setX(tx + width() - textBlockInsetRight() - style()->font().width(textRun));
+        
+        paintInfo.context->drawBidiText(placeholderStyle->font(), textRun, textPoint);
     }
+    paintInfo.context->restore();    
+}
+
+void RenderTextControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
+{    
+    if (m_placeholderVisible && paintInfo.phase == PaintPhaseForeground)
+        paintPlaceholder(paintInfo, tx, ty);
+    
+    RenderBlock::paintObject(paintInfo, tx, ty);
 }
 
 } // namespace WebCore
diff --git a/WebCore/rendering/RenderTextControl.h b/WebCore/rendering/RenderTextControl.h
index ed5b52b..4b1d6e3 100644
--- a/WebCore/rendering/RenderTextControl.h
+++ b/WebCore/rendering/RenderTextControl.h
@@ -96,6 +96,7 @@ private:
     virtual bool canHaveChildren() const { return false; }
     virtual bool avoidsFloats() const { return true; }
     void setInnerTextStyle(PassRefPtr<RenderStyle>);
+    virtual void paintObject(PaintInfo&, int tx, int ty);
     
     virtual void addFocusRingRects(Vector<IntRect>&, int tx, int ty);
 
@@ -108,6 +109,11 @@ private:
     bool hasVisibleTextArea() const;
     friend void setSelectionRange(Node*, int start, int end);
     bool isSelectableElement(Node*) const;
+    
+    virtual int textBlockInsetLeft() const = 0;
+    virtual int textBlockInsetRight() const = 0;
+
+    void paintPlaceholder(PaintInfo&, int tx, int ty);
 
     bool m_wasChangedSinceLastChangeEvent;
     bool m_lastChangeWasUserEdit;
diff --git a/WebCore/rendering/RenderTextControlMultiLine.cpp b/WebCore/rendering/RenderTextControlMultiLine.cpp
index e26d478..0f2a822 100644
--- a/WebCore/rendering/RenderTextControlMultiLine.cpp
+++ b/WebCore/rendering/RenderTextControlMultiLine.cpp
@@ -61,10 +61,7 @@ bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitT
     if (!RenderTextControl::nodeAtPoint(request, result, x, y, tx, ty, hitTestAction))
         return false;
 
-    bool resultIsTextValueOrPlaceholder
-        = (!m_placeholderVisible && result.innerNode() == innerTextElement())
-        || (m_placeholderVisible && result.innerNode()->isDescendantOf(innerTextElement()));
-    if (result.innerNode() == node() || resultIsTextValueOrPlaceholder)
+    if (result.innerNode() == node() || result.innerNode() == innerTextElement())
         hitInnerTextElement(result, x, y, tx, ty);
 
     return true;
@@ -107,11 +104,7 @@ void RenderTextControlMultiLine::updateFromElement()
     createSubtreeIfNeeded(0);
     RenderTextControl::updateFromElement();
 
-    HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(node());
-    if (m_placeholderVisible)
-        setInnerTextValue(textArea->strippedPlaceholder());
-    else
-        setInnerTextValue(textArea->value());
+    setInnerTextValue(static_cast<HTMLTextAreaElement*>(node())->value());
 }
 
 void RenderTextControlMultiLine::cacheSelection(int start, int end)
@@ -121,16 +114,8 @@ void RenderTextControlMultiLine::cacheSelection(int start, int end)
 
 PassRefPtr<RenderStyle> RenderTextControlMultiLine::createInnerTextStyle(const RenderStyle* startStyle) const
 {
-    RefPtr<RenderStyle> textBlockStyle;
-    if (m_placeholderVisible) {
-        if (RenderStyle* pseudoStyle = getCachedPseudoStyle(INPUT_PLACEHOLDER))
-            textBlockStyle = RenderStyle::clone(pseudoStyle);
-    }
-    if (!textBlockStyle) {
-        textBlockStyle = RenderStyle::create();
-        textBlockStyle->inheritFrom(startStyle);
-    }
-
+    RefPtr<RenderStyle> textBlockStyle = RenderStyle::create();
+    textBlockStyle->inheritFrom(startStyle);
     adjustInnerTextStyle(startStyle, textBlockStyle.get());
     textBlockStyle->setDisplay(BLOCK);
 
@@ -141,5 +126,25 @@ RenderStyle* RenderTextControlMultiLine::textBaseStyle() const
 {
     return style();
 }
+    
+int RenderTextControlMultiLine::textBlockInsetLeft() const
+{
+    int inset = borderLeft() + paddingLeft();
+    if (HTMLElement* innerText = innerTextElement()) {
+        if (RenderBox* innerTextRenderer = innerText->renderBox())
+            inset += innerTextRenderer->paddingLeft();
+    }
+    return inset;
+}
+
+int RenderTextControlMultiLine::textBlockInsetRight() const
+{
+    int inset = borderRight() + paddingRight();
+    if (HTMLElement* innerText = innerTextElement()) {
+        if (RenderBox* innerTextRenderer = innerText->renderBox())
+            inset += innerTextRenderer->paddingRight();
+    }
+    return inset;
+}
 
 }
diff --git a/WebCore/rendering/RenderTextControlMultiLine.h b/WebCore/rendering/RenderTextControlMultiLine.h
index e061e89..2e0ac81 100644
--- a/WebCore/rendering/RenderTextControlMultiLine.h
+++ b/WebCore/rendering/RenderTextControlMultiLine.h
@@ -50,6 +50,8 @@ private:
 
     virtual RenderStyle* textBaseStyle() const;
     virtual PassRefPtr<RenderStyle> createInnerTextStyle(const RenderStyle* startStyle) const;
+    virtual int textBlockInsetLeft() const;
+    virtual int textBlockInsetRight() const;
 };
 
 inline RenderTextControlMultiLine* toRenderTextControlMultiLine(RenderObject* object)
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index e99402c..d455ec0 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -674,25 +674,14 @@ void RenderTextControlSingleLine::updateFromElement()
     if (m_cancelButton)
         updateCancelButtonVisibility();
 
-    if (m_placeholderVisible) {
-        // node() must be an HTMLInputElement. WMLInputElement doesn't support placeholder.
-        ASSERT(node()->isHTMLElement());
-        ExceptionCode ec = 0;
-        innerTextElement()->setInnerText(static_cast<HTMLInputElement*>(node())->strippedPlaceholder(), ec);
-        ASSERT(!ec);
-    } else {
-        if (!inputElement()->suggestedValue().isNull())
-            setInnerTextValue(inputElement()->suggestedValue());
-        else {
-            bool shouldUpdateValue = true;
-            if (node()->isHTMLElement()) {
-                // For HTMLInputElement, update the renderer value if the element
-                // supports placeholder or the formControlValueMatchesRenderer()
-                // flag is false. It protects an unacceptable renderer value from
-                // being overwritten with the DOM value.
-                shouldUpdateValue = static_cast<HTMLTextFormControlElement*>(node())->supportsPlaceholder() || !static_cast<HTMLInputElement*>(node())->formControlValueMatchesRenderer();
-            }
-            if (shouldUpdateValue)
+    if (!inputElement()->suggestedValue().isNull())
+        setInnerTextValue(inputElement()->suggestedValue());
+    else {
+        if (node()->hasTagName(inputTag)) {
+            // For HTMLInputElement, update the renderer value if the formControlValueMatchesRenderer()
+            // flag is false. It protects an unacceptable renderer value from
+            // being overwritten with the DOM value.
+            if (!static_cast<HTMLInputElement*>(node())->formControlValueMatchesRenderer())
                 setInnerTextValue(inputElement()->value());
         }
     }
@@ -708,16 +697,8 @@ void RenderTextControlSingleLine::cacheSelection(int start, int end)
 
 PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const RenderStyle* startStyle) const
 {
-    RefPtr<RenderStyle> textBlockStyle;
-    if (m_placeholderVisible) {
-        if (RenderStyle* pseudoStyle = getCachedPseudoStyle(INPUT_PLACEHOLDER))
-            textBlockStyle = RenderStyle::clone(pseudoStyle);
-    } 
-    if (!textBlockStyle) {
-        textBlockStyle = RenderStyle::create();   
-        textBlockStyle->inheritFrom(startStyle);
-    }
-
+    RefPtr<RenderStyle> textBlockStyle = RenderStyle::create();   
+    textBlockStyle->inheritFrom(startStyle);
     adjustInnerTextStyle(startStyle, textBlockStyle.get());
 
     textBlockStyle->setWhiteSpace(PRE);
@@ -740,13 +721,6 @@ PassRefPtr<RenderStyle> RenderTextControlSingleLine::createInnerTextStyle(const
     textBlockStyle->setPaddingLeft(Length(1, Fixed));
     textBlockStyle->setPaddingRight(Length(1, Fixed));
 
-    // When the placeholder is going to be displayed, temporarily override the text security to be "none".
-    // After this, updateFromElement will immediately update the text displayed.
-    // When the placeholder is no longer visible, updatePlaceholderVisiblity will reset the style, 
-    // and the text security mode will be set back to the computed value correctly.
-    if (m_placeholderVisible)
-        textBlockStyle->setTextSecurity(TSNONE);
-
     return textBlockStyle.release();
 }
 
@@ -1112,4 +1086,24 @@ InputElement* RenderTextControlSingleLine::inputElement() const
     return toInputElement(static_cast<Element*>(node()));
 }
 
+int RenderTextControlSingleLine::textBlockInsetLeft() const
+{
+    int inset = borderLeft() + clientPaddingLeft();
+    if (HTMLElement* innerText = innerTextElement()) {
+        if (RenderBox* innerTextRenderer = innerText->renderBox())
+            inset += innerTextRenderer->paddingLeft();
+    }
+    return inset;
+}
+    
+int RenderTextControlSingleLine::textBlockInsetRight() const
+{
+    int inset = borderRight() + clientPaddingRight();
+    if (HTMLElement* innerText = innerTextElement()) {
+        if (RenderBox* innerTextRenderer = innerText->renderBox())
+            inset += innerTextRenderer->paddingRight();
+    }
+    return inset;
+}
+
 }
diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h
index 6bb1e01..26987fd 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.h
+++ b/WebCore/rendering/RenderTextControlSingleLine.h
@@ -143,6 +143,9 @@ private:
 
     InputElement* inputElement() const;
 
+    virtual int textBlockInsetLeft() const;
+    virtual int textBlockInsetRight() const;
+
     bool m_searchPopupIsVisible;
     bool m_shouldDrawCapsLockIndicator;
 
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index 73560fd..fba523e 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -51,23 +51,11 @@ public:
     RenderTextControlInnerBlock(Node* node, bool isMultiLine) : RenderBlock(node), m_multiLine(isMultiLine) { }
 
 private:
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
     virtual VisiblePosition positionForPoint(const IntPoint&);
 
     bool m_multiLine;
 };
 
-bool RenderTextControlInnerBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
-{
-    RenderObject* renderer = node()->shadowAncestorNode()->renderer();
-
-    bool placeholderIsVisible = false;
-    if (renderer->isTextField())
-        placeholderIsVisible = toRenderTextControlSingleLine(renderer)->placeholderIsVisible();
-
-    return RenderBlock::nodeAtPoint(request, result, x, y, tx, ty, placeholderIsVisible ? HitTestBlockBackground : hitTestAction);
-}
-
 VisiblePosition RenderTextControlInnerBlock::positionForPoint(const IntPoint& point)
 {
     IntPoint contentsPoint(point);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list