Create MediaQueryParserContext to provide additional context for the evaluation of...
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 01:12:39 +0000 (01:12 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 01:12:39 +0000 (01:12 +0000)
commit4dede25c300e36ba80f03de1912336f826f06c43
treedae9ca0adcceb62b0a947f62c3a682f5873e551b
parent83bdbf53459a1226993716fccb80430d3f90449d
Create MediaQueryParserContext to provide additional context for the evaluation of media queries
https://bugs.webkit.org/show_bug.cgi?id=183677

Reviewed by Tim Horton.

We need additional context for parsing media queries to make sure they are parsed correctly and valid.

Source/WebCore:

Not currently testable, will add tests in a later patch.

* WebCore.xcodeproj/project.pbxproj:
* css/MediaList.cpp:
(WebCore::MediaQuerySet::create):
(WebCore::MediaQuerySet::set):
(WebCore::MediaQuerySet::add):
(WebCore::MediaQuerySet::remove):
* css/MediaList.h:
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::mediaAttributeMatches):
* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent):
(WebCore::featureWithValidDensity):
(WebCore::featureWithValidPositiveLength):
(WebCore::featureWithPositiveInteger):
(WebCore::featureWithPositiveNumber):
(WebCore::featureWithZeroOrOne):
(WebCore::isFeatureValidWithoutValue):
(WebCore::MediaQueryExpression::MediaQueryExpression):
* css/MediaQueryExpression.h:
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::matchMedia):
* css/MediaQueryParserContext.cpp: Added.
(WebCore::MediaQueryParserContext::MediaQueryParserContext):
* css/MediaQueryParserContext.h: Added.
(WebCore::MediaQueryParserContext::MediaQueryParserContext):
* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium const):
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::StyleRuleImport):
(WebCore::StyleRuleImport::setCSSStyleSheet):
* css/parser/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeImportRule):
(WebCore::CSSParserImpl::consumeMediaRule):
* css/parser/MediaQueryParser.cpp:
(WebCore::MediaQueryParser::parseMediaQuerySet):
(WebCore::MediaQueryParser::parseMediaCondition):
(WebCore::MediaQueryParser::MediaQueryParser):
(WebCore::MediaQueryData::addExpression):
* css/parser/MediaQueryParser.h:
(WebCore::MediaQueryData::setMediaQueryParserContext):
* css/parser/SizesAttributeParser.cpp:
(WebCore::SizesAttributeParser::parse):
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createCSSStyleSheet):
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::setCSSStyleSheet):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::initializeStyleSheet):
(WebCore::HTMLLinkElement::setCSSStyleSheet):
* html/HTMLLinkElement.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectNextSourceChild):
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::parsedMediaAttribute const):
* html/HTMLSourceElement.h:
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::parseAttribute):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(-[DOMHTMLLinkElement _mediaQueryMatches]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/MediaList.cpp
Source/WebCore/css/MediaList.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryExpression.cpp
Source/WebCore/css/MediaQueryExpression.h
Source/WebCore/css/MediaQueryMatcher.cpp
Source/WebCore/css/MediaQueryParserContext.cpp [new file with mode: 0644]
Source/WebCore/css/MediaQueryParserContext.h [new file with mode: 0644]
Source/WebCore/css/StyleMedia.cpp
Source/WebCore/css/StyleRuleImport.cpp
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/css/parser/CSSParserImpl.cpp
Source/WebCore/css/parser/MediaQueryParser.cpp
Source/WebCore/css/parser/MediaQueryParser.h
Source/WebCore/css/parser/SizesAttributeParser.cpp
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/ProcessingInstruction.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLSourceElement.cpp
Source/WebCore/html/HTMLSourceElement.h
Source/WebCore/html/HTMLStyleElement.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOM.mm