Changeset 205660 in webkit
- Timestamp:
- Sep 8, 2016 2:09:04 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r205581 r205660 1360 1360 css/parser/CSSPropertyParser.cpp 1361 1361 css/parser/CSSPropertyParserHelpers.cpp 1362 css/parser/CSSSelectorParser.cpp 1362 1363 css/parser/CSSTokenizer.cpp 1363 1364 css/parser/CSSTokenizerInputStream.cpp -
trunk/Source/WebCore/ChangeLog
r205659 r205660 1 2016-09-08 Dave Hyatt <hyatt@apple.com> 2 3 [CSS Parser] Add support for new CSS selector parsing 4 https://bugs.webkit.org/show_bug.cgi?id=161749 5 6 Reviewed by Dean Jackson. 7 8 * CMakeLists.txt: 9 * WebCore.xcodeproj/project.pbxproj: 10 * contentextensions/ContentExtensionParser.cpp: 11 (WebCore::ContentExtensions::isValidSelector): 12 * css/CSSDefaultStyleSheets.cpp: 13 (WebCore::parseUASheet): 14 * css/CSSFontFaceSet.cpp: 15 (WebCore::CSSFontFaceSet::matchingFaces): 16 * css/CSSGrammar.y.in: 17 * css/CSSSelector.cpp: 18 (WebCore::CSSSelector::selectorText): 19 * css/CSSSelector.h: 20 * css/DOMCSSNamespace.cpp: 21 (WebCore::DOMCSSNamespace::supports): 22 * css/FontFace.cpp: 23 (WebCore::FontFace::parseString): 24 (WebCore::FontFace::setVariant): 25 * css/MediaList.cpp: 26 (WebCore::MediaQuerySet::internalParse): 27 (WebCore::MediaQuerySet::parse): 28 * css/SelectorChecker.cpp: 29 (WebCore::SelectorChecker::matchRecursively): 30 * css/SelectorFilter.cpp: 31 (WebCore::SelectorFilter::collectIdentifierHashes): 32 * css/SelectorPseudoClassAndCompatibilityElementMap.in: 33 * css/SelectorPseudoTypeMap.h: 34 * css/SourceSizeList.cpp: 35 (WebCore::parseSizesAttribute): 36 * css/StyleProperties.cpp: 37 (WebCore::MutableStyleProperties::MutableStyleProperties): 38 * css/StyleProperties.h: 39 * css/StyleRuleImport.cpp: 40 (WebCore::StyleRuleImport::setCSSStyleSheet): 41 * css/StyleSheetContents.cpp: 42 (WebCore::StyleSheetContents::StyleSheetContents): 43 (WebCore::StyleSheetContents::parserAddNamespace): 44 (WebCore::StyleSheetContents::namespaceURIFromPrefix): 45 (WebCore::StyleSheetContents::determineNamespace): Deleted. 46 * css/StyleSheetContents.h: 47 * css/WebKitCSSMatrix.cpp: 48 (WebCore::WebKitCSSMatrix::setMatrixValue): 49 * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: 50 * css/parser/CSSParser.cpp: 51 (WebCore::strictCSSParserContext): 52 (WebCore::CSSParserContext::CSSParserContext): 53 (WebCore::CSSParser::parseColor): 54 (WebCore::CSSParser::shouldAcceptUnitLessValues): 55 (WebCore::CSSParser::parseValue): 56 (WebCore::CSSParser::parseColumnWidth): 57 (WebCore::CSSParser::parseColumnCount): 58 (WebCore::CSSParser::parseFontWeight): 59 (WebCore::CSSParser::parseColorParameters): 60 (WebCore::CSSParser::parseHSLParameters): 61 (WebCore::CSSParser::parseShadow): 62 (WebCore::CSSParser::parseBorderImageSlice): 63 (WebCore::CSSParser::parseBorderImageQuad): 64 (WebCore::CSSParser::parseDeprecatedLinearGradient): 65 (WebCore::CSSParser::parseLinearGradient): 66 (WebCore::CSSParser::parseTransformValue): 67 (WebCore::CSSParser::parseBuiltinFilterArguments): 68 (WebCore::CSSParser::determineNameInNamespace): 69 * css/parser/CSSParser.h: 70 (WebCore::CSSParser::inStrictMode): 71 (WebCore::CSSParser::inQuirksMode): 72 * css/parser/CSSParserMode.h: 73 (WebCore::isQuirksModeBehavior): 74 (WebCore::isUASheetBehavior): 75 (WebCore::isUnitLessLengthParsingEnabledForMode): 76 (WebCore::isCSSViewportParsingEnabledForMode): 77 (WebCore::strictToCSSParserMode): 78 (WebCore::isStrictParserMode): 79 * css/parser/CSSParserValues.cpp: 80 (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView): 81 (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView): 82 (WebCore::CSSParserSelector::setSelectorList): 83 (WebCore::CSSParserSelector::appendTagHistory): 84 (WebCore::CSSParserSelector::releaseTagHistory): 85 (WebCore::CSSParserSelector::isHostPseudoSelector): 86 * css/parser/CSSParserValues.h: 87 (WebCore::CSSParserSelector::match): 88 (WebCore::CSSParserSelector::pseudoElementType): 89 (WebCore::CSSParserSelector::selectorList): 90 (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching): 91 * css/parser/CSSPropertyParser.h: 92 (WebCore::CSSPropertyParser::inQuirksMode): 93 * css/parser/CSSSelectorParser.cpp: Added. 94 (WebCore::CSSSelectorParser::parseSelector): 95 (WebCore::CSSSelectorParser::CSSSelectorParser): 96 (WebCore::CSSSelectorParser::consumeComplexSelectorList): 97 (WebCore::CSSSelectorParser::consumeCompoundSelectorList): 98 (WebCore::CSSSelectorParser::consumeComplexSelector): 99 (WebCore::CSSSelectorParser::consumeCompoundSelector): 100 (WebCore::CSSSelectorParser::consumeSimpleSelector): 101 (WebCore::CSSSelectorParser::consumeName): 102 (WebCore::CSSSelectorParser::consumeId): 103 (WebCore::CSSSelectorParser::consumeClass): 104 (WebCore::CSSSelectorParser::consumeAttribute): 105 (WebCore::CSSSelectorParser::consumePseudo): 106 (WebCore::CSSSelectorParser::consumeCombinator): 107 (WebCore::CSSSelectorParser::consumeAttributeMatch): 108 (WebCore::CSSSelectorParser::consumeAttributeFlags): 109 (WebCore::CSSSelectorParser::consumeANPlusB): 110 (WebCore::CSSSelectorParser::defaultNamespace): 111 (WebCore::CSSSelectorParser::determineNamespace): 112 (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded): 113 (WebCore::CSSSelectorParser::addSimpleSelectorToCompound): 114 (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator): 115 * css/parser/CSSSelectorParser.h: Added. 116 (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope): 117 (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope): 118 * cssjit/SelectorCompiler.cpp: 119 (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation): 120 * dom/StyledElement.cpp: 121 (WebCore::StyledElement::rebuildPresentationAttributeStyle): 122 * svg/SVGFontFaceElement.cpp: 123 (WebCore::SVGFontFaceElement::SVGFontFaceElement): 124 1 125 2016-09-08 Simon Fraser <simon.fraser@apple.com> 2 126 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r205581 r205660 3375 3375 94DE5C811D7F3A1400164F2A /* CSSAtRuleID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94DE5C7F1D7F39D000164F2A /* CSSAtRuleID.cpp */; }; 3376 3376 94DE5C821D7F3A1400164F2A /* CSSAtRuleID.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DE5C801D7F39D000164F2A /* CSSAtRuleID.h */; }; 3377 94DE5C8D1D80802700164F2A /* CSSSelectorParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */; }; 3378 94DE5C8E1D80802700164F2A /* CSSSelectorParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */; }; 3377 3379 96ABA42314BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */; }; 3378 3380 9703E1BF15DC4E37001F24C8 /* JSVoidCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E9EC8B15DC492F004F2E71 /* JSVoidCallback.cpp */; }; … … 10526 10528 94DE5C7F1D7F39D000164F2A /* CSSAtRuleID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSAtRuleID.cpp; path = parser/CSSAtRuleID.cpp; sourceTree = "<group>"; }; 10527 10529 94DE5C801D7F39D000164F2A /* CSSAtRuleID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSAtRuleID.h; path = parser/CSSAtRuleID.h; sourceTree = "<group>"; }; 10530 94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSSelectorParser.cpp; path = parser/CSSSelectorParser.cpp; sourceTree = "<group>"; }; 10531 94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSSelectorParser.h; path = parser/CSSSelectorParser.h; sourceTree = "<group>"; }; 10528 10532 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGGraphicsElement.h; sourceTree = "<group>"; }; 10529 10533 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DOpenGLCommon.cpp; sourceTree = "<group>"; }; … … 18185 18189 949C77021D6E393500C0DE4F /* CSSPropertyParserHelpers.cpp */, 18186 18190 949C77031D6E393500C0DE4F /* CSSPropertyParserHelpers.h */, 18191 94DE5C8B1D80801500164F2A /* CSSSelectorParser.cpp */, 18192 94DE5C8C1D80801500164F2A /* CSSSelectorParser.h */, 18187 18193 946D37341D6CDF980077084F /* CSSTokenizer.cpp */, 18188 18194 946D37371D6CDF980077084F /* CSSTokenizer.h */, … … 26652 26658 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */, 26653 26659 088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */, 26660 94DE5C8E1D80802700164F2A /* CSSSelectorParser.h in Headers */, 26654 26661 081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */, 26655 26662 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */, … … 28930 28937 BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */, 28931 28938 A84EBD840CB8C97700079609 /* JSStyleSheetList.cpp in Sources */, 28939 94DE5C8D1D80802700164F2A /* CSSSelectorParser.cpp in Sources */, 28932 28940 A84EBD780CB8C89200079609 /* JSStyleSheetListCustom.cpp in Sources */, 28933 28941 B20111070AB7740500DB0E68 /* JSSVGAElement.cpp in Sources */, -
trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp
r205569 r205660 187 187 static bool isValidSelector(const String& selector) 188 188 { 189 CSSParserContext context( CSSQuirksMode);189 CSSParserContext context(HTMLQuirksMode); 190 190 CSSParser parser(context); 191 191 CSSSelectorList selectorList; -
trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp
r201205 r205660 96 96 static StyleSheetContents* parseUASheet(const String& str) 97 97 { 98 StyleSheetContents& sheet = StyleSheetContents::create( ).leakRef(); // leak the sheet on purpose98 StyleSheetContents& sheet = StyleSheetContents::create(CSSParserContext(UASheetMode)).leakRef(); // leak the sheet on purpose 99 99 sheet.parseString(str); 100 100 return &sheet; -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r203092 r205660 329 329 Vector<std::reference_wrapper<CSSFontFace>> result; 330 330 auto style = MutableStyleProperties::create(); 331 auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, CSSStrictMode, nullptr);331 auto parseResult = CSSParser::parseValue(style, CSSPropertyFont, font, true, HTMLStandardMode, nullptr); 332 332 if (parseResult == CSSParser::ParseResult::Error) { 333 333 ec = SYNTAX_ERR; -
trunk/Source/WebCore/css/CSSGrammar.y.in
r204591 r205660 1257 1257 $$ = new CSSParserSelector; 1258 1258 $$->setMatch(CSSSelector::Id); 1259 if (parser->m_context.mode == CSSQuirksMode)1259 if (parser->m_context.mode == HTMLQuirksMode) 1260 1260 $1.convertToASCIILowercaseInPlace(); 1261 1261 $$->setValue($1); … … 1267 1267 $$ = new CSSParserSelector; 1268 1268 $$->setMatch(CSSSelector::Id); 1269 if (parser->m_context.mode == CSSQuirksMode)1269 if (parser->m_context.mode == HTMLQuirksMode) 1270 1270 $1.convertToASCIILowercaseInPlace(); 1271 1271 $$->setValue($1); … … 1281 1281 $$ = new CSSParserSelector; 1282 1282 $$->setMatch(CSSSelector::Class); 1283 if (parser->m_context.mode == CSSQuirksMode)1283 if (parser->m_context.mode == HTMLQuirksMode) 1284 1284 $2.convertToASCIILowercaseInPlace(); 1285 1285 $$->setValue($2); -
trunk/Source/WebCore/css/CSSSelector.cpp
r205103 r205660 736 736 case CSSSelector::Child: 737 737 return tagHistory->selectorText(" > " + str.toString() + rightSide); 738 case CSSSelector::ShadowDeep: 739 return tagHistory->selectorText(" /deep/ " + str.toString() + rightSide); 738 740 case CSSSelector::DirectAdjacent: 739 741 return tagHistory->selectorText(" + " + str.toString() + rightSide); … … 746 748 #endif 747 749 case CSSSelector::ShadowDescendant: 750 case CSSSelector::ShadowPseudo: 751 case CSSSelector::ShadowSlot: 748 752 return tagHistory->selectorText(str.toString() + rightSide); 749 753 } -
trunk/Source/WebCore/css/CSSSelector.h
r203250 r205660 88 88 IndirectAdjacent, 89 89 SubSelector, 90 ShadowDescendant, 90 ShadowDescendant, // FIXME-NEWPARSER: Remove this in favor of the new shadow values below. 91 ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element 92 ShadowDeep, // /deep/ combinator 93 ShadowSlot // slotted to <slot> e 91 94 }; 92 95 … … 218 221 }; 219 222 223 enum AttributeMatchType { 224 CaseSensitive, 225 CaseInsensitive, 226 }; 227 220 228 static PseudoElementType parsePseudoElementType(const String&); 221 229 static PseudoId pseudoId(PseudoElementType); -
trunk/Source/WebCore/css/DOMCSSNamespace.cpp
r205103 r205660 70 70 71 71 auto dummyStyle = MutableStyleProperties::create(); 72 return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error;72 return CSSParser::parseValue(dummyStyle, propertyID, normalizedValue, false, HTMLStandardMode, nullptr) != CSSParser::ParseResult::Error; 73 73 } 74 74 75 75 bool DOMCSSNamespace::supports(const String& conditionText) 76 76 { 77 CSSParserContext context( CSSStrictMode);77 CSSParserContext context(HTMLStandardMode); 78 78 CSSParser parser(context); 79 79 return parser.parseSupportsCondition(conditionText); -
trunk/Source/WebCore/css/FontFace.cpp
r205405 r205660 131 131 { 132 132 auto style = MutableStyleProperties::create(); 133 if (CSSParser::parseValue(style, propertyID, string, true, CSSStrictMode, nullptr) == CSSParser::ParseResult::Error)133 if (CSSParser::parseValue(style, propertyID, string, true, HTMLStandardMode, nullptr) == CSSParser::ParseResult::Error) 134 134 return nullptr; 135 135 return style->getPropertyCSSValue(propertyID); … … 205 205 206 206 auto style = MutableStyleProperties::create(); 207 auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, CSSStrictMode, nullptr);207 auto result = CSSParser::parseValue(style, CSSPropertyFontVariant, variant, true, HTMLStandardMode, nullptr); 208 208 if (result == CSSParser::ParseResult::Error) { 209 209 ec = SYNTAX_ERR; -
trunk/Source/WebCore/css/MediaList.cpp
r204006 r205660 130 130 Optional<MediaQuery> MediaQuerySet::internalParse(const String& queryString) 131 131 { 132 CSSParser parser( CSSStrictMode);132 CSSParser parser(HTMLStandardMode); 133 133 return internalParse(parser, queryString); 134 134 } … … 136 136 bool MediaQuerySet::parse(const String& mediaString) 137 137 { 138 CSSParser parser( CSSStrictMode);138 CSSParser parser(HTMLStandardMode); 139 139 140 140 Vector<MediaQuery> result; -
trunk/Source/WebCore/css/SelectorChecker.cpp
r205050 r205660 453 453 return MatchResult::updateWithMatchType(result, matchType); 454 454 } 455 } 455 456 case CSSSelector::ShadowPseudo: 457 case CSSSelector::ShadowDeep: 458 case CSSSelector::ShadowSlot: 459 // FIXME-NEWPARSER: Have to implement these. 460 ASSERT_NOT_REACHED(); 461 return MatchResult::fails(Match::SelectorFailsCompletely); 462 } 463 456 464 457 465 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/css/SelectorFilter.cpp
r199844 r205660 139 139 skipOverSubselectors = true; 140 140 break; 141 case CSSSelector::ShadowSlot: 142 // Disable fastRejectSelector. 143 *identifierHashes = 0; 144 return; 141 145 case CSSSelector::Descendant: 142 146 case CSSSelector::Child: 147 case CSSSelector::ShadowPseudo: 148 case CSSSelector::ShadowDeep: 143 149 skipOverSubselectors = false; 144 150 collectDescendantSelectorIdentifierHashes(selector, hash); -
trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
r202358 r205660 28 28 focus-within 29 29 horizontal 30 host 30 host, PseudoClassHost, PseudoElementUnknown 31 31 hover 32 32 in-range -
trunk/Source/WebCore/css/SelectorPseudoTypeMap.h
r195452 r205660 39 39 40 40 PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const CSSParserString& pseudoTypeString); 41 PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const StringView& pseudoTypeString); 41 42 CSSSelector::PseudoElementType parsePseudoElementString(const StringImpl& pseudoTypeString); 42 43 -
trunk/Source/WebCore/css/SourceSizeList.cpp
r201799 r205660 75 75 return 0; 76 76 auto& style = renderer->style(); 77 for (auto& sourceSize : CSSParser( CSSStrictMode).parseSizesAttribute(sizesAttribute)) {77 for (auto& sourceSize : CSSParser(HTMLStandardMode).parseSizesAttribute(sizesAttribute)) { 78 78 if (match(sourceSize.expression, style, document)) 79 79 return computeLength(sourceSize.length.get(), style, *renderer); -
trunk/Source/WebCore/css/StyleProperties.cpp
r204052 r205660 77 77 78 78 MutableStyleProperties::MutableStyleProperties(const CSSProperty* properties, unsigned length) 79 : StyleProperties( CSSStrictMode)79 : StyleProperties(HTMLStandardMode) 80 80 { 81 81 m_propertyVector.reserveInitialCapacity(length); -
trunk/Source/WebCore/css/StyleProperties.h
r205093 r205660 135 135 int findCustomPropertyIndex(const String& propertyName) const; 136 136 137 unsigned m_cssParserMode : 2;137 unsigned m_cssParserMode : 3; 138 138 mutable unsigned m_isMutable : 1; 139 unsigned m_arraySize : 2 9;139 unsigned m_arraySize : 28; 140 140 141 141 private: … … 187 187 class MutableStyleProperties final : public StyleProperties { 188 188 public: 189 WEBCORE_EXPORT static Ref<MutableStyleProperties> create(CSSParserMode = CSSQuirksMode);189 WEBCORE_EXPORT static Ref<MutableStyleProperties> create(CSSParserMode = HTMLQuirksMode); 190 190 static Ref<MutableStyleProperties> create(const CSSProperty* properties, unsigned count); 191 191 -
trunk/Source/WebCore/css/StyleRuleImport.cpp
r201318 r205660 67 67 m_styleSheet->clearOwnerRule(); 68 68 69 CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserContext() : CSSStrictMode;69 CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserContext() : HTMLStandardMode; 70 70 context.charset = charset; 71 71 if (!baseURL.isNull()) -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r204591 r205660 63 63 : m_ownerRule(ownerRule) 64 64 , m_originalURL(originalURL) 65 , m_defaultNamespace(starAtom) 65 66 , m_loadCompleted(false) 66 67 , m_isUserStyleSheet(ownerRule && ownerRule->parentStyleSheet() && ownerRule->parentStyleSheet()->isUserStyleSheet()) … … 83 84 , m_childRules(o.m_childRules.size()) 84 85 , m_namespaces(o.m_namespaces) 86 , m_defaultNamespace(o.m_defaultNamespace) 85 87 , m_loadCompleted(true) 86 88 , m_isUserStyleSheet(o.m_isUserStyleSheet) … … 270 272 void StyleSheetContents::parserAddNamespace(const AtomicString& prefix, const AtomicString& uri) 271 273 { 272 if (uri.isNull() || prefix.isNull()) 273 return; 274 ASSERT(!uri.isNull()); 275 if (prefix.isNull()) { 276 m_defaultNamespace = uri; 277 return; 278 } 274 279 PrefixNamespaceURIMap::AddResult result = m_namespaces.add(prefix, uri); 275 280 if (result.isNewEntry) … … 278 283 } 279 284 280 const AtomicString& StyleSheetContents:: determineNamespace(const AtomicString& prefix)285 const AtomicString& StyleSheetContents::namespaceURIFromPrefix(const AtomicString& prefix) 281 286 { 282 287 PrefixNamespaceURIMap::const_iterator it = m_namespaces.find(prefix); -
trunk/Source/WebCore/css/StyleSheetContents.h
r205093 r205660 45 45 class StyleSheetContents final : public RefCounted<StyleSheetContents> { 46 46 public: 47 static Ref<StyleSheetContents> create(const CSSParserContext& context = CSSParserContext( CSSStrictMode))47 static Ref<StyleSheetContents> create(const CSSParserContext& context = CSSParserContext(HTMLStandardMode)) 48 48 { 49 49 return adoptRef(*new StyleSheetContents(0, String(), context)); … … 61 61 62 62 const CSSParserContext& parserContext() const { return m_parserContext; } 63 64 const AtomicString& determineNamespace(const AtomicString& prefix); 63 64 const AtomicString& defaultNamespace() { return m_defaultNamespace; } 65 const AtomicString& namespaceURIFromPrefix(const AtomicString& prefix); 65 66 66 67 void parseAuthorStyleSheet(const CachedCSSStyleSheet*, const SecurityOrigin*); … … 161 162 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap; 162 163 PrefixNamespaceURIMap m_namespaces; 164 AtomicString m_defaultNamespace; 163 165 164 166 bool m_loadCompleted : 1; -
trunk/Source/WebCore/css/WebKitCSSMatrix.cpp
r201290 r205660 58 58 59 59 auto styleDeclaration = MutableStyleProperties::create(); 60 if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error) {60 if (CSSParser::parseValue(styleDeclaration, CSSPropertyTransform, string, true, HTMLStandardMode, nullptr) != CSSParser::ParseResult::Error) { 61 61 // Convert to TransformOperations. This can fail if a property 62 62 // requires style (i.e., param uses 'ems' or 'exs') -
trunk/Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py
r195582 r205660 63 63 %{ 64 64 /* 65 * Copyright (C) 2014 Apple Inc. All rights reserved.65 * Copyright (C) 2014-2016 Apple Inc. All rights reserved. 66 66 * 67 67 * Redistribution and use in source and binary forms, with or without … … 199 199 } 200 200 201 PseudoClassOrCompatibilityPseudoElement parsePseudoClassAndCompatibilityElementString(const StringView& pseudoTypeString) 202 { 203 const SelectorPseudoClassOrCompatibilityPseudoElementEntry* entry; 204 if (pseudoTypeString.is8Bit()) 205 entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters8(), pseudoTypeString.length()); 206 else 207 entry = parsePseudoClassAndCompatibilityElementString(pseudoTypeString.characters16(), pseudoTypeString.length()); 208 209 if (entry) 210 return entry->pseudoTypes; 211 return { CSSSelector::PseudoClassUnknown, CSSSelector::PseudoElementUnknown }; 212 } 213 201 214 } // namespace WebCore 202 215 -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r205292 r205660 233 233 const CSSParserContext& strictCSSParserContext() 234 234 { 235 static NeverDestroyed<CSSParserContext> strictContext( CSSStrictMode);235 static NeverDestroyed<CSSParserContext> strictContext(HTMLStandardMode); 236 236 return strictContext; 237 237 } … … 255 255 : baseURL(baseURL.isNull() ? document.baseURL() : baseURL) 256 256 , charset(charset) 257 , mode(document.inQuirksMode() ? CSSQuirksMode : CSSStrictMode)257 , mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode) 258 258 , isHTMLDocument(document.isHTMLDocument()) 259 259 #if ENABLE(CSS_GRID_LAYOUT) … … 1393 1393 return true; 1394 1394 1395 CSSParser parser( CSSStrictMode);1395 CSSParser parser(HTMLStandardMode); 1396 1396 1397 1397 // In case the fast-path parser didn't understand the color, try the full parser. … … 1720 1720 { 1721 1721 // Qirks mode and svg presentation attributes accept unit less values. 1722 return (unitFlags & (FLength | FAngle | FTime)) && (!value.fValue || cssParserMode == CSSQuirksMode || cssParserMode == SVGAttributeMode);1722 return (unitFlags & (FLength | FAngle | FTime)) && (!value.fValue || cssParserMode == HTMLQuirksMode || cssParserMode == SVGAttributeMode); 1723 1723 } 1724 1724 … … 2357 2357 validPrimitive = true; 2358 2358 else 2359 validPrimitive = (!id && validateUnit(valueWithCalculation, FInteger, CSSQuirksMode));2359 validPrimitive = (!id && validateUnit(valueWithCalculation, FInteger, HTMLQuirksMode)); 2360 2360 break; 2361 2361 … … 2365 2365 validPrimitive = true; 2366 2366 else 2367 validPrimitive = (!id && validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode));2367 validPrimitive = (!id && validateUnit(valueWithCalculation, FPositiveInteger, HTMLQuirksMode)); 2368 2368 break; 2369 2369 … … 2416 2416 validPrimitive = true; 2417 2417 else 2418 validPrimitive = (!id && validateUnit(valueWithCalculation, FNumber | FPercent | FNonNeg, CSSStrictMode));2418 validPrimitive = (!id && validateUnit(valueWithCalculation, FNumber | FPercent | FNonNeg, HTMLStandardMode)); 2419 2419 break; 2420 2420 … … 2568 2568 break; 2569 2569 case CSSPropertyWebkitBoxFlexGroup: 2570 validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode);2570 validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode); 2571 2571 break; 2572 2572 case CSSPropertyWebkitBoxOrdinalGroup: 2573 validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode) && valueWithCalculation.value().fValue;2573 validPrimitive = validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode) && valueWithCalculation.value().fValue; 2574 2574 break; 2575 2575 case CSSPropertyFilter: … … 2617 2617 break; 2618 2618 case CSSPropertyOrder: 2619 if (validateUnit(valueWithCalculation, FInteger, CSSStrictMode)) {2619 if (validateUnit(valueWithCalculation, FInteger, HTMLStandardMode)) { 2620 2620 // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set. 2621 2621 double result = std::max<double>(std::numeric_limits<int>::min() + 2, parsedDouble(valueWithCalculation)); … … 2899 2899 // When specifying number of lines, don't allow 0 as a valid value 2900 2900 // When specifying either type of unit, require non-negative integers 2901 validPrimitive = (!id && (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_PERCENTAGE || valueWithCalculation.value().fValue) && validateUnit(valueWithCalculation, FInteger | FPercent | FNonNeg, CSSQuirksMode));2901 validPrimitive = (!id && (valueWithCalculation.value().unit == CSSPrimitiveValue::CSS_PERCENTAGE || valueWithCalculation.value().fValue) && validateUnit(valueWithCalculation, FInteger | FPercent | FNonNeg, HTMLQuirksMode)); 2902 2902 break; 2903 2903 #if ENABLE(IOS_TEXT_AUTOSIZING) … … 2910 2910 else { 2911 2911 // FIXME: Handle multilength case where we allow relative units. 2912 validPrimitive = (!id && validateUnit(valueWithCalculation, FPercent | FNonNeg, CSSStrictMode));2912 validPrimitive = (!id && validateUnit(valueWithCalculation, FPercent | FNonNeg, HTMLStandardMode)); 2913 2913 } 2914 2914 break; … … 2926 2926 case CSSPropertyWebkitHyphenateLimitBefore: 2927 2927 case CSSPropertyWebkitHyphenateLimitAfter: 2928 if (id == CSSValueAuto || validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode))2928 if (id == CSSValueAuto || validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode)) 2929 2929 validPrimitive = true; 2930 2930 break; 2931 2931 2932 2932 case CSSPropertyWebkitHyphenateLimitLines: 2933 if (id == CSSValueNoLimit || validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSStrictMode))2933 if (id == CSSValueNoLimit || validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLStandardMode)) 2934 2934 validPrimitive = true; 2935 2935 break; … … 3875 3875 CSSValueID id = valueWithCalculation.value().id; 3876 3876 // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property. 3877 if (id != CSSValueAuto && !(validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode) && parsedDouble(valueWithCalculation)))3877 if (id != CSSValueAuto && !(validateUnit(valueWithCalculation, FLength | FNonNeg, HTMLStandardMode) && parsedDouble(valueWithCalculation))) 3878 3878 return nullptr; 3879 3879 … … 3888 3888 CSSValueID id = valueWithCalculation.value().id; 3889 3889 3890 if (id != CSSValueAuto && !validateUnit(valueWithCalculation, FPositiveInteger, CSSQuirksMode))3890 if (id != CSSValueAuto && !validateUnit(valueWithCalculation, FPositiveInteger, HTMLQuirksMode)) 3891 3891 return nullptr; 3892 3892 … … 7238 7238 } 7239 7239 ValueWithCalculation valueWithCalculation(value); 7240 if (validateUnit(valueWithCalculation, FInteger | FNonNeg, CSSQuirksMode)) {7240 if (validateUnit(valueWithCalculation, FInteger | FNonNeg, HTMLQuirksMode)) { 7241 7241 int weight = static_cast<int>(parsedDouble(valueWithCalculation)); 7242 7242 if (!(weight % 100) && weight >= 100 && weight <= 900) { … … 7813 7813 Units unitType = FUnknown; 7814 7814 // Get the first value and its type 7815 if (validateUnit(firstArgumentWithCalculation, FInteger, CSSStrictMode))7815 if (validateUnit(firstArgumentWithCalculation, FInteger, HTMLStandardMode)) 7816 7816 unitType = FInteger; 7817 else if (validateUnit(firstArgumentWithCalculation, FPercent, CSSStrictMode))7817 else if (validateUnit(firstArgumentWithCalculation, FPercent, HTMLStandardMode)) 7818 7818 unitType = FPercent; 7819 7819 else … … 7826 7826 return false; 7827 7827 ValueWithCalculation argumentWithCalculation(*args->next()); 7828 if (!validateUnit(argumentWithCalculation, unitType, CSSStrictMode))7828 if (!validateUnit(argumentWithCalculation, unitType, HTMLStandardMode)) 7829 7829 return false; 7830 7830 colorArray[i] = colorIntFromValue(argumentWithCalculation); … … 7835 7835 return false; 7836 7836 ValueWithCalculation argumentWithCalculation(*args->next()); 7837 if (!validateUnit(argumentWithCalculation, FNumber, CSSStrictMode))7837 if (!validateUnit(argumentWithCalculation, FNumber, HTMLStandardMode)) 7838 7838 return false; 7839 7839 double doubleValue = parsedDouble(argumentWithCalculation); … … 7855 7855 ValueWithCalculation firstArgumentWithCalculation(*args->current()); 7856 7856 // Get the first value 7857 if (!validateUnit(firstArgumentWithCalculation, FNumber, CSSStrictMode))7857 if (!validateUnit(firstArgumentWithCalculation, FNumber, HTMLStandardMode)) 7858 7858 return false; 7859 7859 // normalize the Hue value and change it to be between 0 and 1.0 … … 7864 7864 return false; 7865 7865 ValueWithCalculation argumentWithCalculation(*args->next()); 7866 if (!validateUnit(argumentWithCalculation, FPercent, CSSStrictMode))7866 if (!validateUnit(argumentWithCalculation, FPercent, HTMLStandardMode)) 7867 7867 return false; 7868 7868 colorArray[i] = std::max<double>(0, std::min<double>(100, parsedDouble(argumentWithCalculation))) / 100.0; // needs to be value between 0 and 1.0 … … 7873 7873 return false; 7874 7874 ValueWithCalculation argumentWithCalculation(*args->next()); 7875 if (!validateUnit(argumentWithCalculation, FNumber, CSSStrictMode))7875 if (!validateUnit(argumentWithCalculation, FNumber, HTMLStandardMode)) 7876 7876 return false; 7877 7877 colorArray[3] = std::max<double>(0, std::min<double>(1, parsedDouble(argumentWithCalculation))); … … 8080 8080 // The value is good. Commit it. 8081 8081 context.commitValue(); 8082 } else if (validateUnit(valueWithCalculation, FLength, CSSStrictMode)) {8082 } else if (validateUnit(valueWithCalculation, FLength, HTMLStandardMode)) { 8083 8083 // We required a length and didn't get one. Invalid. 8084 8084 if (!context.allowLength()) … … 8086 8086 8087 8087 // Blur radius must be non-negative. 8088 if (context.allowBlur && !validateUnit(valueWithCalculation, FLength | FNonNeg, CSSStrictMode))8088 if (context.allowBlur && !validateUnit(valueWithCalculation, FLength | FNonNeg, HTMLStandardMode)) 8089 8089 return nullptr; 8090 8090 … … 8534 8534 ValueWithCalculation valueWithCalculation(*value); 8535 8535 // FIXME calc() http://webkit.org/b/16662 : calc is parsed but values are not created yet. 8536 if (context.allowNumber() && !isCalculation(valueWithCalculation) && validateUnit(valueWithCalculation, FInteger | FNonNeg | FPercent, CSSStrictMode)) {8536 if (context.allowNumber() && !isCalculation(valueWithCalculation) && validateUnit(valueWithCalculation, FInteger | FNonNeg | FPercent, HTMLStandardMode)) { 8537 8537 context.commitNumber(valueWithCalculation); 8538 8538 } else if (context.allowFill() && value->id == CSSValueFill) … … 8648 8648 while ((value = m_valueList->current())) { 8649 8649 ValueWithCalculation valueWithCalculation(*value); 8650 if (context.allowNumber() && (validateUnit(valueWithCalculation, validUnits, CSSStrictMode) || value->id == CSSValueAuto)) {8650 if (context.allowNumber() && (validateUnit(valueWithCalculation, validUnits, HTMLStandardMode) || value->id == CSSValueAuto)) { 8651 8651 context.commitNumber(valueWithCalculation); 8652 8652 } else if (!inShorthand()) { … … 9078 9078 bool expectComma = false; 9079 9079 // Look for angle. 9080 if (validateUnit(argumentWithCalculation, FAngle, CSSStrictMode)) {9080 if (validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode)) { 9081 9081 result->setAngle(createPrimitiveNumericValue(argumentWithCalculation)); 9082 9082 … … 9264 9264 bool expectComma = false; 9265 9265 // Look for angle. 9266 if (validateUnit(firstArgumentWithCalculation, FAngle, CSSStrictMode)) {9266 if (validateUnit(firstArgumentWithCalculation, FAngle, HTMLStandardMode)) { 9267 9267 result->setAngle(createPrimitiveNumericValue(firstArgumentWithCalculation)); 9268 9268 … … 10079 10079 if (info.type() == WebKitCSSTransformValue::Rotate3DTransformOperation && argNumber == 3) { 10080 10080 // 4th param of rotate3d() is an angle rather than a bare number, validate it as such 10081 if (!validateUnit(argumentWithCalculation, FAngle, CSSStrictMode))10081 if (!validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode)) 10082 10082 return nullptr; 10083 10083 } else if (info.type() == WebKitCSSTransformValue::Translate3DTransformOperation && argNumber == 2) { 10084 10084 // 3rd param of translate3d() cannot be a percentage 10085 if (!validateUnit(argumentWithCalculation, FLength, CSSStrictMode))10085 if (!validateUnit(argumentWithCalculation, FLength, HTMLStandardMode)) 10086 10086 return nullptr; 10087 10087 } else if (info.type() == WebKitCSSTransformValue::TranslateZTransformOperation && !argNumber) { 10088 10088 // 1st param of translateZ() cannot be a percentage 10089 if (!validateUnit(argumentWithCalculation, FLength, CSSStrictMode))10089 if (!validateUnit(argumentWithCalculation, FLength, HTMLStandardMode)) 10090 10090 return nullptr; 10091 10091 } else if (info.type() == WebKitCSSTransformValue::PerspectiveTransformOperation && !argNumber) { 10092 10092 // 1st param of perspective() must be a non-negative number (deprecated) or length. 10093 if (!validateUnit(argumentWithCalculation, FNumber | FLength | FNonNeg, CSSStrictMode))10093 if (!validateUnit(argumentWithCalculation, FNumber | FLength | FNonNeg, HTMLStandardMode)) 10094 10094 return nullptr; 10095 } else if (!validateUnit(argumentWithCalculation, unit, CSSStrictMode))10095 } else if (!validateUnit(argumentWithCalculation, unit, HTMLStandardMode)) 10096 10096 return nullptr; 10097 10097 … … 10168 10168 if (args.size()) { 10169 10169 ValueWithCalculation argumentWithCalculation(*args.current()); 10170 if (!validateUnit(argumentWithCalculation, FNumber | FPercent | FNonNeg, CSSStrictMode))10170 if (!validateUnit(argumentWithCalculation, FNumber | FPercent | FNonNeg, HTMLStandardMode)) 10171 10171 return nullptr; 10172 10172 … … 10192 10192 if (args.size()) { 10193 10193 ValueWithCalculation argumentWithCalculation(*args.current()); 10194 if (!validateUnit(argumentWithCalculation, FNumber | FPercent, CSSStrictMode))10194 if (!validateUnit(argumentWithCalculation, FNumber | FPercent, HTMLStandardMode)) 10195 10195 return nullptr; 10196 10196 … … 10206 10206 if (args.size()) { 10207 10207 ValueWithCalculation argumentWithCalculation(*args.current()); 10208 if (!validateUnit(argumentWithCalculation, FAngle, CSSStrictMode))10208 if (!validateUnit(argumentWithCalculation, FAngle, HTMLStandardMode)) 10209 10209 return nullptr; 10210 10210 … … 10220 10220 if (args.size()) { 10221 10221 ValueWithCalculation argumentWithCalculation(*args.current()); 10222 if (!validateUnit(argumentWithCalculation, FLength | FNonNeg, CSSStrictMode))10222 if (!validateUnit(argumentWithCalculation, FLength | FNonNeg, HTMLStandardMode)) 10223 10223 return nullptr; 10224 10224 … … 13126 13126 if (!m_styleSheet) 13127 13127 return QualifiedName(prefix, localName, m_defaultNamespace); 13128 return QualifiedName(prefix, localName, m_styleSheet-> determineNamespace(prefix));13128 return QualifiedName(prefix, localName, m_styleSheet->namespaceURIFromPrefix(prefix)); 13129 13129 } 13130 13130 -
trunk/Source/WebCore/css/parser/CSSParser.h
r204852 r205660 572 572 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleSheet; } 573 573 574 inline bool inStrictMode() const { return m_context.mode == CSSStrictMode || m_context.mode == SVGAttributeMode; }575 inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }574 inline bool inStrictMode() const { return m_context.mode == UASheetMode || m_context.mode == HTMLStandardMode || m_context.mode == SVGAttributeMode; } 575 inline bool inQuirksMode() const { return m_context.mode == HTMLQuirksMode; } 576 576 577 577 URL completeURL(const String& url) const; -
trunk/Source/WebCore/css/parser/CSSParserMode.h
r204852 r205660 38 38 class Document; 39 39 40 // Must not grow beyond 3 bits, due to packing in StyleProperties. 40 41 enum CSSParserMode { 41 CSSQuirksMode, 42 CSSStrictMode, 43 // SVG should always be in strict mode. For SVG attributes, the rules differ to strict sometimes. 44 SVGAttributeMode 42 HTMLStandardMode, 43 HTMLQuirksMode, 44 // HTML attributes are parsed in quirks mode but also allows internal properties and values. 45 HTMLAttributeMode, 46 // SVG attributes are parsed in quirks mode but rules differ slightly. 47 SVGAttributeMode, 48 // @viewport rules are parsed in standards mode but CSSOM modifications (via StylePropertySet) 49 // must call parseViewportProperties so needs a special mode. 50 CSSViewportRuleMode, 51 // User agent stylesheets are parsed in standards mode but also allows internal properties and values. 52 UASheetMode 45 53 }; 46 54 55 inline bool isQuirksModeBehavior(CSSParserMode mode) 56 { 57 return mode == HTMLQuirksMode || mode == HTMLAttributeMode; 58 } 59 60 inline bool isUASheetBehavior(CSSParserMode mode) 61 { 62 return mode == UASheetMode; 63 } 64 65 inline bool isUnitLessLengthParsingEnabledForMode(CSSParserMode mode) 66 { 67 return mode == HTMLAttributeMode || mode == SVGAttributeMode; 68 } 69 70 inline bool isCSSViewportParsingEnabledForMode(CSSParserMode mode) 71 { 72 return mode == CSSViewportRuleMode; 73 } 74 75 // FIXME-NEWPARSER: Next two functions should be removed eventually. 47 76 inline CSSParserMode strictToCSSParserMode(bool inStrictMode) 48 77 { 49 return inStrictMode ? CSSStrictMode : CSSQuirksMode;78 return inStrictMode ? HTMLStandardMode : HTMLQuirksMode; 50 79 } 51 80 52 81 inline bool isStrictParserMode(CSSParserMode cssParserMode) 53 82 { 54 return cssParserMode == CSSStrictMode || cssParserMode == SVGAttributeMode;83 return cssParserMode == UASheetMode || cssParserMode == HTMLStandardMode || cssParserMode == SVGAttributeMode; 55 84 } 56 85 … … 63 92 URL baseURL; 64 93 String charset; 65 CSSParserMode mode { CSSStrictMode };94 CSSParserMode mode { HTMLStandardMode }; 66 95 bool isHTMLDocument { false }; 67 96 #if ENABLE(CSS_GRID_LAYOUT) -
trunk/Source/WebCore/css/parser/CSSParserValues.cpp
r205025 r205660 23 23 24 24 #include "CSSCustomPropertyValue.h" 25 #include "CSSParserIdioms.h" 25 26 #include "CSSPrimitiveValue.h" 26 27 #include "CSSFunctionValue.h" … … 220 221 } 221 222 223 CSSParserSelector* CSSParserSelector::parsePseudoElementSelectorFromStringView(StringView& pseudoTypeString) 224 { 225 convertToASCIILowercaseInPlace(pseudoTypeString); 226 AtomicString name = pseudoTypeString.toAtomicString(); 227 228 CSSSelector::PseudoElementType pseudoType = CSSSelector::parsePseudoElementType(name); 229 if (pseudoType == CSSSelector::PseudoElementUnknown) 230 return nullptr; 231 232 auto selector = std::make_unique<CSSParserSelector>(); 233 selector->m_selector->setMatch(CSSSelector::PseudoElement); 234 selector->m_selector->setPseudoElementType(pseudoType); 235 if (pseudoType == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed) { 236 ASSERT_WITH_MESSAGE(name == "-webkit-input-placeholder", "-webkit-input-placeholder is the only LegacyPrefix pseudo type."); 237 if (name == "-webkit-input-placeholder") 238 name = AtomicString("placeholder", AtomicString::ConstructFromLiteral); 239 } 240 selector->m_selector->setValue(name); 241 return selector.release(); 242 } 243 222 244 #if ENABLE(VIDEO_TRACK) 223 245 CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* parsedSelectorVector) … … 303 325 selector->m_selector->setPseudoElementType(pseudoType.compatibilityPseudoElement); 304 326 AtomicString name = pseudoTypeString; 327 selector->m_selector->setValue(name); 328 return selector.release(); 329 } 330 return nullptr; 331 } 332 333 CSSParserSelector* CSSParserSelector::parsePseudoClassSelectorFromStringView(StringView& pseudoTypeString) 334 { 335 if (pseudoTypeString.length() && pseudoTypeString[pseudoTypeString.length() - 1] == '(') 336 return nullptr; 337 338 PseudoClassOrCompatibilityPseudoElement pseudoType = parsePseudoClassAndCompatibilityElementString(pseudoTypeString); 339 if (pseudoType.pseudoClass != CSSSelector::PseudoClassUnknown) { 340 auto selector = std::make_unique<CSSParserSelector>(); 341 selector->m_selector->setMatch(CSSSelector::PseudoClass); 342 selector->m_selector->setPseudoClassType(pseudoType.pseudoClass); 343 return selector.release(); 344 } 345 if (pseudoType.compatibilityPseudoElement != CSSSelector::PseudoElementUnknown) { 346 auto selector = std::make_unique<CSSParserSelector>(); 347 selector->m_selector->setMatch(CSSSelector::PseudoElement); 348 selector->m_selector->setPseudoElementType(pseudoType.compatibilityPseudoElement); 349 AtomicString name = pseudoTypeString.toAtomicString(); 305 350 selector->m_selector->setValue(name); 306 351 return selector.release(); … … 350 395 m_selector->setLangArgumentList(WTFMove(argumentList)); 351 396 } 352 397 398 void CSSParserSelector::setSelectorList(std::unique_ptr<CSSSelectorList> selectorList) 399 { 400 m_selector->setSelectorList(WTFMove(selectorList)); 401 } 402 353 403 void CSSParserSelector::setPseudoClassValue(const CSSParserString& pseudoClassString) 354 404 { … … 426 476 selectorRelation = CSSSelector::IndirectAdjacent; 427 477 break; 478 case CSSParserSelectorCombinator::ShadowDeep: 479 selectorRelation = CSSSelector::ShadowDeep; 480 break; 481 case CSSParserSelectorCombinator::ShadowPseudo: 482 selectorRelation = CSSSelector::ShadowPseudo; 483 break; 484 case CSSParserSelectorCombinator::ShadowSlot: 485 selectorRelation = CSSSelector::ShadowSlot; 486 break; 428 487 } 429 488 end->setRelation(selectorRelation); … … 448 507 } 449 508 450 } 451 509 std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory() 510 { 511 setRelation(CSSSelector::SubSelector); 512 return WTFMove(m_tagHistory); 513 } 514 515 // FIXME-NEWPARSER: Add support for :host-context 516 bool CSSParserSelector::isHostPseudoSelector() const 517 { 518 return pseudoClassType() == CSSSelector::PseudoClassHost; 519 } 520 521 } 522 -
trunk/Source/WebCore/css/parser/CSSParserValues.h
r204852 r205660 194 194 #endif 195 195 DirectAdjacent, 196 IndirectAdjacent 196 IndirectAdjacent, 197 ShadowPseudo, // Special case of shadow DOM pseudo elements / shadow pseudo element 198 ShadowDeep, // /deep/ combinator 199 ShadowSlot // slotted to <slot> e 197 200 }; 198 201 … … 207 210 static CSSParserSelector* parsePseudoClassAndCompatibilityElementSelector(CSSParserString& pseudoTypeString); 208 211 212 static CSSParserSelector* parsePseudoClassSelectorFromStringView(StringView&); 213 static CSSParserSelector* parsePseudoElementSelectorFromStringView(StringView&); 214 209 215 CSSParserSelector(); 210 216 explicit CSSParserSelector(const QualifiedName&); … … 221 227 void setForPage() { m_selector->setForPage(); } 222 228 229 CSSSelector::Match match() const { return m_selector->match(); } 230 CSSSelector::PseudoElementType pseudoElementType() const { return m_selector->pseudoElementType(); } 231 const CSSSelectorList* selectorList() const { return m_selector->selectorList(); } 232 223 233 void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector); 224 234 void setLangArgumentList(const Vector<CSSParserString>& stringVector); 235 void setSelectorList(std::unique_ptr<CSSSelectorList>); 225 236 226 237 void setPseudoClassValue(const CSSParserString& pseudoClassString); … … 239 250 bool hasShadowDescendant() const; 240 251 bool matchesPseudoElement() const; 252 253 bool isHostPseudoSelector() const; 254 255 // FIXME-NEWPARSER: Missing "shadow" 256 bool needsImplicitShadowCombinatorForMatching() const { return pseudoElementType() == CSSSelector::PseudoElementWebKitCustom || pseudoElementType() == CSSSelector::PseudoElementUserAgentCustom || pseudoElementType() == CSSSelector::PseudoElementWebKitCustomLegacyPrefixed || pseudoElementType() == CSSSelector::PseudoElementCue || pseudoElementType() == CSSSelector::PseudoElementSlotted; } 241 257 242 258 CSSParserSelector* tagHistory() const { return m_tagHistory.get(); } … … 247 263 void appendTagHistory(CSSParserSelectorCombinator, std::unique_ptr<CSSParserSelector>); 248 264 void prependTagSelector(const QualifiedName&, bool tagIsForNamespaceRule = false); 265 std::unique_ptr<CSSParserSelector> releaseTagHistory(); 249 266 250 267 private: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.h
r205103 r205660 56 56 const CSSValue* parseSingleValue(CSSPropertyID, CSSPropertyID = CSSPropertyInvalid); 57 57 58 bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }58 bool inQuirksMode() const { return m_context.mode == HTMLQuirksMode; } 59 59 60 60 bool parseViewportDescriptor(CSSPropertyID propId, bool important); -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r205050 r205660 412 412 case CSSSelector::SubSelector: 413 413 case CSSSelector::ShadowDescendant: 414 case CSSSelector::ShadowPseudo: 415 case CSSSelector::ShadowDeep: 416 case CSSSelector::ShadowSlot: 414 417 ASSERT_NOT_REACHED(); 415 418 } -
trunk/Source/WebCore/dom/StyledElement.cpp
r200626 r205660 332 332 presentationAttributeCacheCleaner().didHitPresentationAttributeCache(); 333 333 } else { 334 style = MutableStyleProperties::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode);334 style = MutableStyleProperties::create(isSVGElement() ? SVGAttributeMode : HTMLQuirksMode); 335 335 for (const Attribute& attribute : attributesIterator()) 336 336 collectStyleForPresentationAttribute(attribute.name(), attribute.value(), static_cast<MutableStyleProperties&>(*style)); -
trunk/Source/WebCore/svg/SVGFontFaceElement.cpp
r204858 r205660 50 50 inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document& document) 51 51 : SVGElement(tagName, document) 52 , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create( CSSStrictMode)))52 , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(HTMLStandardMode))) 53 53 , m_fontElement(nullptr) 54 54 {
Note: See TracChangeset
for help on using the changeset viewer.