Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
| 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 10 * | 10 * |
| (...skipping 11388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11399 m_sourceDataHandler->startEndUnknownRule(); | 11399 m_sourceDataHandler->startEndUnknownRule(); |
| 11400 } | 11400 } |
| 11401 | 11401 |
| 11402 unsigned CSSParser::safeUserStringTokenOffset() | 11402 unsigned CSSParser::safeUserStringTokenOffset() |
| 11403 { | 11403 { |
| 11404 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed TextSuffixLength)) - m_parsedTextPrefixLength; | 11404 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed TextSuffixLength)) - m_parsedTextPrefixLength; |
| 11405 } | 11405 } |
| 11406 | 11406 |
| 11407 StyleRuleBase* CSSParser::createViewportRule() | 11407 StyleRuleBase* CSSParser::createViewportRule() |
| 11408 { | 11408 { |
| 11409 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | |
| 11410 return 0; | |
| 11411 | |
| 11412 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11409 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 11413 | 11410 |
| 11414 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); | 11411 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); |
| 11415 | 11412 |
| 11416 rule->setProperties(createStylePropertySet()); | 11413 rule->setProperties(createStylePropertySet()); |
| 11417 clearProperties(); | 11414 clearProperties(); |
| 11418 | 11415 |
| 11419 StyleRuleViewport* result = rule.get(); | 11416 StyleRuleViewport* result = rule.get(); |
| 11420 m_parsedRules.append(rule.release()); | 11417 m_parsedRules.append(rule.release()); |
| 11421 endRuleBody(); | 11418 endRuleBody(); |
| 11422 | 11419 |
| 11423 return result; | 11420 return result; |
| 11424 } | 11421 } |
| 11425 | 11422 |
| 11426 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) | 11423 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) |
| 11427 { | 11424 { |
| 11428 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 11429 | |
| 11430 CSSParserValue* value = m_valueList->current(); | 11425 CSSParserValue* value = m_valueList->current(); |
| 11431 if (!value) | 11426 if (!value) |
| 11432 return false; | 11427 return false; |
| 11433 | 11428 |
| 11434 CSSValueID id = value->id; | 11429 CSSValueID id = value->id; |
| 11435 bool validPrimitive = false; | 11430 bool validPrimitive = false; |
| 11436 | 11431 |
| 11437 switch (propId) { | 11432 switch (propId) { |
| 11438 case CSSPropertyMinWidth: // auto | <length> | <percentage> | 11433 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> |
| 11439 case CSSPropertyMaxWidth: | 11434 case CSSPropertyMaxWidth: |
| 11440 case CSSPropertyMinHeight: | 11435 case CSSPropertyMinHeight: |
| 11441 case CSSPropertyMaxHeight: | 11436 case CSSPropertyMaxHeight: |
| 11442 if (id == CSSValueAuto) | 11437 if (id == CSSValueAuto || id == CSSValueExtendToZoom) |
|
kenneth.r.christiansen
2013/07/17 16:44:30
We need this to be an internal value. What you can
| |
| 11443 validPrimitive = true; | 11438 validPrimitive = true; |
| 11444 else | 11439 else |
| 11445 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN eg)); | 11440 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonN eg)); |
| 11446 break; | 11441 break; |
| 11447 case CSSPropertyWidth: // shorthand | 11442 case CSSPropertyWidth: // shorthand |
| 11448 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa xWidth, important); | 11443 return parseViewportShorthand(propId, CSSPropertyMinWidth, CSSPropertyMa xWidth, important); |
| 11449 case CSSPropertyHeight: | 11444 case CSSPropertyHeight: |
| 11450 return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyM axHeight, important); | 11445 return parseViewportShorthand(propId, CSSPropertyMinHeight, CSSPropertyM axHeight, important); |
| 11451 case CSSPropertyMinZoom: // auto | <number> | <percentage> | 11446 case CSSPropertyMinZoom: // auto | <number> | <percentage> |
| 11452 case CSSPropertyMaxZoom: | 11447 case CSSPropertyMaxZoom: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 11478 addProperty(propId, parsedValue.release(), important); | 11473 addProperty(propId, parsedValue.release(), important); |
| 11479 return true; | 11474 return true; |
| 11480 } | 11475 } |
| 11481 } | 11476 } |
| 11482 | 11477 |
| 11483 return false; | 11478 return false; |
| 11484 } | 11479 } |
| 11485 | 11480 |
| 11486 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first , CSSPropertyID second, bool important) | 11481 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first , CSSPropertyID second, bool important) |
| 11487 { | 11482 { |
| 11488 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | |
| 11489 unsigned numValues = m_valueList->size(); | 11483 unsigned numValues = m_valueList->size(); |
| 11490 | 11484 |
| 11491 if (numValues > 2) | 11485 if (numValues > 2) |
| 11492 return false; | 11486 return false; |
| 11493 | 11487 |
| 11494 ShorthandScope scope(this, propId); | 11488 ShorthandScope scope(this, propId); |
| 11495 | 11489 |
| 11496 if (!parseViewportProperty(first, important)) | 11490 if (!parseViewportProperty(first, important)) |
| 11497 return false; | 11491 return false; |
| 11498 | 11492 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11743 { | 11737 { |
| 11744 // The tokenizer checks for the construct of an+b. | 11738 // The tokenizer checks for the construct of an+b. |
| 11745 // However, since the {ident} rule precedes the {nth} rule, some of those | 11739 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11746 // tokens are identified as string literal. Furthermore we need to accept | 11740 // tokens are identified as string literal. Furthermore we need to accept |
| 11747 // "odd" and "even" which does not match to an+b. | 11741 // "odd" and "even" which does not match to an+b. |
| 11748 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11742 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11749 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11743 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11750 } | 11744 } |
| 11751 | 11745 |
| 11752 } | 11746 } |
| OLD | NEW |