[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:38:35 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b6e6211e27f549d047f540dd97982b773c391813
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 16 18:43:27 2009 +0000

    2009-12-16  Zelidrag Hornung  <zelidrag at chromium.org>
    
            Reviewed by Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=32261
            Added ability to separate the autocomplete suggestion previewing from
            the actual accepting of the suggested value in HTMLInputElement.
            This element (it's single line text incarnation) can now
            be put in suggestion mode where renderer might display the suggested
            value without making it automatically exposed to JavaScript.
    
            No new tests. This new methods are not exposed yet. It's use will be
            platform specific. PopupMenu and Chromium specific changes will be
            separated based on Darin Adler's comments.
    
            * dom/InputElement.h:
            (WebCore::InputElementData::suggestedValue):
            (WebCore::InputElementData::setSuggestedValue):
            * html/HTMLInputElement.cpp:
            (WebCore::HTMLInputElement::suggestedValue):
            (WebCore::HTMLInputElement::setSuggestedValue):
            (WebCore::HTMLInputElement::setValue):
            (WebCore::HTMLInputElement::setValueFromRenderer):
            * html/HTMLInputElement.h:
            * rendering/RenderTextControlSingleLine.cpp:
            (WebCore::RenderTextControlSingleLine::updateFromElement):
            * wml/WMLInputElement.cpp:
            (WebCore::WMLInputElement::suggestedValue):
            * wml/WMLInputElement.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52204 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 28acfd2..288b665 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2009-12-16  Zelidrag Hornung  <zelidrag at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32261
+        Added ability to separate the autocomplete suggestion previewing from
+        the actual accepting of the suggested value in HTMLInputElement.
+        This element (it's single line text incarnation) can now
+        be put in suggestion mode where renderer might display the suggested
+        value without making it automatically exposed to JavaScript.
+
+        No new tests. This new methods are not exposed yet. It's use will be
+        platform specific. PopupMenu and Chromium specific changes will be
+        separated based on Darin Adler's comments.
+
+        * dom/InputElement.h:
+        (WebCore::InputElementData::suggestedValue):
+        (WebCore::InputElementData::setSuggestedValue):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::suggestedValue):
+        (WebCore::HTMLInputElement::setSuggestedValue):
+        (WebCore::HTMLInputElement::setValue):
+        (WebCore::HTMLInputElement::setValueFromRenderer):
+        * html/HTMLInputElement.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::updateFromElement):
+        * wml/WMLInputElement.cpp:
+        (WebCore::WMLInputElement::suggestedValue):
+        * wml/WMLInputElement.h:
+
 2009-12-16  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h
index 2ae0312..a24b438 100644
--- a/WebCore/dom/InputElement.h
+++ b/WebCore/dom/InputElement.h
@@ -47,6 +47,7 @@ public:
     virtual bool searchEventsShouldBeDispatched() const = 0;
 
     virtual int size() const = 0;
+    virtual const String& suggestedValue() const = 0;
     virtual String value() const = 0;
     virtual void setValue(const String&, bool sendChangeEvent = false) = 0;
     virtual void setValueForUser(const String&) = 0;
@@ -92,6 +93,9 @@ public:
     String value() const { return m_value; }
     void setValue(const String& value) { m_value = value; }
 
+    const String& suggestedValue() const { return m_suggestedValue; }
+    void setSuggestedValue(const String& value) { m_suggestedValue = value; }
+
     int size() const { return m_size; }
     void setSize(int value) { m_size = value; }
 
@@ -107,6 +111,7 @@ public:
 private:
     AtomicString m_name;
     String m_value;
+    String m_suggestedValue;
     int m_size;
     int m_maxLength;
     int m_cachedSelectionStart;
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index a00a731..227ad9c 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1313,6 +1313,23 @@ void HTMLInputElement::setValueForUser(const String& value)
     setValue(value, true);
 }
 
+const String& HTMLInputElement::suggestedValue() const
+{
+    return m_data.suggestedValue();
+}
+
+void HTMLInputElement::setSuggestedValue(const String& value)
+{
+    if (inputType() != TEXT)
+        return;
+    setFormControlValueMatchesRenderer(false);
+    m_data.setSuggestedValue(sanitizeValue(value));
+    updatePlaceholderVisibility(false);
+    if (renderer())
+        renderer()->updateFromElement();
+    setNeedsStyleRecalc();
+}
+
 void HTMLInputElement::setValue(const String& value, bool sendChangeEvent)
 {
     // For security reasons, we don't allow setting the filename, but we do allow clearing it.
@@ -1345,6 +1362,7 @@ void HTMLInputElement::setValue(const String& value, bool sendChangeEvent)
             InputElement::updateSelectionRange(this, this, max, max);
         else
             cacheSelection(max, max);
+        m_data.setSuggestedValue(String());
     }
 
     // Don't dispatch the change event when focused, it will be dispatched
@@ -1375,6 +1393,7 @@ void HTMLInputElement::setValueFromRenderer(const String& value)
 {
     // File upload controls will always use setFileListFromRenderer.
     ASSERT(inputType() != FILE);
+    m_data.setSuggestedValue(String());
     updatePlaceholderVisibility(false);
     InputElement::setValueFromRenderer(m_data, this, this, value);
     updateValidity();
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index 8f00aeb..53be5cc 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -137,6 +137,9 @@ public:
     virtual const AtomicString& formControlType() const;
     void setType(const String&);
 
+    virtual const String& suggestedValue() const;
+    void setSuggestedValue(const String&);
+
     virtual String value() const;
     virtual void setValue(const String&, bool sendChangeEvent = false);
     virtual void setValueForUser(const String&);
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index 3df1930..1c83466 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -461,8 +461,12 @@ void RenderTextControlSingleLine::updateFromElement()
         ExceptionCode ec = 0;
         innerTextElement()->setInnerText(static_cast<Element*>(node())->getAttribute(placeholderAttr), ec);
         ASSERT(!ec);
-    } else
-        setInnerTextValue(inputElement()->value());
+    } else {
+        if (!inputElement()->suggestedValue().isNull())
+            setInnerTextValue(inputElement()->suggestedValue());
+        else
+            setInnerTextValue(inputElement()->value());
+    }
 
     if (m_searchPopupIsVisible)
         m_searchPopup->updateFromElement();
diff --git a/WebCore/wml/WMLInputElement.cpp b/WebCore/wml/WMLInputElement.cpp
index ebe0172..560fd09 100644
--- a/WebCore/wml/WMLInputElement.cpp
+++ b/WebCore/wml/WMLInputElement.cpp
@@ -123,6 +123,11 @@ const AtomicString& WMLInputElement::formControlName() const
     return m_data.name();
 }
 
+const String& WMLInputElement::suggestedValue() const
+{
+    return m_data.suggestedValue();
+}
+
 String WMLInputElement::value() const
 {
     String value = m_data.value();
diff --git a/WebCore/wml/WMLInputElement.h b/WebCore/wml/WMLInputElement.h
index 571a20b..217d9c7 100644
--- a/WebCore/wml/WMLInputElement.h
+++ b/WebCore/wml/WMLInputElement.h
@@ -56,6 +56,7 @@ public:
     virtual int size() const;
     virtual const AtomicString& formControlType() const;
     virtual const AtomicString& formControlName() const;
+    virtual const String& suggestedValue() const;
     virtual String value() const;
     virtual void setValue(const String&, bool sendChangeEvent = false);
     virtual void setValueForUser(const String&);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list