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