Changeset 279414 in webkit
- Timestamp:
- Jun 30, 2021, 9:31:57 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r279409 r279414 1 2021-06-30 Tim Nguyen <ntim@apple.com> 2 3 Add modal dialog UA styles 4 https://bugs.webkit.org/show_bug.cgi?id=226175 5 6 Reviewed by Antti Koivisto. 7 8 This adds an :-internal-modal-dialog pseudo class and a test to make sure it does not leak. 9 10 This improves WPT results a lot and expectations have been updated. Some tests start failing, 11 but those are mainly top-layer related (which isn't implemented yet). 12 13 * TestExpectations: 14 * fast/css/pseudo-class-internal-expected.txt: Added. 15 * fast/css/pseudo-class-internal.html: Added. 16 * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/abspos-dialog-layout-expected.txt: 17 * platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/centering-expected.txt: Removed. 18 1 19 2021-06-30 Tim Nguyen <ntim@apple.com> 2 20 -
trunk/LayoutTests/TestExpectations
r279401 r279414 2228 2228 fast/multicol/multicol-with-child-renderLayer-for-input.html [ ImageOnlyFailure ] 2229 2229 2230 # Modal <dialog> support2231 webkit.org/b/ 226175imported/blink/dialog/modal-dialog-in-replaced-renderer.html [ ImageOnlyFailure ]2232 webkit.org/b/ 226175imported/blink/dialog/modal-dialog-in-table-column.html [ ImageOnlyFailure ]2233 webkit.org/b/ 226175 imported/blink/dialog/modal-dialog-sibling.html [ ImageOnlyFailure ]2230 # Modal <dialog> in top layer 2231 webkit.org/b/84796 imported/blink/dialog/modal-dialog-in-replaced-renderer.html [ ImageOnlyFailure ] 2232 webkit.org/b/84796 imported/blink/dialog/modal-dialog-in-table-column.html [ ImageOnlyFailure ] 2233 webkit.org/b/84796 imported/blink/fast/dom/HTMLDialogElement/dont-share-style-to-top-layer.html [ ImageOnlyFailure ] 2234 2234 2235 2235 # Assertion failure in MessagePort::contextDestroyed, usually attributed to later tests -
trunk/LayoutTests/imported/w3c/ChangeLog
r279409 r279414 1 2021-06-30 Tim Nguyen <ntim@apple.com> 2 3 Add modal dialog UA styles 4 https://bugs.webkit.org/show_bug.cgi?id=226175 5 6 Reviewed by Antti Koivisto. 7 8 This adds an :-internal-modal-dialog pseudo class and a test to make sure it does not leak. 9 10 This improves WPT results a lot and expectations have been updated. Some tests start failing, 11 but those are mainly top-layer related (which isn't implemented yet). 12 13 * web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/dialog-expected.txt: 14 * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/abspos-dialog-layout-expected.txt: 15 * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/centering-expected.txt: 16 1 17 2021-06-30 Tim Nguyen <ntim@apple.com> 2 18 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/dialog-expected.txt
r278003 r279414 4 4 PASS Closed dialog in width: 540px iframe 5 5 PASS Open dialog in width: 540px iframe 6 FAIL Modal dialog in width: 540px iframe assert_equals: top expected "56px" but got " 8px"6 FAIL Modal dialog in width: 540px iframe assert_equals: top expected "56px" but got "0px" 7 7 PASS Closed dialog in width: 538px iframe 8 8 PASS Open dialog in width: 538px iframe 9 FAIL Modal dialog in width: 538px iframe assert_equals: top expected "56px" but got " 8px"9 FAIL Modal dialog in width: 538px iframe assert_equals: top expected "56px" but got "0px" 10 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/abspos-dialog-layout-expected.txt
r279409 r279414 1 1 2 FAIL showModal() should center in the viewport assert_approx_equals: expected 291 +/- 1 but got -500 3 FAIL Dialog should be recentered if showModal() is called after close() assert_approx_equals: expected 291 +/- 1 but got -1000 2 PASS showModal() should center in the viewport 3 PASS Dialog should be recentered if showModal() is called after close() 4 4 PASS Dialog should not recenter on relayout. 5 FAIL A tall dialog should be positioned at the top of the viewport. assert_equals: expected 0 but got -500 6 FAIL The dialog should be centered regardless of the presence of a horizontal scrollbar. assert_approx_equals: expected 0 +/- 1 but got -500 7 FAIL Centering should work when dialog is inside positioned containers. assert_approx_equals: expected 275 +/- 1 but got 330 5 PASS A tall dialog should be positioned at the top of the viewport. 6 PASS The dialog should be centered regardless of the presence of a horizontal scrollbar. 7 PASS Centering should work when dialog is inside positioned containers. 8 8 PASS A centered dialog's position should survive becoming display:none temporarily. 9 FAIL Dialog should not still be centered when removed, and re-added to the document. assert_ approx_equals: expected 285 +/-1 but got 3209 FAIL Dialog should not still be centered when removed, and re-added to the document. assert_equals: expected 291 but got 320 10 10 PASS Dialog's specified position should survive after close() and showModal(). 11 FAIL Dialog should be recentered if showModal() is called after removing 'open'. assert_approx_equals: expected 0 +/- 1 but got -500 11 PASS Dialog should be recentered if showModal() is called after removing 'open'. 12 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/centering-expected.txt
r279409 r279414 1 1 2 FAIL horizontal-tb: tall viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 3 FAIL horizontal-tb: tall viewport, default-sizes: false assert_equals: expected 45 but got 8 4 FAIL horizontal-tb: wide viewport, default-sizes: true assert_approx_equals: expected 11 +/- 0.016666666666666666 but got 8 5 FAIL horizontal-tb: wide viewport, default-sizes: false assert_equals: expected 15 but got 8 6 FAIL horizontal-tb: square viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 7 FAIL horizontal-tb: square viewport, default-sizes: false assert_equals: expected 45 but got 8 8 FAIL horizontal-tb: dialog and viewport match, default-sizes: false assert_equals: expected 0 but got 8 9 FAIL vertical-rl: tall viewport, default-sizes: true assert_approx_equals: expected 11 +/- 0.016666666666666666 but got 14 10 FAIL vertical-rl: tall viewport, default-sizes: false assert_equals: expected 10 but got 12 11 FAIL vertical-lr: tall viewport, default-sizes: true assert_approx_equals: expected 11 +/- 0.016666666666666666 but got 8 12 FAIL vertical-lr: tall viewport, default-sizes: false assert_equals: expected 10 but got 8 13 FAIL vertical-rl (dialog horizontal-tb): tall viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 14 FAIL vertical-rl (dialog horizontal-tb): tall viewport, default-sizes: false assert_equals: expected 45 but got 8 15 FAIL vertical-lr (dialog horizontal-tb): tall viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 16 FAIL vertical-lr (dialog horizontal-tb): tall viewport, default-sizes: false assert_equals: expected 45 but got 8 17 FAIL horizontal-tb (container vertical-rl): tall viewport, default-sizes: true assert_approx_equals: expected 11 +/- 0.016666666666666666 but got 14 18 FAIL horizontal-tb (container vertical-rl): tall viewport, default-sizes: false assert_equals: expected 10 but got 12 19 FAIL vertical-rl (container horizontal-tb): tall viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 20 FAIL vertical-rl (container horizontal-tb): tall viewport, default-sizes: false assert_equals: expected 45 but got 8 21 FAIL horizontal-tb (container vertical-rl) (dialog horizontal-tb): tall viewport, default-sizes: true assert_approx_equals: expected 41 +/- 0.016666666666666666 but got 8 22 FAIL horizontal-tb (container vertical-rl) (dialog horizontal-tb): tall viewport, default-sizes: false assert_equals: expected 45 but got 8 23 FAIL vertical-rl (container horizontal-tb) (dialog vertical-rl): tall viewport, default-sizes: true assert_approx_equals: expected 11 +/- 0.016666666666666666 but got 14 24 FAIL vertical-rl (container horizontal-tb) (dialog vertical-rl): tall viewport, default-sizes: false assert_equals: expected 10 but got 12 2 PASS horizontal-tb: tall viewport, default-sizes: true 3 PASS horizontal-tb: tall viewport, default-sizes: false 4 PASS horizontal-tb: wide viewport, default-sizes: true 5 PASS horizontal-tb: wide viewport, default-sizes: false 6 PASS horizontal-tb: square viewport, default-sizes: true 7 PASS horizontal-tb: square viewport, default-sizes: false 8 PASS horizontal-tb: dialog and viewport match, default-sizes: false 9 PASS vertical-rl: tall viewport, default-sizes: true 10 PASS vertical-rl: tall viewport, default-sizes: false 11 PASS vertical-lr: tall viewport, default-sizes: true 12 PASS vertical-lr: tall viewport, default-sizes: false 13 PASS vertical-rl (dialog horizontal-tb): tall viewport, default-sizes: true 14 PASS vertical-rl (dialog horizontal-tb): tall viewport, default-sizes: false 15 PASS vertical-lr (dialog horizontal-tb): tall viewport, default-sizes: true 16 PASS vertical-lr (dialog horizontal-tb): tall viewport, default-sizes: false 17 PASS horizontal-tb (container vertical-rl): tall viewport, default-sizes: true 18 PASS horizontal-tb (container vertical-rl): tall viewport, default-sizes: false 19 PASS vertical-rl (container horizontal-tb): tall viewport, default-sizes: true 20 PASS vertical-rl (container horizontal-tb): tall viewport, default-sizes: false 21 PASS horizontal-tb (container vertical-rl) (dialog horizontal-tb): tall viewport, default-sizes: true 22 PASS horizontal-tb (container vertical-rl) (dialog horizontal-tb): tall viewport, default-sizes: false 23 PASS vertical-rl (container horizontal-tb) (dialog vertical-rl): tall viewport, default-sizes: true 24 PASS vertical-rl (container horizontal-tb) (dialog vertical-rl): tall viewport, default-sizes: false 25 25 -
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/abspos-dialog-layout-expected.txt
r279409 r279414 1 1 2 FAIL showModal() should center in the viewport assert_approx_equals: expected 290 +/- 1 but got -500 3 FAIL Dialog should be recentered if showModal() is called after close() assert_approx_equals: expected 290 +/- 1 but got -1000 2 PASS showModal() should center in the viewport 3 PASS Dialog should be recentered if showModal() is called after close() 4 4 PASS Dialog should not recenter on relayout. 5 FAIL A tall dialog should be positioned at the top of the viewport. assert_equals: expected 0 but got -500 6 FAIL The dialog should be centered regardless of the presence of a horizontal scrollbar. assert_approx_equals: expected 0 +/- 1 but got -500 7 FAIL Centering should work when dialog is inside positioned containers. assert_approx_equals: expected 275 +/- 1 but got 330 5 PASS A tall dialog should be positioned at the top of the viewport. 6 PASS The dialog should be centered regardless of the presence of a horizontal scrollbar. 7 PASS Centering should work when dialog is inside positioned containers. 8 8 PASS A centered dialog's position should survive becoming display:none temporarily. 9 FAIL Dialog should not still be centered when removed, and re-added to the document. assert_ approx_equals: expected 285 +/- 1but got 3209 FAIL Dialog should not still be centered when removed, and re-added to the document. assert_equals: expected 290 but got 320 10 10 PASS Dialog's specified position should survive after close() and showModal(). 11 FAIL Dialog should be recentered if showModal() is called after removing 'open'. assert_approx_equals: expected 0 +/- 1 but got -500 11 PASS Dialog should be recentered if showModal() is called after removing 'open'. 12 12 -
trunk/Source/WebCore/ChangeLog
r279413 r279414 1 2021-06-30 Tim Nguyen <ntim@apple.com> 2 3 Add modal dialog UA styles 4 https://bugs.webkit.org/show_bug.cgi?id=226175 5 6 Reviewed by Antti Koivisto. 7 8 This adds an :-internal-modal-dialog pseudo class and a test to make sure it does not leak. 9 10 This improves WPT results a lot and expectations have been updated. Some tests start failing, 11 but those are mainly top-layer related (which isn't implemented yet). 12 13 * css/CSSSelector.cpp: 14 (WebCore::CSSSelector::selectorText const): 15 * css/CSSSelector.h: 16 * css/SelectorChecker.cpp: 17 (WebCore::SelectorChecker::checkOne const): 18 * css/SelectorCheckerTestFunctions.h: 19 (WebCore::matchesModalDialogPseudoClass): 20 * css/SelectorPseudoClassAndCompatibilityElementMap.in: 21 * css/dialog.css: 22 (dialog:-internal-modal-dialog): 23 * css/parser/CSSSelectorParser.cpp: 24 (WebCore::CSSSelectorParser::consumePseudo): 25 * cssjit/SelectorCompiler.cpp: 26 (WebCore::SelectorCompiler::JSC_DEFINE_JIT_OPERATION): 27 (WebCore::SelectorCompiler::addPseudoClassType): 28 * html/HTMLDialogElement.cpp: 29 (WebCore::HTMLDialogElement::showModal): 30 (WebCore::HTMLDialogElement::parseAttribute): 31 (WebCore::HTMLDialogElement::isModal const): 32 * html/HTMLDialogElement.h: 33 1 34 2021-06-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 35 -
trunk/Source/WebCore/css/CSSSelector.cpp
r279408 r279414 545 545 builder.append(":link"); 546 546 break; 547 case CSSSelector::PseudoClassModalDialog: 548 builder.append(":-internal-modal-dialog"); 549 break; 547 550 case CSSSelector::PseudoClassNoButton: 548 551 builder.append(":no-button"); -
trunk/Source/WebCore/css/CSSSelector.h
r272983 r279414 175 175 PseudoClassHasAttachment, 176 176 #endif 177 PseudoClassModalDialog, 177 178 }; 178 179 -
trunk/Source/WebCore/css/SelectorChecker.cpp
r272983 r279414 1081 1081 return hasAttachment(element); 1082 1082 #endif 1083 1084 case CSSSelector::PseudoClassModalDialog: 1085 return matchesModalDialogPseudoClass(element); 1083 1086 1084 1087 case CSSSelector::PseudoClassUnknown: -
trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h
r274173 r279414 31 31 #include "FrameSelection.h" 32 32 #include "FullscreenManager.h" 33 #include "HTMLDialogElement.h" 33 34 #include "HTMLFrameElement.h" 34 35 #include "HTMLIFrameElement.h" … … 489 490 } 490 491 492 ALWAYS_INLINE bool matchesModalDialogPseudoClass(const Element& element) 493 { 494 if (is<HTMLDialogElement>(element)) 495 return downcast<HTMLDialogElement>(element).isModal(); 496 return false; 497 } 498 491 499 } // namespace WebCore -
trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
r279408 r279414 1 1 -internal-direct-focus 2 -internal-modal-dialog 2 3 -khtml-drag 3 4 -webkit-any -
trunk/Source/WebCore/css/dialog.css
r278003 r279414 16 16 display: block; 17 17 } 18 19 dialog:-internal-modal-dialog { 20 position: fixed; 21 overflow: auto; 22 inset-block-start: 0; 23 inset-block-end: 0; 24 max-width: calc(100% - 6px - 2em); 25 max-height: calc(100% - 6px - 2em); 26 } -
trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp
r278253 r279414 584 584 if (m_context.mode != UASheetMode && selector->pseudoClassType() == CSSSelector::PseudoClassDirectFocus) 585 585 return nullptr; 586 if (m_context.mode != UASheetMode && selector->pseudoClassType() == CSSSelector::PseudoClassModalDialog) 587 return nullptr; 586 588 if (!m_context.focusVisibleEnabled && selector->pseudoClassType() == CSSSelector::PseudoClassFocusVisible) 587 589 return nullptr; -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r278253 r279414 116 116 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationHasAttachment, bool, (const Element&)); 117 117 #endif 118 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationMatchesModalDialogPseudoClass, bool, (const Element&)); 118 119 119 120 static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(operationAttributeValueBeginsWithCaseSensitive, bool, (const Attribute* attribute, AtomStringImpl* expectedString)); … … 753 754 { 754 755 return matchesLangPseudoClass(element, argumentList); 756 } 757 758 JSC_DEFINE_JIT_OPERATION(operationMatchesModalDialogPseudoClass, bool, (const Element& element)) 759 { 760 return matchesModalDialogPseudoClass(element); 755 761 } 756 762 … … 870 876 #endif 871 877 878 case CSSSelector::PseudoClassModalDialog: 879 fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr<JSC::OperationPtrTag>(operationMatchesModalDialogPseudoClass)); 880 return FunctionType::SimpleSelectorChecker; 881 872 882 // These pseudo-classes only have meaning with scrollbars. 873 883 case CSSSelector::PseudoClassHorizontal: -
trunk/Source/WebCore/html/HTMLDialogElement.cpp
r279406 r279414 89 89 90 90 setOpen(true); 91 m_isModal = true; 92 91 93 return { }; 92 94 } … … 116 118 // Emit close event 117 119 if (oldValue != m_isOpen && !m_isOpen) { 120 m_isModal = false; 118 121 dialogCloseEventSender().cancelEvent(*this); 119 122 dialogCloseEventSender().dispatchEventSoon(*this); … … 130 133 } 131 134 135 bool HTMLDialogElement::isModal() const 136 { 137 return m_isModal; 132 138 } 139 140 } -
trunk/Source/WebCore/html/HTMLDialogElement.h
r279406 r279414 50 50 void dispatchPendingEvent(DialogEventSender*); 51 51 52 bool isModal() const; 53 52 54 private: 53 55 HTMLDialogElement(const QualifiedName&, Document&); … … 58 60 59 61 String m_returnValue; 62 bool m_isModal { false }; 60 63 bool m_isOpen { false }; 61 64 };
Note:
See TracChangeset
for help on using the changeset viewer.