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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1710 if (isKeywordPropertyID(propId)) { | 1710 if (isKeywordPropertyID(propId)) { |
| 1711 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) | 1711 if (!isValidKeywordPropertyAndValue(propId, id, m_context)) |
| 1712 return false; | 1712 return false; |
| 1713 if (m_valueList->next() && !inShorthand()) | 1713 if (m_valueList->next() && !inShorthand()) |
| 1714 return false; | 1714 return false; |
| 1715 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; | 1715 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; |
| 1716 return true; | 1716 return true; |
| 1717 } | 1717 } |
| 1718 | 1718 |
| 1719 if (inViewport()) { | 1719 if (inViewport()) { |
| 1720 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | 1720 // Allow @viewport rules from UA stylesheets even if the feature is disa bled. |
| 1721 if (!RuntimeEnabledFeatures::cssViewportEnabled() && m_context.mode != U ASheetMode) | |
|
kenneth.r.christiansen
2013/09/04 11:39:01
This is a behavior change, but *only* for the UASh
| |
| 1721 return false; | 1722 return false; |
| 1722 | 1723 |
| 1723 return parseViewportProperty(propId, important); | 1724 return parseViewportProperty(propId, important); |
| 1724 } | 1725 } |
| 1725 | 1726 |
| 1726 bool validPrimitive = false; | 1727 bool validPrimitive = false; |
| 1727 RefPtr<CSSValue> parsedValue; | 1728 RefPtr<CSSValue> parsedValue; |
| 1728 | 1729 |
| 1729 switch (propId) { | 1730 switch (propId) { |
| 1730 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ] | 1731 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size > || [ portrait | landscape] ] |
| (...skipping 9896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11627 m_sourceDataHandler->startEndUnknownRule(); | 11628 m_sourceDataHandler->startEndUnknownRule(); |
| 11628 } | 11629 } |
| 11629 | 11630 |
| 11630 unsigned CSSParser::safeUserStringTokenOffset() | 11631 unsigned CSSParser::safeUserStringTokenOffset() |
| 11631 { | 11632 { |
| 11632 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed TextSuffixLength)) - m_parsedTextPrefixLength; | 11633 return min(tokenStartOffset(), static_cast<unsigned>(m_length - 1 - m_parsed TextSuffixLength)) - m_parsedTextPrefixLength; |
| 11633 } | 11634 } |
| 11634 | 11635 |
| 11635 StyleRuleBase* CSSParser::createViewportRule() | 11636 StyleRuleBase* CSSParser::createViewportRule() |
| 11636 { | 11637 { |
| 11637 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | 11638 // Allow @viewport rules from UA stylesheets even if the feature is disabled . |
| 11639 if (!RuntimeEnabledFeatures::cssViewportEnabled() && m_context.mode != UAShe etMode) | |
|
kenneth.r.christiansen
2013/09/04 11:39:01
same
| |
| 11638 return 0; | 11640 return 0; |
| 11639 | 11641 |
| 11640 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11642 m_allowImportRules = m_allowNamespaceDeclarations = false; |
| 11641 | 11643 |
| 11642 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); | 11644 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); |
| 11643 | 11645 |
| 11644 rule->setProperties(createStylePropertySet()); | 11646 rule->setProperties(createStylePropertySet()); |
| 11645 clearProperties(); | 11647 clearProperties(); |
| 11646 | 11648 |
| 11647 StyleRuleViewport* result = rule.get(); | 11649 StyleRuleViewport* result = rule.get(); |
| 11648 m_parsedRules.append(rule.release()); | 11650 m_parsedRules.append(rule.release()); |
| 11649 endRuleBody(); | 11651 endRuleBody(); |
| 11650 | 11652 |
| 11651 return result; | 11653 return result; |
| 11652 } | 11654 } |
| 11653 | 11655 |
| 11654 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) | 11656 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) |
| 11655 { | 11657 { |
| 11656 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 11658 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || m_context.mode == UAS heetMode); |
|
kenneth.r.christiansen
2013/09/04 11:39:01
same
| |
| 11657 | 11659 |
| 11658 CSSParserValue* value = m_valueList->current(); | 11660 CSSParserValue* value = m_valueList->current(); |
| 11659 if (!value) | 11661 if (!value) |
| 11660 return false; | 11662 return false; |
| 11661 | 11663 |
| 11662 CSSValueID id = value->id; | 11664 CSSValueID id = value->id; |
| 11663 bool validPrimitive = false; | 11665 bool validPrimitive = false; |
| 11664 | 11666 |
| 11665 switch (propId) { | 11667 switch (propId) { |
| 11666 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> | 11668 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11706 addProperty(propId, parsedValue.release(), important); | 11708 addProperty(propId, parsedValue.release(), important); |
| 11707 return true; | 11709 return true; |
| 11708 } | 11710 } |
| 11709 } | 11711 } |
| 11710 | 11712 |
| 11711 return false; | 11713 return false; |
| 11712 } | 11714 } |
| 11713 | 11715 |
| 11714 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first , CSSPropertyID second, bool important) | 11716 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first , CSSPropertyID second, bool important) |
| 11715 { | 11717 { |
| 11716 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 11718 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || m_context.mode == UAS heetMode); |
|
kenneth.r.christiansen
2013/09/04 11:39:01
Same
| |
| 11717 unsigned numValues = m_valueList->size(); | 11719 unsigned numValues = m_valueList->size(); |
| 11718 | 11720 |
| 11719 if (numValues > 2) | 11721 if (numValues > 2) |
| 11720 return false; | 11722 return false; |
| 11721 | 11723 |
| 11722 ShorthandScope scope(this, propId); | 11724 ShorthandScope scope(this, propId); |
| 11723 | 11725 |
| 11724 if (!parseViewportProperty(first, important)) | 11726 if (!parseViewportProperty(first, important)) |
| 11725 return false; | 11727 return false; |
| 11726 | 11728 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11971 { | 11973 { |
| 11972 // The tokenizer checks for the construct of an+b. | 11974 // The tokenizer checks for the construct of an+b. |
| 11973 // However, since the {ident} rule precedes the {nth} rule, some of those | 11975 // However, since the {ident} rule precedes the {nth} rule, some of those |
| 11974 // tokens are identified as string literal. Furthermore we need to accept | 11976 // tokens are identified as string literal. Furthermore we need to accept |
| 11975 // "odd" and "even" which does not match to an+b. | 11977 // "odd" and "even" which does not match to an+b. |
| 11976 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11978 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
| 11977 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11979 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
| 11978 } | 11980 } |
| 11979 | 11981 |
| 11980 } | 11982 } |
| OLD | NEW |