Changeset 237932 in webkit
- Timestamp:
- Nov 7, 2018 11:33:54 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r237929 r237932 1 2018-11-07 Dan Bernstein <mitz@apple.com> 2 3 Add a pseudoclass that matches img elements that are backed by an attachment 4 https://bugs.webkit.org/show_bug.cgi?id=191286 5 <rdar://problem/45823554> 6 7 Reviewed by Dean Jackson. 8 9 * fast/css/has-attachment-expected.txt: Added. 10 * fast/css/has-attachment.html: Added. 11 * platform/win/TestExpectations: 12 1 13 2018-11-07 Ali Juma <ajuma@chromium.org> 2 14 -
trunk/LayoutTests/platform/win/TestExpectations
r237927 r237932 626 626 # TODO Attachment elements do not provide a custom renderer 627 627 webkit.org/b/142260 fast/attachment [ Skip ] 628 webkit.org/b/142260 fast/css/has-attachment.html [ Skip ] 628 629 629 630 # TODO APNG is not supported -
trunk/Source/WebCore/ChangeLog
r237930 r237932 1 2018-11-07 Dan Bernstein <mitz@apple.com> 2 3 Add a pseudoclass that matches img elements that are backed by an attachment 4 https://bugs.webkit.org/show_bug.cgi?id=191286 5 <rdar://problem/45823554> 6 7 Reviewed by Dean Jackson. 8 9 Test: fast/css/has-attachment.html 10 11 Added a :has-attachment pseudoclass, enabled only when the attachment element is enabled at 12 runtime, that matches elements (currently only img elements qualify) that have an attachment 13 element in their shadow DOM. 14 15 * css/CSSSelector.cpp: 16 (WebCore::CSSSelector::selectorText const): Handle the new PseudoClassHasAttachment value. 17 * css/CSSSelector.h: Added a new value to the PseudoClassType enum. 18 19 * css/SelectorChecker.cpp: 20 (WebCore::SelectorChecker::checkOne const): Check the new PseudoClassHasAttachment value 21 using the new hasAttachment test function. 22 23 * css/SelectorCheckerTestFunctions.h: 24 (WebCore::hasAttachment): Added. Tests if the element is an img element that has an 25 attachment. 26 27 * css/SelectorPseudoClassAndCompatibilityElementMap.in: Added has-attachment. 28 29 * css/parser/CSSParserContext.cpp: 30 (WebCore::CSSParserContext::CSSParserContext): Initialize new attachmentEnabled member based 31 on RuntimeEnabledFeatures. 32 (WebCore::operator==): Compare new attachmentEnabled member. 33 * css/parser/CSSParserContext.h: 34 (WebCore::CSSParserContextHash::hash): Include new attachmentEnabled member. 35 36 * css/parser/CSSSelectorParser.cpp: 37 (WebCore::CSSSelectorParser::consumePseudo): Reject :has-attachment if the attachment 38 element is not enabled. 39 40 * cssjit/SelectorCompiler.cpp: 41 (WebCore::SelectorCompiler::addPseudoClassType): Handle PseudoClassHasAttachment. 42 1 43 2018-11-07 Don Olmstead <don.olmstead@sony.com> 2 44 -
trunk/Source/WebCore/css/CSSSelector.cpp
r236284 r237932 506 506 break; 507 507 #endif 508 #if ENABLE(ATTACHMENT_ELEMENT) 509 case CSSSelector::PseudoClassHasAttachment: 510 str.appendLiteral(":has-attachment"); 511 break; 512 #endif 508 513 case CSSSelector::PseudoClassHorizontal: 509 514 str.appendLiteral(":horizontal"); -
trunk/Source/WebCore/css/CSSSelector.h
r236284 r237932 163 163 PseudoClassHost, 164 164 PseudoClassDefined, 165 #if ENABLE(ATTACHMENT_ELEMENT) 166 PseudoClassHasAttachment, 167 #endif 165 168 }; 166 169 -
trunk/Source/WebCore/css/SelectorChecker.cpp
r235917 r237932 1110 1110 case CSSSelector::PseudoClassRole: 1111 1111 return false; 1112 #endif 1113 1114 #if ENABLE(ATTACHMENT_ELEMENT) 1115 case CSSSelector::PseudoClassHasAttachment: 1116 return hasAttachment(element); 1112 1117 #endif 1113 1118 -
trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h
r233066 r237932 35 35 #include <wtf/Compiler.h> 36 36 37 #if ENABLE(ATTACHMENT_ELEMENT) 38 #include "HTMLAttachmentElement.h" 39 #endif 40 37 41 #if ENABLE(VIDEO_TRACK) 38 42 #include "WebVTTElement.h" … … 130 134 return !page->focusController().isActive(); 131 135 } 136 137 #if ENABLE(ATTACHMENT_ELEMENT) 138 ALWAYS_INLINE bool hasAttachment(const Element& element) 139 { 140 return is<HTMLImageElement>(element) && downcast<HTMLImageElement>(element).attachmentElement(); 141 } 142 #endif 132 143 133 144 ALWAYS_INLINE bool containslanguageSubtagMatchingRange(StringView language, StringView range, unsigned languageLength, unsigned& position) -
trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
r233066 r237932 29 29 focus 30 30 focus-within 31 #if ENABLE(ATTACHMENT_ELEMENT) 32 has-attachment 33 #endif 31 34 horizontal 32 35 host, PseudoClassHost, PseudoElementUnknown -
trunk/Source/WebCore/css/parser/CSSParserContext.cpp
r237402 r237932 29 29 #include "Document.h" 30 30 #include "Page.h" 31 #include "RuntimeEnabledFeatures.h" 31 32 #include "Settings.h" 32 33 #include <wtf/NeverDestroyed.h> … … 69 70 constantPropertiesEnabled = document.settings().constantPropertiesEnabled(); 70 71 colorFilterEnabled = document.settings().colorFilterEnabled(); 72 #if ENABLE(ATTACHMENT_ELEMENT) 73 attachmentEnabled = RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled(); 74 #endif 71 75 deferredCSSParserEnabled = document.settings().deferredCSSParserEnabled(); 72 76 useSystemAppearance = document.page() ? document.page()->useSystemAppearance() : false; … … 95 99 && a.constantPropertiesEnabled == b.constantPropertiesEnabled 96 100 && a.colorFilterEnabled == b.colorFilterEnabled 101 #if ENABLE(ATTACHMENT_ELEMENT) 102 && a.attachmentEnabled == b.attachmentEnabled 103 #endif 97 104 && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled 98 105 && a.hasDocumentSecurityOrigin == b.hasDocumentSecurityOrigin -
trunk/Source/WebCore/css/parser/CSSParserContext.h
r237402 r237932 56 56 bool constantPropertiesEnabled { false }; 57 57 bool colorFilterEnabled { false }; 58 #if ENABLE(ATTACHMENT_ELEMENT) 59 bool attachmentEnabled { false }; 60 #endif 58 61 bool deferredCSSParserEnabled { false }; 59 62 … … 99 102 & key.hasDocumentSecurityOrigin << 9 100 103 & key.useSystemAppearance << 10 101 & key.mode << 11; // Keep this last. 104 #if ENABLE(ATTACHMENT_ELEMENT) 105 & key.attachmentEnabled << 11 106 #endif 107 & key.mode << 12; // Keep this last. 102 108 hash ^= WTF::intHash(bits); 103 109 return hash; -
trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp
r235002 r237932 494 494 auto value = StringView { lowercasedValue }; 495 495 496 if (colons == 1) 496 if (colons == 1) { 497 497 selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoClassSelectorFromStringView(value)); 498 else { 498 #if ENABLE(ATTACHMENT_ELEMENT) 499 if (!m_context.attachmentEnabled && selector && selector->match() == CSSSelector::PseudoClass && selector->pseudoClassType() == CSSSelector::PseudoClassHasAttachment) 500 return nullptr; 501 #endif 502 } else { 499 503 selector = std::unique_ptr<CSSParserSelector>(CSSParserSelector::parsePseudoElementSelectorFromStringView(value)); 500 504 #if ENABLE(VIDEO_TRACK) -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r237173 r237932 620 620 #endif 621 621 622 #if ENABLE(ATTACHMENT_ELEMENT) 623 case CSSSelector::PseudoClassHasAttachment: 624 fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr<CSSOperationPtrTag>(hasAttachment)); 625 return FunctionType::SimpleSelectorChecker; 626 #endif 627 622 628 // These pseudo-classes only have meaning with scrollbars. 623 629 case CSSSelector::PseudoClassHorizontal:
Note: See TracChangeset
for help on using the changeset viewer.