Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (212251 => 212252)
--- trunk/Source/WebCore/CMakeLists.txt 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-02-13 23:06:26 UTC (rev 212252)
@@ -1323,7 +1323,7 @@
css/MediaList.cpp
css/MediaQuery.cpp
css/MediaQueryEvaluator.cpp
- css/MediaQueryExp.cpp
+ css/MediaQueryExpression.cpp
css/MediaQueryList.cpp
css/MediaQueryMatcher.cpp
css/PageRuleCollector.cpp
Modified: trunk/Source/WebCore/ChangeLog (212251 => 212252)
--- trunk/Source/WebCore/ChangeLog 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/ChangeLog 2017-02-13 23:06:26 UTC (rev 212252)
@@ -1,3 +1,23 @@
+2017-02-13 Sam Weinig <[email protected]>
+
+ Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
+ https://bugs.webkit.org/show_bug.cgi?id=168249
+
+ Reviewed by Dean Jackson.
+
+ Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSAllInOne.cpp:
+ * css/MediaQuery.h:
+ * css/MediaQueryEvaluator.h:
+ * css/MediaQueryExp.cpp: Removed.
+ * css/MediaQueryExp.h: Removed.
+ * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
+ * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
+ * css/parser/MediaQueryParser.h:
+
2017-02-13 Aakash Jain <[email protected]>
WAKResponder should be exported from WebCore
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (212251 => 212252)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-02-13 23:06:26 UTC (rev 212252)
@@ -1947,8 +1947,6 @@
4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959240A39DACC00220FE5 /* MediaQuery.h */; settings = {ATTRIBUTES = (Private, ); }; };
4E19592B0A39DACC00220FE5 /* MediaQueryEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959250A39DACC00220FE5 /* MediaQueryEvaluator.cpp */; };
4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */; };
- 4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; settings = {ATTRIBUTES = (Private, ); }; };
4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DD11B532EC0021FD86 /* EditingBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
4F6FDD641341DEDD001F8EE3 /* InspectorPageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */; };
@@ -2951,6 +2949,8 @@
7C93F34E1AA6BF0700A98BAB /* ContentExtensionCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C93F34C1AA6BF0700A98BAB /* ContentExtensionCompiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */; };
7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */; };
+ 7CB5CA3F1E525C7100FAEF13 /* MediaQueryExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CB5CA3D1E525C6C00FAEF13 /* MediaQueryExpression.cpp */; };
+ 7CB5CA401E525C7300FAEF13 /* MediaQueryExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CB5CA3E1E525C6C00FAEF13 /* MediaQueryExpression.h */; settings = {ATTRIBUTES = (Private, ); }; };
7CC01D0A1E4A7B0400E529CC /* JSDOMBuiltinConstructorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF2E1E4A5832008DEB80 /* JSDOMBuiltinConstructorBase.cpp */; };
7CC01D0B1E4A7B0400E529CC /* JSDOMConstructorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF2F1E4A58AD008DEB80 /* JSDOMConstructorBase.cpp */; };
7CC01D0C1E4A7B0400E529CC /* JSDOMConstructorWithDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF301E4A58F1008DEB80 /* JSDOMConstructorWithDocument.cpp */; };
@@ -9268,8 +9268,6 @@
4E1959240A39DACC00220FE5 /* MediaQuery.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQuery.h; sourceTree = "<group>"; };
4E1959250A39DACC00220FE5 /* MediaQueryEvaluator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryEvaluator.cpp; sourceTree = "<group>"; };
4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryEvaluator.h; sourceTree = "<group>"; };
- 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExp.cpp; sourceTree = "<group>"; };
- 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
4F1534DD11B532EC0021FD86 /* EditingBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehavior.h; sourceTree = "<group>"; };
4F1534DF11B533020021FD86 /* EditingBehaviorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBehaviorTypes.h; sourceTree = "<group>"; };
4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorPageAgent.cpp; sourceTree = "<group>"; };
@@ -10598,6 +10596,8 @@
7C9DBFEA1A9C489F000D6B25 /* HTMLAttachmentElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLAttachmentElement.idl; sourceTree = "<group>"; };
7C9DBFEB1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAttachmentElement.cpp; sourceTree = "<group>"; };
7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAttachmentElement.h; sourceTree = "<group>"; };
+ 7CB5CA3D1E525C6C00FAEF13 /* MediaQueryExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExpression.cpp; sourceTree = "<group>"; };
+ 7CB5CA3E1E525C6C00FAEF13 /* MediaQueryExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryExpression.h; sourceTree = "<group>"; };
7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = "<group>"; };
7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = "<group>"; };
7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
@@ -23960,8 +23960,8 @@
4E1959240A39DACC00220FE5 /* MediaQuery.h */,
4E1959250A39DACC00220FE5 /* MediaQueryEvaluator.cpp */,
4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */,
- 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */,
- 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */,
+ 7CB5CA3D1E525C6C00FAEF13 /* MediaQueryExpression.cpp */,
+ 7CB5CA3E1E525C6C00FAEF13 /* MediaQueryExpression.h */,
D3A94A31122DABAC00A37BBC /* MediaQueryList.cpp */,
D3A94A32122DABAC00A37BBC /* MediaQueryList.h */,
D3A94A33122DABAC00A37BBC /* MediaQueryList.idl */,
@@ -26143,6 +26143,7 @@
CD3E251C18046B0600E27F56 /* GridArea.h in Headers */,
CDEF4FD717E85C8F00AEE24B /* GridLength.h in Headers */,
A12705C31656BD6500C2E27C /* GridPosition.h in Headers */,
+ 7CB5CA401E525C7300FAEF13 /* MediaQueryExpression.h in Headers */,
CDF7483F18FEBCEC0006ECC0 /* GridPositionsResolver.h in Headers */,
A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */,
26EA89A71B4F2B75008C5FD2 /* HashableActionList.h in Headers */,
@@ -27293,7 +27294,6 @@
4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */,
9493B6BF1D74B4120088E780 /* MediaQueryBlockWatcher.h in Headers */,
4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */,
- 4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */,
D3A94A39122DABAC00A37BBC /* MediaQueryList.h in Headers */,
D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
@@ -30667,6 +30667,7 @@
1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */,
E1284BB210449FFA00EAEB52 /* JSPageTransitionEvent.cpp in Sources */,
FDA15EB112B03EE1003A583A /* JSPannerNode.cpp in Sources */,
+ 7CB5CA3F1E525C7100FAEF13 /* MediaQueryExpression.cpp in Sources */,
E51A81DF17298D7700BFCA61 /* JSPerformance.cpp in Sources */,
CB38FD511CCF938900592A3F /* JSPerformanceEntry.cpp in Sources */,
CB38FD571CD21E2A00592A3F /* JSPerformanceEntryCustom.cpp in Sources */,
@@ -31149,7 +31150,6 @@
4E1959290A39DACC00220FE5 /* MediaQuery.cpp in Sources */,
9493B6BE1D74B4120088E780 /* MediaQueryBlockWatcher.cpp in Sources */,
4E19592B0A39DACC00220FE5 /* MediaQueryEvaluator.cpp in Sources */,
- 4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */,
D3A94A38122DABAC00A37BBC /* MediaQueryList.cpp in Sources */,
D3AA10F3123A98AA0092152B /* MediaQueryMatcher.cpp in Sources */,
9493B6C01D74B4120088E780 /* MediaQueryParser.cpp in Sources */,
Modified: trunk/Source/WebCore/css/CSSAllInOne.cpp (212251 => 212252)
--- trunk/Source/WebCore/css/CSSAllInOne.cpp 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/CSSAllInOne.cpp 2017-02-13 23:06:26 UTC (rev 212252)
@@ -99,7 +99,7 @@
#include "MediaList.cpp"
#include "MediaQuery.cpp"
#include "MediaQueryEvaluator.cpp"
-#include "MediaQueryExp.cpp"
+#include "MediaQueryExpression.cpp"
#include "MediaQueryList.cpp"
#include "MediaQueryMatcher.cpp"
#include "PageRuleCollector.cpp"
Modified: trunk/Source/WebCore/css/MediaQuery.h (212251 => 212252)
--- trunk/Source/WebCore/css/MediaQuery.h 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/MediaQuery.h 2017-02-13 23:06:26 UTC (rev 212252)
@@ -28,7 +28,7 @@
#pragma once
-#include "MediaQueryExp.h"
+#include "MediaQueryExpression.h"
#include <wtf/Vector.h>
namespace WebCore {
Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.h (212251 => 212252)
--- trunk/Source/WebCore/css/MediaQueryEvaluator.h 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.h 2017-02-13 23:06:26 UTC (rev 212252)
@@ -27,7 +27,7 @@
#pragma once
-#include "MediaQueryExp.h"
+#include "MediaQueryExpression.h"
namespace WebCore {
Deleted: trunk/Source/WebCore/css/MediaQueryExp.cpp (212251 => 212252)
--- trunk/Source/WebCore/css/MediaQueryExp.cpp 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/MediaQueryExp.cpp 2017-02-13 23:06:26 UTC (rev 212252)
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2006 Kimmo Kinnunen <[email protected]>.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "MediaQueryExp.h"
-
-#include "CSSAspectRatioValue.h"
-#include "CSSParser.h"
-#include "CSSParserIdioms.h"
-#include "CSSParserToken.h"
-#include "CSSPrimitiveValue.h"
-#include "CSSValueList.h"
-#include "MediaFeatureNames.h"
-#include <wtf/text/StringBuilder.h>
-
-namespace WebCore {
-
-static inline bool featureWithValidIdent(const AtomicString& mediaFeature)
-{
- return mediaFeature == MediaFeatureNames::orientation
-#if ENABLE(VIEW_MODE_CSS_MEDIA)
- || mediaFeature == MediaFeatureNames::viewMode
-#endif
- || mediaFeature == MediaFeatureNames::colorGamut
- || mediaFeature == MediaFeatureNames::anyHover
- || mediaFeature == MediaFeatureNames::anyPointer
- || mediaFeature == MediaFeatureNames::hover
- || mediaFeature == MediaFeatureNames::invertedColors
- || mediaFeature == MediaFeatureNames::pointer
- || mediaFeature == MediaFeatureNames::prefersReducedMotion;
-}
-
-static inline bool featureWithValidDensity(const String& mediaFeature, const CSSParserToken& token)
-{
- if (!CSSPrimitiveValue::isResolution(static_cast<CSSPrimitiveValue::UnitType>(token.unitType())) || token.numericValue() <= 0)
- return false;
-
- return mediaFeature == MediaFeatureNames::resolution
- || mediaFeature == MediaFeatureNames::minResolution
- || mediaFeature == MediaFeatureNames::maxResolution;
-}
-
-static inline bool featureWithValidPositiveLength(const String& mediaFeature, const CSSParserToken& token)
-{
- if (!(CSSPrimitiveValue::isLength(token.unitType()) || (token.type() == NumberToken && !token.numericValue())) || token.numericValue() < 0)
- return false;
-
-
- return mediaFeature == MediaFeatureNames::height
- || mediaFeature == MediaFeatureNames::maxHeight
- || mediaFeature == MediaFeatureNames::minHeight
- || mediaFeature == MediaFeatureNames::width
- || mediaFeature == MediaFeatureNames::maxWidth
- || mediaFeature == MediaFeatureNames::minWidth
- || mediaFeature == MediaFeatureNames::deviceHeight
- || mediaFeature == MediaFeatureNames::maxDeviceHeight
- || mediaFeature == MediaFeatureNames::minDeviceHeight
- || mediaFeature == MediaFeatureNames::deviceWidth
- || mediaFeature == MediaFeatureNames::minDeviceWidth
- || mediaFeature == MediaFeatureNames::maxDeviceWidth;
-}
-
-static inline bool featureWithPositiveInteger(const String& mediaFeature, const CSSParserToken& token)
-{
- if (token.numericValueType() != IntegerValueType || token.numericValue() < 0)
- return false;
-
- return mediaFeature == MediaFeatureNames::color
- || mediaFeature == MediaFeatureNames:: maxColor
- || mediaFeature == MediaFeatureNames:: minColor
- || mediaFeature == MediaFeatureNames::colorIndex
- || mediaFeature == MediaFeatureNames::maxColorIndex
- || mediaFeature == MediaFeatureNames::minColorIndex
- || mediaFeature == MediaFeatureNames::monochrome
- || mediaFeature == MediaFeatureNames::maxMonochrome
- || mediaFeature == MediaFeatureNames::minMonochrome;
-}
-
-static inline bool featureWithPositiveNumber(const String& mediaFeature, const CSSParserToken& token)
-{
- if (token.type() != NumberToken || token.numericValue() < 0)
- return false;
-
- return mediaFeature == MediaFeatureNames::transform3d
- || mediaFeature == MediaFeatureNames::devicePixelRatio
- || mediaFeature == MediaFeatureNames::maxDevicePixelRatio
- || mediaFeature == MediaFeatureNames::minDevicePixelRatio
- || mediaFeature == MediaFeatureNames::transition
- || mediaFeature == MediaFeatureNames::animation
- || mediaFeature == MediaFeatureNames::transform2d;
-}
-
-static inline bool featureWithZeroOrOne(const String& mediaFeature, const CSSParserToken& token)
-{
- if (token.numericValueType() != IntegerValueType || !(token.numericValue() == 1 || !token.numericValue()))
- return false;
-
- return mediaFeature == MediaFeatureNames::grid;
-}
-
-static inline bool isAspectRatioFeature(const AtomicString& mediaFeature)
-{
- return mediaFeature == MediaFeatureNames::aspectRatio
- || mediaFeature == MediaFeatureNames::deviceAspectRatio
- || mediaFeature == MediaFeatureNames::minAspectRatio
- || mediaFeature == MediaFeatureNames::maxAspectRatio
- || mediaFeature == MediaFeatureNames::minDeviceAspectRatio
- || mediaFeature == MediaFeatureNames::maxDeviceAspectRatio;
-}
-
-static inline bool isFeatureValidWithoutValue(const AtomicString& mediaFeature)
-{
- // Media features that are prefixed by min/max cannot be used without a value.
- return mediaFeature == MediaFeatureNames::anyHover
- || mediaFeature == MediaFeatureNames::anyPointer
- || mediaFeature == MediaFeatureNames::monochrome
- || mediaFeature == MediaFeatureNames::color
- || mediaFeature == MediaFeatureNames::colorIndex
- || mediaFeature == MediaFeatureNames::grid
- || mediaFeature == MediaFeatureNames::height
- || mediaFeature == MediaFeatureNames::width
- || mediaFeature == MediaFeatureNames::deviceHeight
- || mediaFeature == MediaFeatureNames::deviceWidth
- || mediaFeature == MediaFeatureNames::orientation
- || mediaFeature == MediaFeatureNames::aspectRatio
- || mediaFeature == MediaFeatureNames::deviceAspectRatio
- || mediaFeature == MediaFeatureNames::hover
- || mediaFeature == MediaFeatureNames::transform2d
- || mediaFeature == MediaFeatureNames::transform3d
- || mediaFeature == MediaFeatureNames::transition
- || mediaFeature == MediaFeatureNames::animation
- || mediaFeature == MediaFeatureNames::invertedColors
-#if ENABLE(VIEW_MODE_CSS_MEDIA)
- || mediaFeature == MediaFeatureNames::viewMode
-#endif
- || mediaFeature == MediaFeatureNames::pointer
- || mediaFeature == MediaFeatureNames::prefersReducedMotion
- || mediaFeature == MediaFeatureNames::devicePixelRatio
- || mediaFeature == MediaFeatureNames::resolution
- || mediaFeature == MediaFeatureNames::videoPlayableInline;
-}
-
-MediaQueryExpression::MediaQueryExpression(const String& feature, const Vector<CSSParserToken, 4>& tokenList)
- : m_mediaFeature(feature.convertToASCIILowercase())
- , m_isValid(false)
-{
- // Create value for media query _expression_ that must have 1 or more values.
- if (!tokenList.size() && isFeatureValidWithoutValue(m_mediaFeature)) {
- // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue
- m_isValid = true;
- } else if (tokenList.size() == 1) {
- CSSParserToken token = tokenList.first();
- if (token.type() == IdentToken) {
- CSSValueID ident = token.id();
- if (!featureWithValidIdent(m_mediaFeature))
- return;
- m_value = CSSPrimitiveValue::createIdentifier(ident);
- m_isValid = true;
- } else if (token.type() == NumberToken || token.type() == PercentageToken || token.type() == DimensionToken) {
- // Check for numeric token types since it is only safe for these types to call numericValue.
- if (featureWithValidDensity(m_mediaFeature, token)
- || featureWithValidPositiveLength(m_mediaFeature, token)) {
- // Media features that must have non-negative <density>, ie. dppx, dpi or dpcm,
- // or Media features that must have non-negative <length> or number value.
- m_value = CSSPrimitiveValue::create(token.numericValue(), (CSSPrimitiveValue::UnitType) token.unitType());
- m_isValid = true;
- } else if (featureWithPositiveInteger(m_mediaFeature, token)
- || featureWithPositiveNumber(m_mediaFeature, token)
- || featureWithZeroOrOne(m_mediaFeature, token)) {
- // Media features that must have non-negative integer value,
- // or media features that must have non-negative number value,
- // or media features that must have (0|1) value.
- m_value = CSSPrimitiveValue::create(token.numericValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
- m_isValid = true;
- }
- }
- } else if (tokenList.size() == 3 && isAspectRatioFeature(m_mediaFeature)) {
- // FIXME: <ratio> is supposed to allow whitespace around the '/'
- // Applicable to device-aspect-ratio and aspect-ratio.
- const CSSParserToken& numerator = tokenList[0];
- const CSSParserToken& delimiter = tokenList[1];
- const CSSParserToken& denominator = tokenList[2];
- if (delimiter.type() != DelimiterToken || delimiter.delimiter() != '/')
- return;
- if (numerator.type() != NumberToken || numerator.numericValue() <= 0 || numerator.numericValueType() != IntegerValueType)
- return;
- if (denominator.type() != NumberToken || denominator.numericValue() <= 0 || denominator.numericValueType() != IntegerValueType)
- return;
-
- m_value = CSSAspectRatioValue::create(numerator.numericValue(), denominator.numericValue());
- m_isValid = true;
- }
-}
-
-String MediaQueryExpression::serialize() const
-{
- if (!m_serializationCache.isNull())
- return m_serializationCache;
-
- StringBuilder result;
- result.append('(');
- result.append(m_mediaFeature.convertToASCIILowercase());
- if (m_value) {
- result.appendLiteral(": ");
- result.append(m_value->cssText());
- }
- result.append(')');
-
- m_serializationCache = result.toString();
- return m_serializationCache;
-}
-
-} // namespace
Deleted: trunk/Source/WebCore/css/MediaQueryExp.h (212251 => 212252)
--- trunk/Source/WebCore/css/MediaQueryExp.h 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/MediaQueryExp.h 2017-02-13 23:06:26 UTC (rev 212252)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2006 Kimmo Kinnunen <[email protected]>.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "CSSParserToken.h"
-#include "CSSValue.h"
-#include <memory>
-
-namespace WebCore {
-
-// FIXME: Rename the file to match this class's name.
-class MediaQueryExpression {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- explicit MediaQueryExpression(const String& mediaFeature, const Vector<CSSParserToken, 4>& tokenList);
-
- const AtomicString& mediaFeature() const;
- CSSValue* value() const;
-
- bool isValid() const;
-
- String serialize() const;
-
- bool operator==(const MediaQueryExpression&) const;
-
-private:
- AtomicString m_mediaFeature;
- RefPtr<CSSValue> m_value;
- bool m_isValid { false };
- mutable String m_serializationCache;
-};
-
-inline const AtomicString& MediaQueryExpression::mediaFeature() const
-{
- return m_mediaFeature;
-}
-
-inline CSSValue* MediaQueryExpression::value() const
-{
- return m_value.get();
-}
-
-inline bool MediaQueryExpression::operator==(const MediaQueryExpression& other) const
-{
- return other.m_mediaFeature == m_mediaFeature
- && ((!m_value && !other.m_value) || (m_value && other.m_value && *m_value == *other.m_value));
-}
-
-inline bool MediaQueryExpression::isValid() const
-{
- return m_isValid;
-}
-
-} // namespace
Copied: trunk/Source/WebCore/css/MediaQueryExpression.cpp (from rev 212251, trunk/Source/WebCore/css/MediaQueryExp.cpp) (0 => 212252)
--- trunk/Source/WebCore/css/MediaQueryExpression.cpp (rev 0)
+++ trunk/Source/WebCore/css/MediaQueryExpression.cpp 2017-02-13 23:06:26 UTC (rev 212252)
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2006 Kimmo Kinnunen <[email protected]>.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaQueryExpression.h"
+
+#include "CSSAspectRatioValue.h"
+#include "CSSParser.h"
+#include "CSSParserIdioms.h"
+#include "CSSParserToken.h"
+#include "CSSPrimitiveValue.h"
+#include "CSSValueList.h"
+#include "MediaFeatureNames.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+static inline bool featureWithValidIdent(const AtomicString& mediaFeature)
+{
+ return mediaFeature == MediaFeatureNames::orientation
+#if ENABLE(VIEW_MODE_CSS_MEDIA)
+ || mediaFeature == MediaFeatureNames::viewMode
+#endif
+ || mediaFeature == MediaFeatureNames::colorGamut
+ || mediaFeature == MediaFeatureNames::anyHover
+ || mediaFeature == MediaFeatureNames::anyPointer
+ || mediaFeature == MediaFeatureNames::hover
+ || mediaFeature == MediaFeatureNames::invertedColors
+ || mediaFeature == MediaFeatureNames::pointer
+ || mediaFeature == MediaFeatureNames::prefersReducedMotion;
+}
+
+static inline bool featureWithValidDensity(const String& mediaFeature, const CSSParserToken& token)
+{
+ if (!CSSPrimitiveValue::isResolution(static_cast<CSSPrimitiveValue::UnitType>(token.unitType())) || token.numericValue() <= 0)
+ return false;
+
+ return mediaFeature == MediaFeatureNames::resolution
+ || mediaFeature == MediaFeatureNames::minResolution
+ || mediaFeature == MediaFeatureNames::maxResolution;
+}
+
+static inline bool featureWithValidPositiveLength(const String& mediaFeature, const CSSParserToken& token)
+{
+ if (!(CSSPrimitiveValue::isLength(token.unitType()) || (token.type() == NumberToken && !token.numericValue())) || token.numericValue() < 0)
+ return false;
+
+
+ return mediaFeature == MediaFeatureNames::height
+ || mediaFeature == MediaFeatureNames::maxHeight
+ || mediaFeature == MediaFeatureNames::minHeight
+ || mediaFeature == MediaFeatureNames::width
+ || mediaFeature == MediaFeatureNames::maxWidth
+ || mediaFeature == MediaFeatureNames::minWidth
+ || mediaFeature == MediaFeatureNames::deviceHeight
+ || mediaFeature == MediaFeatureNames::maxDeviceHeight
+ || mediaFeature == MediaFeatureNames::minDeviceHeight
+ || mediaFeature == MediaFeatureNames::deviceWidth
+ || mediaFeature == MediaFeatureNames::minDeviceWidth
+ || mediaFeature == MediaFeatureNames::maxDeviceWidth;
+}
+
+static inline bool featureWithPositiveInteger(const String& mediaFeature, const CSSParserToken& token)
+{
+ if (token.numericValueType() != IntegerValueType || token.numericValue() < 0)
+ return false;
+
+ return mediaFeature == MediaFeatureNames::color
+ || mediaFeature == MediaFeatureNames:: maxColor
+ || mediaFeature == MediaFeatureNames:: minColor
+ || mediaFeature == MediaFeatureNames::colorIndex
+ || mediaFeature == MediaFeatureNames::maxColorIndex
+ || mediaFeature == MediaFeatureNames::minColorIndex
+ || mediaFeature == MediaFeatureNames::monochrome
+ || mediaFeature == MediaFeatureNames::maxMonochrome
+ || mediaFeature == MediaFeatureNames::minMonochrome;
+}
+
+static inline bool featureWithPositiveNumber(const String& mediaFeature, const CSSParserToken& token)
+{
+ if (token.type() != NumberToken || token.numericValue() < 0)
+ return false;
+
+ return mediaFeature == MediaFeatureNames::transform3d
+ || mediaFeature == MediaFeatureNames::devicePixelRatio
+ || mediaFeature == MediaFeatureNames::maxDevicePixelRatio
+ || mediaFeature == MediaFeatureNames::minDevicePixelRatio
+ || mediaFeature == MediaFeatureNames::transition
+ || mediaFeature == MediaFeatureNames::animation
+ || mediaFeature == MediaFeatureNames::transform2d;
+}
+
+static inline bool featureWithZeroOrOne(const String& mediaFeature, const CSSParserToken& token)
+{
+ if (token.numericValueType() != IntegerValueType || !(token.numericValue() == 1 || !token.numericValue()))
+ return false;
+
+ return mediaFeature == MediaFeatureNames::grid;
+}
+
+static inline bool isAspectRatioFeature(const AtomicString& mediaFeature)
+{
+ return mediaFeature == MediaFeatureNames::aspectRatio
+ || mediaFeature == MediaFeatureNames::deviceAspectRatio
+ || mediaFeature == MediaFeatureNames::minAspectRatio
+ || mediaFeature == MediaFeatureNames::maxAspectRatio
+ || mediaFeature == MediaFeatureNames::minDeviceAspectRatio
+ || mediaFeature == MediaFeatureNames::maxDeviceAspectRatio;
+}
+
+static inline bool isFeatureValidWithoutValue(const AtomicString& mediaFeature)
+{
+ // Media features that are prefixed by min/max cannot be used without a value.
+ return mediaFeature == MediaFeatureNames::anyHover
+ || mediaFeature == MediaFeatureNames::anyPointer
+ || mediaFeature == MediaFeatureNames::monochrome
+ || mediaFeature == MediaFeatureNames::color
+ || mediaFeature == MediaFeatureNames::colorIndex
+ || mediaFeature == MediaFeatureNames::grid
+ || mediaFeature == MediaFeatureNames::height
+ || mediaFeature == MediaFeatureNames::width
+ || mediaFeature == MediaFeatureNames::deviceHeight
+ || mediaFeature == MediaFeatureNames::deviceWidth
+ || mediaFeature == MediaFeatureNames::orientation
+ || mediaFeature == MediaFeatureNames::aspectRatio
+ || mediaFeature == MediaFeatureNames::deviceAspectRatio
+ || mediaFeature == MediaFeatureNames::hover
+ || mediaFeature == MediaFeatureNames::transform2d
+ || mediaFeature == MediaFeatureNames::transform3d
+ || mediaFeature == MediaFeatureNames::transition
+ || mediaFeature == MediaFeatureNames::animation
+ || mediaFeature == MediaFeatureNames::invertedColors
+#if ENABLE(VIEW_MODE_CSS_MEDIA)
+ || mediaFeature == MediaFeatureNames::viewMode
+#endif
+ || mediaFeature == MediaFeatureNames::pointer
+ || mediaFeature == MediaFeatureNames::prefersReducedMotion
+ || mediaFeature == MediaFeatureNames::devicePixelRatio
+ || mediaFeature == MediaFeatureNames::resolution
+ || mediaFeature == MediaFeatureNames::videoPlayableInline;
+}
+
+MediaQueryExpression::MediaQueryExpression(const String& feature, const Vector<CSSParserToken, 4>& tokenList)
+ : m_mediaFeature(feature.convertToASCIILowercase())
+ , m_isValid(false)
+{
+ // Create value for media query _expression_ that must have 1 or more values.
+ if (!tokenList.size() && isFeatureValidWithoutValue(m_mediaFeature)) {
+ // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue
+ m_isValid = true;
+ } else if (tokenList.size() == 1) {
+ CSSParserToken token = tokenList.first();
+ if (token.type() == IdentToken) {
+ CSSValueID ident = token.id();
+ if (!featureWithValidIdent(m_mediaFeature))
+ return;
+ m_value = CSSPrimitiveValue::createIdentifier(ident);
+ m_isValid = true;
+ } else if (token.type() == NumberToken || token.type() == PercentageToken || token.type() == DimensionToken) {
+ // Check for numeric token types since it is only safe for these types to call numericValue.
+ if (featureWithValidDensity(m_mediaFeature, token)
+ || featureWithValidPositiveLength(m_mediaFeature, token)) {
+ // Media features that must have non-negative <density>, ie. dppx, dpi or dpcm,
+ // or Media features that must have non-negative <length> or number value.
+ m_value = CSSPrimitiveValue::create(token.numericValue(), (CSSPrimitiveValue::UnitType) token.unitType());
+ m_isValid = true;
+ } else if (featureWithPositiveInteger(m_mediaFeature, token)
+ || featureWithPositiveNumber(m_mediaFeature, token)
+ || featureWithZeroOrOne(m_mediaFeature, token)) {
+ // Media features that must have non-negative integer value,
+ // or media features that must have non-negative number value,
+ // or media features that must have (0|1) value.
+ m_value = CSSPrimitiveValue::create(token.numericValue(), CSSPrimitiveValue::UnitType::CSS_NUMBER);
+ m_isValid = true;
+ }
+ }
+ } else if (tokenList.size() == 3 && isAspectRatioFeature(m_mediaFeature)) {
+ // FIXME: <ratio> is supposed to allow whitespace around the '/'
+ // Applicable to device-aspect-ratio and aspect-ratio.
+ const CSSParserToken& numerator = tokenList[0];
+ const CSSParserToken& delimiter = tokenList[1];
+ const CSSParserToken& denominator = tokenList[2];
+ if (delimiter.type() != DelimiterToken || delimiter.delimiter() != '/')
+ return;
+ if (numerator.type() != NumberToken || numerator.numericValue() <= 0 || numerator.numericValueType() != IntegerValueType)
+ return;
+ if (denominator.type() != NumberToken || denominator.numericValue() <= 0 || denominator.numericValueType() != IntegerValueType)
+ return;
+
+ m_value = CSSAspectRatioValue::create(numerator.numericValue(), denominator.numericValue());
+ m_isValid = true;
+ }
+}
+
+String MediaQueryExpression::serialize() const
+{
+ if (!m_serializationCache.isNull())
+ return m_serializationCache;
+
+ StringBuilder result;
+ result.append('(');
+ result.append(m_mediaFeature.convertToASCIILowercase());
+ if (m_value) {
+ result.appendLiteral(": ");
+ result.append(m_value->cssText());
+ }
+ result.append(')');
+
+ m_serializationCache = result.toString();
+ return m_serializationCache;
+}
+
+} // namespace
Copied: trunk/Source/WebCore/css/MediaQueryExpression.h (from rev 212251, trunk/Source/WebCore/css/MediaQueryExp.h) (0 => 212252)
--- trunk/Source/WebCore/css/MediaQueryExpression.h (rev 0)
+++ trunk/Source/WebCore/css/MediaQueryExpression.h 2017-02-13 23:06:26 UTC (rev 212252)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2006 Kimmo Kinnunen <[email protected]>.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSParserToken.h"
+#include "CSSValue.h"
+#include <memory>
+
+namespace WebCore {
+
+class MediaQueryExpression {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ explicit MediaQueryExpression(const String& mediaFeature, const Vector<CSSParserToken, 4>& tokenList);
+
+ const AtomicString& mediaFeature() const;
+ CSSValue* value() const;
+
+ bool isValid() const;
+
+ String serialize() const;
+
+ bool operator==(const MediaQueryExpression&) const;
+
+private:
+ AtomicString m_mediaFeature;
+ RefPtr<CSSValue> m_value;
+ bool m_isValid { false };
+ mutable String m_serializationCache;
+};
+
+inline const AtomicString& MediaQueryExpression::mediaFeature() const
+{
+ return m_mediaFeature;
+}
+
+inline CSSValue* MediaQueryExpression::value() const
+{
+ return m_value.get();
+}
+
+inline bool MediaQueryExpression::operator==(const MediaQueryExpression& other) const
+{
+ return other.m_mediaFeature == m_mediaFeature
+ && ((!m_value && !other.m_value) || (m_value && other.m_value && *m_value == *other.m_value));
+}
+
+inline bool MediaQueryExpression::isValid() const
+{
+ return m_isValid;
+}
+
+} // namespace
Modified: trunk/Source/WebCore/css/parser/MediaQueryParser.h (212251 => 212252)
--- trunk/Source/WebCore/css/parser/MediaQueryParser.h 2017-02-13 22:55:55 UTC (rev 212251)
+++ trunk/Source/WebCore/css/parser/MediaQueryParser.h 2017-02-13 23:06:26 UTC (rev 212252)
@@ -34,7 +34,7 @@
#include "MediaList.h"
#include "MediaQuery.h"
#include "MediaQueryBlockWatcher.h"
-#include "MediaQueryExp.h"
+#include "MediaQueryExpression.h"
#include <wtf/text/WTFString.h>
namespace WebCore {