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