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

joepeck at webkit.org joepeck at webkit.org
Wed Dec 22 13:09:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 25d8d6802cb65959eea38e083aaa533e369bd466
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 7 23:33:59 2010 +0000

    2010-09-03  Joseph Pecoraro  <joepeck at webkit.org>
    
            Reviewed by Darin Adler.
    
            Provide a way to trigger a <select multiple> onchange event on changes
            https://bugs.webkit.org/show_bug.cgi?id=45192
    
            Test: LayoutTests/platform/mac/fast/objc/dom-html-select-activate.html
    
            This provides a way for a WebKit client using the Obj-C DOM bindings to
            trigger the "change" on a listbox select (<select multiple> or <select>
            with size > 1). This is because when a select is rendered as a listbox
            "change" events are triggered by mouse down events.
    
            This adds -[DOMHTMLSelectElement _activateItemAtIndex:allowMultipleSelection:]
            to allow for handling multiple selections if the select element is a
            multi-select.
    
            * bindings/objc/DOMHTML.mm:
            (-[DOMHTMLSelectElement _activateItemAtIndex:allowMultipleSelection:]):
            * bindings/objc/DOMPrivate.h: unified the Category name. Was "FormsAutocomplete" now all are "FormAutocomplete".
            * dom/SelectElement.h:
            * html/HTMLSelectElement.cpp:
            (WebCore::HTMLSelectElement::setSelectedIndexByUser): listboxs need to be treated specially to fire their "change" event.
            * html/HTMLSelectElement.h:
            * wml/WMLSelectElement.cpp:
            (WebCore::WMLSelectElement::setSelectedIndexByUser):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7571f87..06d0a99 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2010-09-03  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Provide a way to trigger a <select multiple> onchange event on changes
+        https://bugs.webkit.org/show_bug.cgi?id=45192
+
+        Test: LayoutTests/platform/mac/fast/objc/dom-html-select-activate.html
+
+        This provides a way for a WebKit client using the Obj-C DOM bindings to
+        trigger the "change" on a listbox select (<select multiple> or <select>
+        with size > 1). This is because when a select is rendered as a listbox
+        "change" events are triggered by mouse down events.
+
+        This adds -[DOMHTMLSelectElement _activateItemAtIndex:allowMultipleSelection:]
+        to allow for handling multiple selections if the select element is a
+        multi-select.
+
+        * bindings/objc/DOMHTML.mm:
+        (-[DOMHTMLSelectElement _activateItemAtIndex:allowMultipleSelection:]):
+        * bindings/objc/DOMPrivate.h: unified the Category name. Was "FormsAutocomplete" now all are "FormAutocomplete".
+        * dom/SelectElement.h:
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::setSelectedIndexByUser): listboxs need to be treated specially to fire their "change" event.
+        * html/HTMLSelectElement.h:
+        * wml/WMLSelectElement.cpp:
+        (WebCore::WMLSelectElement::setSelectedIndexByUser):
+
 2010-09-07  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bindings/objc/DOMHTML.mm b/WebCore/bindings/objc/DOMHTML.mm
index db64afe..884a5b0 100644
--- a/WebCore/bindings/objc/DOMHTML.mm
+++ b/WebCore/bindings/objc/DOMHTML.mm
@@ -166,6 +166,15 @@
         select->setSelectedIndexByUser(index, true, true);
 }
 
+- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection
+{
+    // Use the setSelectedIndexByUser function so a change event will be fired. <rdar://problem/6760590>
+    // If this is a <select multiple> the allowMultipleSelection flag will allow setting multiple
+    // selections without clearing the other selections.
+    if (WebCore::HTMLSelectElement* select = core(self))
+        select->setSelectedIndexByUser(index, true, true, allowMultipleSelection);
+}
+
 @end
 
 @implementation DOMHTMLInputElement (FormPromptAdditions)
