Changeset 249194 in webkit
- Timestamp:
- Aug 28, 2019, 3:22:56 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 26 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/blink/fast/forms/label/label-contains-other-interactive-content-expected.txt (added)
-
LayoutTests/imported/blink/fast/forms/label/label-contains-other-interactive-content.html (added)
-
LayoutTests/platform/ios-wk2/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLAnchorElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLAnchorElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLAppletElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLButtonElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLDetailsElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLEmbedElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLIFrameElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLImageElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLImageElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLInputElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLInputElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLLabelElement.cpp (modified) (2 diffs)
-
Source/WebCore/html/HTMLLabelElement.h (modified) (2 diffs)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLObjectElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLObjectElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLSelectElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLTextAreaElement.h (modified) (1 diff)
-
Source/WebCore/html/HiddenInputType.h (modified) (1 diff)
-
Source/WebCore/html/InputType.cpp (modified) (1 diff)
-
Source/WebCore/html/InputType.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249191 r249194 1 2019-08-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Unable to enter text in https://eat.fi 4 https://bugs.webkit.org/show_bug.cgi?id=193046 5 6 Reviewed by Ryosuke Niwa. 7 8 Add new test imported for blink. 9 10 * imported/blink/fast/forms/label/label-contains-other-interactive-content-expected.txt: Added. 11 * imported/blink/fast/forms/label/label-contains-other-interactive-content.html: Added. 12 * platform/ios-wk2/TestExpectations: Skip the new test because it requires eventSender.mouseDown/Up/MoveTo() 13 1 14 2019-08-28 Said Abou-Hallawa <sabouhallawa@apple.com> 2 15 -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r249108 r249194 1017 1017 fast/loader/location-hash-user-gesture.html [ Skip ] 1018 1018 imported/blink/editing/selection/selectstart-event-crash.html [ Skip ] 1019 imported/blink/fast/forms/label/label-contains-other-interactive-content.html [ Skip ] 1019 1020 fast/dom/Window/post-message-user-action.html [ Skip ] 1020 1021 fast/images/image-usemap-parsing.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r249192 r249194 1 2019-08-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Unable to enter text in https://eat.fi 4 https://bugs.webkit.org/show_bug.cgi?id=193046 5 6 Reviewed by Ryosuke Niwa. 7 8 This is because the button element inside the label is receiving the click event, which causes the form to be 9 submitted. According to the spec we should do nothing in this case, because button element is considered to be 10 interactive content. 11 12 "The activation behavior of a label element for events targeted at interactive content descendants of a label 13 element, and any descendants of those interactive content descendants, must be to do nothing." 14 https://html.spec.whatwg.org/#the-label-element 15 16 This patch adds HTMLElement::isInteractiveContent() according to the HTML spec: 17 18 "Interactive content is content that is specifically intended for user interaction. 19 a (if the href attribute is present), audio (if the controls attribute is present), button, details, embed, 20 iframe, img (if the usemap attribute is present), input (if the type attribute is not in the Hidden state), 21 label, object (if the usemap attribute is present), select, textarea, video (if the controls attribute is 22 present)" 23 https://html.spec.whatwg.org/#interactive-content-2 24 25 That's used in HTMLLabelElement::defaultEventHandler() using the helper method 26 isEventTargetedAtInteractiveDescendants() to decide whether to simulate a click event or do nothing. 27 28 * html/HTMLAnchorElement.cpp: 29 (WebCore::HTMLAnchorElement::isInteractiveContent const): 30 * html/HTMLAnchorElement.h: 31 * html/HTMLButtonElement.h: 32 * html/HTMLDetailsElement.h: 33 * html/HTMLElement.h: 34 (WebCore::HTMLElement::isInteractiveContent const): 35 * html/HTMLEmbedElement.h: 36 * html/HTMLIFrameElement.h: 37 * html/HTMLImageElement.cpp: 38 (WebCore::HTMLImageElement::isInteractiveContent const): 39 * html/HTMLImageElement.h: 40 * html/HTMLInputElement.cpp: 41 (WebCore::HTMLInputElement::isInteractiveContent const): 42 * html/HTMLInputElement.h: 43 * html/HTMLLabelElement.cpp: 44 (WebCore::HTMLLabelElement::isEventTargetedAtInteractiveDescendants const): 45 (WebCore::HTMLLabelElement::defaultEventHandler): 46 * html/HTMLLabelElement.h: 47 * html/HTMLMediaElement.cpp: 48 (WebCore::HTMLMediaElement::isInteractiveContent const): 49 * html/HTMLMediaElement.h: 50 * html/HTMLObjectElement.cpp: 51 (WebCore::HTMLObjectElement::isInteractiveContent const): 52 * html/HTMLObjectElement.h: 53 * html/HTMLSelectElement.h: 54 * html/HTMLTextAreaElement.h: 55 * html/HiddenInputType.h: 56 * html/InputType.cpp: 57 (WebCore::InputType::isInteractiveContent const): 58 * html/InputType.h: 59 1 60 2019-08-28 Claudio Saavedra <csaavedra@igalia.com> 2 61 -
trunk/Source/WebCore/html/HTMLAnchorElement.cpp
r248846 r249194 104 104 } 105 105 106 bool HTMLAnchorElement::isInteractiveContent() const 107 { 108 return isLink(); 109 } 110 106 111 static bool hasNonEmptyBox(RenderBoxModelObject* renderer) 107 112 { -
trunk/Source/WebCore/html/HTMLAnchorElement.h
r248784 r249194 91 91 int defaultTabIndex() const final; 92 92 bool draggable() const final; 93 bool isInteractiveContent() const final; 93 94 94 95 String effectiveTarget() const; -
trunk/Source/WebCore/html/HTMLAppletElement.h
r246490 r249194 45 45 46 46 bool canEmbedJava() const; 47 48 bool isInteractiveContent() const final { return true; } 47 49 }; 48 50 -
trunk/Source/WebCore/html/HTMLButtonElement.h
r248914 r249194 62 62 bool isEnumeratable() const final { return true; } 63 63 bool supportLabels() const final { return true; } 64 bool isInteractiveContent() const final { return true; } 64 65 65 66 bool isSuccessfulSubmitButton() const final; -
trunk/Source/WebCore/html/HTMLDetailsElement.h
r246490 r249194 52 52 void didAddUserAgentShadowRoot(ShadowRoot&) final; 53 53 bool hasCustomFocusLogic() const final { return true; } 54 bool isInteractiveContent() const final { return true; } 54 55 55 56 bool m_isOpen { false }; -
trunk/Source/WebCore/html/HTMLElement.h
r248784 r249194 91 91 virtual FormAssociatedElement* asFormAssociatedElement(); 92 92 93 virtual bool isInteractiveContent() const { return false; } 94 93 95 bool hasTagName(const HTMLQualifiedName& name) const { return hasLocalName(name.localName()); } 94 96 -
trunk/Source/WebCore/html/HTMLEmbedElement.h
r246490 r249194 44 44 const AtomString& imageSourceURL() const final; 45 45 46 bool isInteractiveContent() const final { return true; } 47 46 48 RenderWidget* renderWidgetLoadingPlugin() const final; 47 49 -
trunk/Source/WebCore/html/HTMLIFrameElement.h
r247529 r249194 54 54 void collectStyleForPresentationAttribute(const QualifiedName&, const AtomString&, MutableStyleProperties&) final; 55 55 56 bool isInteractiveContent() const final { return true; } 57 56 58 bool rendererIsNeeded(const RenderStyle&) final; 57 59 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r246490 r249194 304 304 } 305 305 306 bool HTMLImageElement::isInteractiveContent() const 307 { 308 return hasAttributeWithoutSynchronization(usemapAttr); 309 } 310 306 311 void HTMLImageElement::didAttachRenderers() 307 312 { -
trunk/Source/WebCore/html/HTMLImageElement.h
r246490 r249194 157 157 const HTMLImageElement& asHTMLElement() const final { return *this; } 158 158 159 bool isInteractiveContent() const final; 160 159 161 void selectImageSource(); 160 162 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r248914 r249194 451 451 } 452 452 453 bool HTMLInputElement::isInteractiveContent() const 454 { 455 return m_inputType->isInteractiveContent(); 456 } 457 453 458 bool HTMLInputElement::isTextFormControlFocusable() const 454 459 { -
trunk/Source/WebCore/html/HTMLInputElement.h
r248914 r249194 376 376 bool shouldUseInputMethod() final; 377 377 378 bool isInteractiveContent() const final; 379 378 380 bool isInnerTextElementEditable() const final { return !hasAutoFillStrongPasswordButton() && HTMLTextFormControlElement::isInnerTextElementEditable(); } 379 381 -
trunk/Source/WebCore/html/HTMLLabelElement.cpp
r246490 r249194 112 112 } 113 113 114 bool HTMLLabelElement::isEventTargetedAtInteractiveDescendants(Event& event) const 115 { 116 if (!is<Node>(event.target())) 117 return false; 118 119 auto& node = downcast<Node>(*event.target()); 120 if (!containsIncludingShadowDOM(&node)) 121 return false; 122 123 for (const auto* it = &node; it && it != this; it = it->parentElementInComposedTree()) { 124 if (is<HTMLElement>(it) && downcast<HTMLElement>(*it).isInteractiveContent()) 125 return true; 126 } 127 128 return false; 129 } 114 130 void HTMLLabelElement::defaultEventHandler(Event& event) 115 131 { … … 122 138 // event, then there's no need for us to do anything. 123 139 if (!control || (is<Node>(event.target()) && control->containsIncludingShadowDOM(&downcast<Node>(*event.target())))) { 140 HTMLElement::defaultEventHandler(event); 141 return; 142 } 143 144 // The activation behavior of a label element for events targeted at interactive 145 // content descendants of a label element, and any descendants of those interactive 146 // content descendants, must be to do nothing. 147 // https://html.spec.whatwg.org/#the-label-element 148 if (isEventTargetedAtInteractiveDescendants(event)) { 124 149 HTMLElement::defaultEventHandler(event); 125 150 return; -
trunk/Source/WebCore/html/HTMLLabelElement.h
r229694 r249194 41 41 HTMLLabelElement(const QualifiedName&, Document&); 42 42 43 bool isEventTargetedAtInteractiveDescendants(Event&) const; 44 43 45 void accessKeyAction(bool sendMouseEvents) final; 44 46 … … 51 53 52 54 void focus(bool restorePreviousSelection, FocusDirection) final; 55 56 bool isInteractiveContent() const final { return true; } 53 57 }; 54 58 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r249175 r249194 804 804 } 805 805 806 bool HTMLMediaElement::isInteractiveContent() const 807 { 808 return controls(); 809 } 810 806 811 void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomString& value) 807 812 { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r248762 r249194 627 627 void removedFromAncestor(RemovalType, ContainerNode&) override; 628 628 void didRecalcStyle(Style::Change) override; 629 bool isInteractiveContent() const override; 629 630 630 631 void willBecomeFullscreenElement() override; -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r247529 r249194 326 326 } 327 327 328 bool HTMLObjectElement::isInteractiveContent() const 329 { 330 return hasAttributeWithoutSynchronization(usemapAttr); 331 } 332 328 333 const AtomString& HTMLObjectElement::imageSourceURL() const 329 334 { -
trunk/Source/WebCore/html/HTMLObjectElement.h
r246490 r249194 96 96 const HTMLObjectElement& asHTMLElement() const final { return *this; } 97 97 98 bool isInteractiveContent() const final; 99 98 100 bool isFormControlElement() const final { return false; } 99 101 -
trunk/Source/WebCore/html/HTMLSelectElement.h
r248914 r249194 124 124 bool isEnumeratable() const final { return true; } 125 125 bool supportLabels() const final { return true; } 126 127 bool isInteractiveContent() const final { return true; } 126 128 127 129 FormControlState saveFormControlState() const final; -
trunk/Source/WebCore/html/HTMLTextAreaElement.h
r248914 r249194 99 99 bool supportLabels() const final { return true; } 100 100 101 bool isInteractiveContent() const final { return true; } 102 101 103 const AtomString& formControlType() const final; 102 104 -
trunk/Source/WebCore/html/HiddenInputType.h
r246490 r249194 50 50 bool isHiddenType() const override; 51 51 bool supportLabels() const override { return false; } 52 bool isInteractiveContent() const final { return false; } 52 53 bool shouldRespectHeightAndWidthAttributes() override; 53 54 void setValue(const String&, bool, TextFieldEventBehavior) override; -
trunk/Source/WebCore/html/InputType.cpp
r246490 r249194 798 798 } 799 799 800 bool InputType::isInteractiveContent() const 801 { 802 return true; 803 } 804 800 805 bool InputType::supportLabels() const 801 806 { -
trunk/Source/WebCore/html/InputType.h
r246490 r249194 102 102 virtual bool isHiddenType() const; 103 103 virtual bool isImageButton() const; 104 virtual bool isInteractiveContent() const; 104 105 virtual bool supportLabels() const; 105 106 virtual bool isMonthField() const;
Note:
See TracChangeset
for help on using the changeset viewer.