Changeset 279950 in webkit
- Timestamp:
- Jul 15, 2021, 9:16:40 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r279943 r279950 1 2021-07-15 Tim Nguyen <ntim@apple.com> 2 3 <dialog> element: do not perform close() method steps when removing open attribute. 4 https://bugs.webkit.org/show_bug.cgi?id=227872 5 6 Reviewed by Chris Dumez. 7 8 Test: web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html 9 10 The close function now follows the steps at: https://html.spec.whatwg.org/multipage/interactive-elements.html#close-the-dialog 11 12 * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open-expected.txt: 13 1 14 2021-07-15 Tim Nguyen <ntim@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open-expected.txt
r279943 r279950 5 5 PASS On getting, the IDL open attribute must return true if the content open attribute is set, and false if it is absent. 6 6 PASS On setting, the content open attribute must be removed if the IDL open attribute is set to false, and must be present if the IDL open attribute is set to true. 7 FAIL On setting it to false, the close event should not be fired assert_unreached: close event should not be fired when just setting the open attribute Reached unreachable code 7 PASS On setting it to false, the close event should not be fired 8 8 -
trunk/Source/WebCore/ChangeLog
r279949 r279950 1 2021-07-15 Tim Nguyen <ntim@apple.com> 2 3 <dialog> element: do not perform close() method steps when removing open attribute. 4 https://bugs.webkit.org/show_bug.cgi?id=227872 5 6 Reviewed by Chris Dumez. 7 8 Test: web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html 9 10 The close function now follows the steps at: https://html.spec.whatwg.org/multipage/interactive-elements.html#close-the-dialog 11 12 * html/HTMLDialogElement.cpp: 13 (WebCore::HTMLDialogElement::show): 14 (WebCore::HTMLDialogElement::showModal): 15 (WebCore::HTMLDialogElement::close): 16 (WebCore::HTMLDialogElement::dispatchPendingEvent): 17 (WebCore::HTMLDialogElement::isOpen const): Deleted. 18 (WebCore::HTMLDialogElement::returnValue): Deleted. 19 (WebCore::HTMLDialogElement::setReturnValue): Deleted. 20 (WebCore::HTMLDialogElement::parseAttribute): Deleted. 21 (WebCore::HTMLDialogElement::isModal const): Deleted. 22 * html/HTMLDialogElement.h: 23 1 24 2021-07-15 Jer Noble <jer.noble@apple.com> 2 25 -
trunk/Source/WebCore/html/HTMLDialogElement.cpp
r279780 r279950 54 54 } 55 55 56 bool HTMLDialogElement::isOpen() const57 {58 return m_isOpen;59 }60 61 const String& HTMLDialogElement::returnValue()62 {63 return m_returnValue;64 }65 66 void HTMLDialogElement::setReturnValue(String&& returnValue)67 {68 m_returnValue = WTFMove(returnValue);69 }70 71 56 void HTMLDialogElement::show() 72 57 { … … 74 59 if (isOpen()) 75 60 return; 76 61 77 62 setBooleanAttribute(openAttr, true); 78 63 } … … 90 75 setBooleanAttribute(openAttr, true); 91 76 77 m_isModal = true; 78 79 // FIXME: Only add dialog to top layer if it's not already in it. (webkit.org/b/227907) 92 80 document().addToTopLayer(*this); 93 m_isModal = true; 81 82 // FIXME: Add steps 8 & 9 from spec. (webkit.org/b/227537) 94 83 95 84 return { }; 96 85 } 97 86 98 void HTMLDialogElement::close(const String& re turnValue)87 void HTMLDialogElement::close(const String& result) 99 88 { 100 89 if (!isOpen()) 101 90 return; 102 91 103 92 setBooleanAttribute(openAttr, false); 104 93 105 if (!returnValue.isNull()) 106 m_returnValue = returnValue; 94 m_isModal = false; 95 96 if (!result.isNull()) 97 m_returnValue = result; 98 99 // FIXME: Only remove dialog from top layer if it's inside it. (webkit.org/b/227907) 100 document().removeFromTopLayer(*this); 101 102 // FIXME: Add step 6 from spec. (webkit.org/b/227537) 103 104 dialogCloseEventSender().cancelEvent(*this); 105 dialogCloseEventSender().dispatchEventSoon(*this); 107 106 } 108 107 … … 113 112 } 114 113 115 void HTMLDialogElement::parseAttribute(const QualifiedName& name, const AtomString& value)116 {117 if (name == openAttr) {118 bool oldValue = m_isOpen;119 m_isOpen = !value.isNull();120 121 // Emit close event122 if (oldValue != m_isOpen && !m_isOpen) {123 if (m_isModal) {124 document().removeFromTopLayer(*this);125 m_isModal = false;126 }127 128 dialogCloseEventSender().cancelEvent(*this);129 dialogCloseEventSender().dispatchEventSoon(*this);130 }131 return;132 }133 134 HTMLElement::parseAttribute(name, value);135 114 } 136 137 bool HTMLDialogElement::isModal() const138 {139 return m_isModal;140 }141 142 } -
trunk/Source/WebCore/html/HTMLDialogElement.h
r279643 r279950 38 38 template<typename... Args> static Ref<HTMLDialogElement> create(Args&&... args) { return adoptRef(*new HTMLDialogElement(std::forward<Args>(args)...)); } 39 39 ~HTMLDialogElement(); 40 41 bool isOpen() const;42 40 43 const String& returnValue(); 44 void setReturnValue(String&&); 41 bool isOpen() const { return hasAttribute(HTMLNames::openAttr); } 42 43 const String& returnValue() const { return m_returnValue; } 44 void setReturnValue(String&& value) { m_returnValue = WTFMove(value); } 45 45 46 46 void show(); … … 50 50 void dispatchPendingEvent(DialogEventSender*); 51 51 52 bool isModal() const ;52 bool isModal() const { return m_isModal; }; 53 53 54 54 private: 55 55 HTMLDialogElement(const QualifiedName&, Document&); 56 56 57 void parseAttribute(const QualifiedName&, const AtomString&) final;58 59 57 String m_returnValue; 60 58 bool m_isModal { false }; 61 bool m_isOpen { false };62 59 }; 63 60
Note:
See TracChangeset
for help on using the changeset viewer.