Fix for 10841, unable to check checkboxes inside labels.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 07:01:48 +0000 (07:01 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 07:01:48 +0000 (07:01 +0000)
        Reviewed by xenon, bradee-oh

        * css/html4.css:
        * dom/Element.cpp:
        (WebCore::Element::contains):
        * dom/Element.h:
        * html/HTMLLabelElement.cpp:
        (WebCore::HTMLLabelElement::defaultEventHandler):

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

WebCore/ChangeLog
WebCore/css/html4.css
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/html/HTMLLabelElement.cpp

index 353102d985ac80102b7837d7933a75a3d10b36c5..1bd4c4fc09665143b9ff3156a6ade78562d686e1 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-13  David Hyatt  <hyatt@apple.com>
+
+        Fix for 10841, unable to check checkboxes inside labels.
+
+        Reviewed by xenon, bradee-oh
+
+        * css/html4.css:
+        * dom/Element.cpp:
+        (WebCore::Element::contains):
+        * dom/Element.h:
+        * html/HTMLLabelElement.cpp:
+        (WebCore::HTMLLabelElement::defaultEventHandler):
+
 2006-09-13  Mark Rowe  <opendarwin.org@bdash.net.nz>
 
         Reviewed by Adam.
index 828831636f8ade85345322e79a55ceff4a2d1bf9..ff00f025945585817599500f257f658eecaafb5f 100644 (file)
@@ -277,7 +277,7 @@ form {
 
 label {
     cursor: default;
-    -webkit-user-select: none;
+    -webkit-user-select: ignore
 }
 
 legend {
index 35421c595ab38910aa2b0f9055e5a6f2b368a416..a7ee2c7116850049dcee2280ffd60ba41d864743 100644 (file)
@@ -488,11 +488,11 @@ Node* Element::insertAdjacentElement(const String& where, Node* newChild, int& e
     return 0;
 }
 
-bool Element::contains(const Element* element) const
+bool Element::contains(const Node* node) const
 {
-    if (!element)
+    if (!node)
         return false;
-    return this == element || element->isAncestor(this);
+    return this == node || node->isAncestor(this);
 }
 
 void Element::createAttributeMap() const
index edbc71a5b19bb588dc31e04f2bdc945991b6a5a9..900f7413e29f0bf5f474ed325cf78028a91abfa7 100644 (file)
@@ -167,7 +167,7 @@ public:
 #endif
 
     Node* insertAdjacentElement(const String& where, Node* newChild, int& exception);
-    bool contains(const Element*) const;
+    bool contains(const Node*) const;
  
 protected:
     virtual void createAttributeMap() const;
index 3241c93d92f08994613e87f422637ec040138967..8a69aad44790b0c186d1896243238e6882adc32c 100644 (file)
@@ -109,7 +109,10 @@ void HTMLLabelElement::defaultEventHandler(Event* evt)
 
     if (evt->type() == clickEvent && !processingClick) {
         HTMLElement* element = formElement();
-        if (!element)
+        
+        // If we can't find a control or if the control received the click
+        // event, then there's no need for us to do anything.
+        if (!element || element->contains(evt->target()))
             return;
         
         processingClick = true;