1 /* 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public License 18 * along with this library; see the file COPYING.LIB. If not, write to 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef CSSParserObserver_h 24 #define CSSParserObserver_h 25 26 #include "core/css/CSSPropertySourceData.h" 27 28 namespace blink { 29 30 // FIXME: Although the parser produces these, they're all ignored! 31 enum CSSParserError { 32 NoCSSError, 33 PropertyDeclarationCSSError, 34 InvalidPropertyValueCSSError, 35 InvalidPropertyCSSError, 36 InvalidSelectorCSSError, 37 InvalidSupportsConditionCSSError, 38 InvalidRuleCSSError, 39 InvalidMediaQueryCSSError, 40 InvalidKeyframeSelectorCSSError, 41 InvalidSelectorPseudoCSSError, 42 UnterminatedCommentCSSError, 43 GeneralCSSError 44 }; 45 46 // FIXME: What are these actually used for? There is probably 47 // a better way for the parser to communicate this information 48 // to the Inspector. 49 50 // This only implemented by StyleSheetHandler in InspectorStyleSheet.cpp. 51 class CSSParserObserver { 52 STACK_ALLOCATED(); 53 public: 54 virtual void startRuleHeader(CSSRuleSourceData::Type, unsigned offset) = 0; 55 virtual void endRuleHeader(unsigned offset) = 0; 56 virtual void startSelector(unsigned offset) = 0; 57 virtual void endSelector(unsigned offset) = 0; 58 virtual void startRuleBody(unsigned offset) = 0; 59 virtual void endRuleBody(unsigned offset, bool error) = 0; 60 virtual void startProperty(unsigned offset) = 0; 61 virtual void endProperty(bool isImportant, bool isParsed, unsigned offset, CSSParserError) = 0; 62 virtual void startComment(unsigned offset) = 0; 63 virtual void endComment(unsigned offset) = 0; 64 }; 65 66 } // namespace blink 67 68 #endif // CSSParserObserver_h 69