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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 CSSParserFunction* BisonCSSParser::createFloatingFunction(const CSSParserString&
name, PassOwnPtr<CSSParserValueList> args) | 430 CSSParserFunction* BisonCSSParser::createFloatingFunction(const CSSParserString&
name, PassOwnPtr<CSSParserValueList> args) |
431 { | 431 { |
432 CSSParserFunction* function = new CSSParserFunction; | 432 CSSParserFunction* function = new CSSParserFunction; |
433 m_floatingFunctions.append(function); | 433 m_floatingFunctions.append(function); |
434 function->id = cssValueKeywordID(name); | 434 function->id = cssValueKeywordID(name); |
435 function->args = args; | 435 function->args = args; |
436 return function; | 436 return function; |
437 } | 437 } |
438 | 438 |
439 PassOwnPtr<CSSParserFunction> BisonCSSParser::sinkFloatingFunction(CSSParserFunc
tion* function) | |
440 { | |
441 if (function) { | |
442 size_t index = m_floatingFunctions.reverseFind(function); | |
443 ASSERT(index != kNotFound); | |
444 m_floatingFunctions.remove(index); | |
445 } | |
446 return adoptPtr(function); | |
447 } | |
448 | |
449 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value) | 439 CSSParserValue& BisonCSSParser::sinkFloatingValue(CSSParserValue& value) |
450 { | 440 { |
451 if (value.unit == CSSParserValue::Function) { | 441 if (value.unit == CSSParserValue::Function) { |
452 size_t index = m_floatingFunctions.reverseFind(value.function); | 442 size_t index = m_floatingFunctions.reverseFind(value.function); |
453 ASSERT(index != kNotFound); | 443 ASSERT(index != kNotFound); |
454 m_floatingFunctions.remove(index); | 444 m_floatingFunctions.remove(index); |
455 } | 445 } |
456 return value; | 446 return value; |
457 } | 447 } |
458 | 448 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 reportError(location, m_ruleHeaderType == CSSRuleSourceData::STYLE_RULE ? In
validSelectorCSSError : InvalidRuleCSSError); | 686 reportError(location, m_ruleHeaderType == CSSRuleSourceData::STYLE_RULE ? In
validSelectorCSSError : InvalidRuleCSSError); |
697 | 687 |
698 endRuleHeader(); | 688 endRuleHeader(); |
699 } | 689 } |
700 | 690 |
701 void BisonCSSParser::reportError(const CSSParserLocation&, CSSParserError) | 691 void BisonCSSParser::reportError(const CSSParserLocation&, CSSParserError) |
702 { | 692 { |
703 // FIXME: error reporting temporatily disabled. | 693 // FIXME: error reporting temporatily disabled. |
704 } | 694 } |
705 | 695 |
706 bool BisonCSSParser::isLoggingErrors() | |
707 { | |
708 return m_logErrors && !m_ignoreErrors; | |
709 } | |
710 | |
711 void BisonCSSParser::logError(const String& message, const CSSParserLocation& lo
cation) | |
712 { | |
713 unsigned lineNumberInStyleSheet; | |
714 unsigned columnNumber = 0; | |
715 if (InspectorInstrumentation::hasFrontends()) { | |
716 ensureLineEndings(); | |
717 TextPosition tokenPosition = TextPosition::fromOffsetAndLineEndings(loca
tion.offset, *m_lineEndings); | |
718 lineNumberInStyleSheet = tokenPosition.m_line.zeroBasedInt(); | |
719 columnNumber = (lineNumberInStyleSheet ? 0 : m_startPosition.m_column.ze
roBasedInt()) + tokenPosition.m_column.zeroBasedInt(); | |
720 } else { | |
721 lineNumberInStyleSheet = location.lineNumber; | |
722 } | |
723 FrameConsole& console = m_styleSheet->singleOwnerDocument()->frame()->consol
e(); | |
724 console.addMessage(ConsoleMessage::create(CSSMessageSource, WarningMessageLe
vel, message, m_styleSheet->baseURL().string(), lineNumberInStyleSheet + m_start
Position.m_line.zeroBasedInt() + 1, columnNumber + 1)); | |
725 } | |
726 | |
727 StyleRuleKeyframes* BisonCSSParser::createKeyframesRule(const String& name, Pass
OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> > > po
pKeyframes, bool isPrefixed) | 696 StyleRuleKeyframes* BisonCSSParser::createKeyframesRule(const String& name, Pass
OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> > > po
pKeyframes, bool isPrefixed) |
728 { | 697 { |
729 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> >
> keyframes = popKeyframes; | 698 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe> >
> keyframes = popKeyframes; |
730 m_allowImportRules = m_allowNamespaceDeclarations = false; | 699 m_allowImportRules = m_allowNamespaceDeclarations = false; |
731 RefPtrWillBeRawPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); | 700 RefPtrWillBeRawPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(); |
732 for (size_t i = 0; i < keyframes->size(); ++i) | 701 for (size_t i = 0; i < keyframes->size(); ++i) |
733 rule->parserAppendKeyframe(keyframes->at(i)); | 702 rule->parserAppendKeyframe(keyframes->at(i)); |
734 rule->setName(name); | 703 rule->setName(name); |
735 rule->setVendorPrefixed(isPrefixed); | 704 rule->setVendorPrefixed(isPrefixed); |
736 StyleRuleKeyframes* rulePtr = rule.get(); | 705 StyleRuleKeyframes* rulePtr = rule.get(); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 rule->setProperties(createStylePropertySet()); | 1060 rule->setProperties(createStylePropertySet()); |
1092 clearProperties(); | 1061 clearProperties(); |
1093 | 1062 |
1094 StyleRuleViewport* result = rule.get(); | 1063 StyleRuleViewport* result = rule.get(); |
1095 m_parsedRules.append(rule.release()); | 1064 m_parsedRules.append(rule.release()); |
1096 | 1065 |
1097 return result; | 1066 return result; |
1098 } | 1067 } |
1099 | 1068 |
1100 } | 1069 } |
OLD | NEW |