Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1380083004: Move viewport descriptor handling into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another attempt Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 8f66df3657939236ad18640dadf188dfe2ffe0ae..6c21acf77fd859c9fa4822a344fb712091195e07 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -83,15 +83,7 @@ void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtrWillBeRawPtr
if (m_currentShorthand) {
Vector<StylePropertyShorthand, 4> shorthands;
getMatchingShorthandsForLonghand(propId, &shorthands);
- // Viewport descriptors have width and height as shorthands, but it doesn't
- // make sense for CSSProperties.in to consider them as such. The shorthand
- // index is only used by the inspector and doesn't affect viewport
- // descriptors.
- if (shorthands.isEmpty())
- ASSERT(m_currentShorthand == CSSPropertyWidth || m_currentShorthand == CSSPropertyHeight);
- else
- setFromShorthand = true;
-
+ setFromShorthand = true;
if (shorthands.size() > 1)
shorthandIndex = indexOfShorthandForLonghand(m_currentShorthand, shorthands);
}
@@ -6535,87 +6527,6 @@ bool CSSPropertyParser::parseCalculation(CSSParserValue* value, ValueRange range
return true;
}
-bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId, bool important)
-{
- ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_context.mode()));
-
- CSSParserValue* value = m_valueList->current();
- if (!value)
- return false;
-
- CSSValueID id = value->id;
- bool validPrimitive = false;
-
- switch (propId) {
- case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage>
- case CSSPropertyMaxWidth:
- case CSSPropertyMinHeight:
- case CSSPropertyMaxHeight:
- if (id == CSSValueAuto || id == CSSValueInternalExtendToZoom)
- validPrimitive = true;
- else
- validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
- break;
- case CSSPropertyWidth: // shorthand
- return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMaxWidth, important);
- case CSSPropertyHeight:
- return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyMaxHeight, important);
- case CSSPropertyMinZoom: // auto | <number> | <percentage>
- case CSSPropertyMaxZoom:
- case CSSPropertyZoom:
- if (id == CSSValueAuto)
- validPrimitive = true;
- else
- validPrimitive = validUnit(value, FNumber | FPercent | FNonNeg);
- break;
- case CSSPropertyUserZoom: // zoom | fixed
- if (id == CSSValueZoom || id == CSSValueFixed)
- validPrimitive = true;
- break;
- case CSSPropertyOrientation: // auto | portrait | landscape
- if (id == CSSValueAuto || id == CSSValuePortrait || id == CSSValueLandscape)
- validPrimitive = true;
- default:
- break;
- }
-
- RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
- if (validPrimitive) {
- parsedValue = parseValidPrimitive(id, value);
- m_valueList->next();
- }
-
- if (parsedValue) {
- if (!m_valueList->current() || inShorthand()) {
- addProperty(propId, parsedValue.release(), important);
- return true;
- }
- }
-
- return false;
-}
-
-bool CSSPropertyParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first, CSSPropertyID second, bool important)
-{
- ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || isUASheetBehavior(m_context.mode()));
- unsigned numValues = m_valueList->size();
-
- if (numValues > 2)
- return false;
-
- ShorthandScope scope(this, propId);
-
- if (!parseViewportProperty(first, important))
- return false;
-
- // If just one value is supplied, the second value
- // is implicitly initialized with the first value.
- if (numValues == 1)
- m_valueList->previous();
-
- return parseViewportProperty(second, important);
-}
-
template <typename CharacterType>
static CSSPropertyID unresolvedCSSPropertyID(const CharacterType* propertyName, unsigned length)
{
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698