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 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 | 1673 |
1674 if (!m_valueList) | 1674 if (!m_valueList) |
1675 return false; | 1675 return false; |
1676 | 1676 |
1677 CSSParserValue* value = m_valueList->current(); | 1677 CSSParserValue* value = m_valueList->current(); |
1678 | 1678 |
1679 if (!value) | 1679 if (!value) |
1680 return false; | 1680 return false; |
1681 | 1681 |
1682 if (inViewport()) { | 1682 if (inViewport()) { |
1683 if (!RuntimeEnabledFeatures::cssViewportEnabled()) | 1683 // Allow @viewport rules from UA stylesheets even if the feature is disa
bled. |
| 1684 if (!RuntimeEnabledFeatures::cssViewportEnabled() && m_context.mode != U
ASheetMode) |
1684 return false; | 1685 return false; |
1685 | 1686 |
1686 return parseViewportProperty(propId, important); | 1687 return parseViewportProperty(propId, important); |
1687 } | 1688 } |
1688 | 1689 |
1689 // Note: m_parsedCalculation is used to pass the calc value to validUnit and
then cleared at the end of this function. | 1690 // Note: m_parsedCalculation is used to pass the calc value to validUnit and
then cleared at the end of this function. |
1690 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller
s. | 1691 // FIXME: This is to avoid having to pass parsedCalc to all validUnit caller
s. |
1691 ASSERT(!m_parsedCalculation); | 1692 ASSERT(!m_parsedCalculation); |
1692 | 1693 |
1693 CSSValueID id = value->id; | 1694 CSSValueID id = value->id; |
(...skipping 9933 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) { |
11638 endRuleBody(true); | 11640 endRuleBody(true); |
11639 return 0; | 11641 return 0; |
11640 } | 11642 } |
11641 | 11643 |
11642 m_allowImportRules = m_allowNamespaceDeclarations = false; | 11644 m_allowImportRules = m_allowNamespaceDeclarations = false; |
11643 | 11645 |
11644 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); | 11646 RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); |
11645 | 11647 |
11646 rule->setProperties(createStylePropertySet()); | 11648 rule->setProperties(createStylePropertySet()); |
11647 clearProperties(); | 11649 clearProperties(); |
11648 | 11650 |
11649 StyleRuleViewport* result = rule.get(); | 11651 StyleRuleViewport* result = rule.get(); |
11650 m_parsedRules.append(rule.release()); | 11652 m_parsedRules.append(rule.release()); |
11651 endRuleBody(); | 11653 endRuleBody(); |
11652 | 11654 |
11653 return result; | 11655 return result; |
11654 } | 11656 } |
11655 | 11657 |
11656 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) | 11658 bool CSSParser::parseViewportProperty(CSSPropertyID propId, bool important) |
11657 { | 11659 { |
11658 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 11660 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || m_context.mode == UAS
heetMode); |
11659 | 11661 |
11660 CSSParserValue* value = m_valueList->current(); | 11662 CSSParserValue* value = m_valueList->current(); |
11661 if (!value) | 11663 if (!value) |
11662 return false; | 11664 return false; |
11663 | 11665 |
11664 CSSValueID id = value->id; | 11666 CSSValueID id = value->id; |
11665 bool validPrimitive = false; | 11667 bool validPrimitive = false; |
11666 | 11668 |
11667 switch (propId) { | 11669 switch (propId) { |
11668 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> | 11670 case CSSPropertyMinWidth: // auto | extend-to-zoom | <length> | <percentage> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11708 addProperty(propId, parsedValue.release(), important); | 11710 addProperty(propId, parsedValue.release(), important); |
11709 return true; | 11711 return true; |
11710 } | 11712 } |
11711 } | 11713 } |
11712 | 11714 |
11713 return false; | 11715 return false; |
11714 } | 11716 } |
11715 | 11717 |
11716 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) | 11718 bool CSSParser::parseViewportShorthand(CSSPropertyID propId, CSSPropertyID first
, CSSPropertyID second, bool important) |
11717 { | 11719 { |
11718 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled()); | 11720 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || m_context.mode == UAS
heetMode); |
11719 unsigned numValues = m_valueList->size(); | 11721 unsigned numValues = m_valueList->size(); |
11720 | 11722 |
11721 if (numValues > 2) | 11723 if (numValues > 2) |
11722 return false; | 11724 return false; |
11723 | 11725 |
11724 ShorthandScope scope(this, propId); | 11726 ShorthandScope scope(this, propId); |
11725 | 11727 |
11726 if (!parseViewportProperty(first, important)) | 11728 if (!parseViewportProperty(first, important)) |
11727 return false; | 11729 return false; |
11728 | 11730 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11973 { | 11975 { |
11974 // The tokenizer checks for the construct of an+b. | 11976 // The tokenizer checks for the construct of an+b. |
11975 // However, since the {ident} rule precedes the {nth} rule, some of those | 11977 // However, since the {ident} rule precedes the {nth} rule, some of those |
11976 // tokens are identified as string literal. Furthermore we need to accept | 11978 // tokens are identified as string literal. Furthermore we need to accept |
11977 // "odd" and "even" which does not match to an+b. | 11979 // "odd" and "even" which does not match to an+b. |
11978 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11980 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11979 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11981 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11980 } | 11982 } |
11981 | 11983 |
11982 } | 11984 } |
OLD | NEW |