diff --git a/WebCore/bindings/objc/DOMPrivate.h b/WebCore/bindings/objc/DOMPrivate.h
index b8e4460..ab3b563 100644
--- a/WebCore/bindings/objc/DOMPrivate.h
+++ b/WebCore/bindings/objc/DOMPrivate.h
@@ -69,7 +69,7 @@
 // All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
 // Each one should eventually be replaced by public DOM API, and when that happens Safari will switch to implementations 
 // using that public API, and these will be deleted.
- at interface DOMHTMLInputElement (FormsAutoFillTransition)
+ at interface DOMHTMLInputElement (FormAutoFillTransition)
 - (BOOL)_isAutofilled;
 - (BOOL)_isTextField;
 - (NSRect)_rectOnScreen; // bounding box of the text field, in screen coordinates
@@ -92,6 +92,7 @@
 // They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
 // replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
 // and these will be deleted.
- at interface DOMHTMLSelectElement (FormsAutoFillTransition)
+ at interface DOMHTMLSelectElement (FormAutoFillTransition)
 - (void)_activateItemAtIndex:(int)index;
+- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection;
 @end
diff --git a/WebCore/dom/SelectElement.h b/WebCore/dom/SelectElement.h
index f00bb67..73e2620 100644
--- a/WebCore/dom/SelectElement.h
+++ b/WebCore/dom/SelectElement.h
@@ -59,7 +59,7 @@ public:
 
     virtual int selectedIndex() const = 0;
     virtual void setSelectedIndex(int index, bool deselect = true) = 0;
-    virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false) = 0;
+    virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false, bool allowMultipleSelection = false) = 0;
 
     virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) = 0;
 
diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp
index b1b6d23..c680e92 100644
--- a/WebCore/html/HTMLSelectElement.cpp
+++ b/WebCore/html/HTMLSelectElement.cpp
@@ -85,8 +85,17 @@ void HTMLSelectElement::setSelectedIndex(int optionIndex, bool deselect)
     SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, false, false);
 }
 
-void HTMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow)
+void HTMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow, bool allowMultipleSelection)
 {
+    // List box selects can fire onchange events through user interaction, such as
+    // mousedown events. This allows that same behavior programmatically.
+    if (!m_data.usesMenuList()) {
+        updateSelectedState(m_data, this, optionIndex, allowMultipleSelection, false);
+        if (fireOnChangeNow)
+            listBoxOnChange();
+        return;
+    }
+
     // Bail out if this index is already the selected one, to avoid running unnecessary JavaScript that can mess up
     // autofill, when there is no actual change (see https://bugs.webkit.org/show_bug.cgi?id=35256 and rdar://7467917 ).
     // Perhaps this logic could be moved into SelectElement, but some callers of SelectElement::setSelectedIndex()
diff --git a/WebCore/html/HTMLSelectElement.h b/WebCore/html/HTMLSelectElement.h
index 79b0789..a3b4460 100644
--- a/WebCore/html/HTMLSelectElement.h
+++ b/WebCore/html/HTMLSelectElement.h
@@ -41,7 +41,7 @@ public:
 
     virtual int selectedIndex() const;
     virtual void setSelectedIndex(int index, bool deselect = true);
-    virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false);
+    virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false, bool allowMultipleSelection = false);
 
     unsigned length() const;
 
diff --git a/WebCore/wml/WMLSelectElement.cpp b/WebCore/wml/WMLSelectElement.cpp
index 81c3a77..78749b3 100644
--- a/WebCore/wml/WMLSelectElement.cpp
+++ b/WebCore/wml/WMLSelectElement.cpp
@@ -114,8 +114,9 @@ void WMLSelectElement::setSelectedIndex(int optionIndex, bool deselect)
     SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, false, false);
 }
 
-void WMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow)
+void WMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow, bool allowMultipleSelection)
 {
+    UNUSED_PARAM(allowMultipleSelection);
     SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, fireOnChangeNow, true);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list