Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
|
tfarina
2014/02/22 00:16:51
2014 and use the shorter license template?
| |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef CSSParser_h | |
| 32 #define CSSParser_h | |
| 33 | |
| 34 // This class serves as the public API for the CSSParser subsystem | |
| 35 // and should have as few methods as possible. | |
| 36 | |
| 37 // Like HTMLDocumentParser is for the HTML Parser subsystem, | |
| 38 // CSSParser's job is to coordinate between the various objects in | |
| 39 // the CSS parsing subsystem, but should itself have very little code. | |
| 40 | |
| 41 // FIXME: Ideally BisonCSSParser would be an OwnPtr and we could | |
| 42 // remove this include and make BisonCSSParser private to the | |
| 43 // subsystem. However, CSSParser is spun up for tiny parses and | |
| 44 // the extra malloc could be a perf hit. | |
| 45 #include "core/css/parser/BisonCSSParser.h" | |
| 46 | |
| 47 namespace WebCore { | |
| 48 | |
| 49 class CSSParser { | |
| 50 WTF_MAKE_NONCOPYABLE(CSSParser); | |
| 51 public: | |
| 52 | |
| 53 CSSParser(const CSSParserContext&, UseCounter* = 0); | |
| 54 | |
| 55 // Only used by StyleSheetContents.cpp and InspectorStyleSheet.cpp | |
| 56 void parseSheet(StyleSheetContents*, const String&, const TextPosition& star tPosition = TextPosition::minimumPosition(), CSSParserObserver* = 0, bool = fals e); | |
| 57 | |
| 58 // Only used by StylePropertySet.cpp | |
| 59 bool parseDeclaration(MutableStylePropertySet*, const String&, CSSParserObse rver*, StyleSheetContents* contextStyleSheet); | |
| 60 | |
| 61 // Most CSSParser clients only instantiate a CSSParser just to call parseSel ector (once). | |
| 62 // FIXME: Replace this with a static which does the same thing? | |
| 63 // Perhaps that static should be on CSSSelectorList itself? | |
| 64 void parseSelector(const String&, CSSSelectorList&); | |
| 65 | |
| 66 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); | |
| 67 | |
| 68 // Only used by CSSKeyframesRule.cpp (plural) | |
| 69 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin g&); | |
| 70 | |
| 71 // Only used by CSSKeyframeRule.cpp (single), always in HTMLStandardMode. | |
| 72 PassOwnPtr<Vector<double> > parseKeyframeKeyList(const String&); | |
| 73 | |
| 74 // Only used by MediaList.cpp, always in HTMLStandardMode. | |
|
ojan
2014/02/19 19:52:31
I'm not sure these "Only used for" comments are te
| |
| 75 PassRefPtr<MediaQuerySet> parseMediaQueryList(const String&); | |
| 76 | |
| 77 // Only used by DOMWindowCSS.cpp, always in HTMLStandardMode. | |
| 78 bool parseSupportsCondition(const String&); | |
| 79 | |
| 80 // FIXME: Color parsing should probably be split out into a separate | |
| 81 // object which is used by CSSParser. | |
| 82 static bool parseColor(RGBA32& color, const String&, bool strict = false); | |
| 83 | |
| 84 // Only for CanvasStyle.cpp | |
| 85 static bool parseSystemColor(RGBA32& color, const String&, Document*); | |
| 86 | |
| 87 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, CSSParserMode, StyleSheetContents*); | |
| 88 | |
| 89 // FIXME: This appears to be a helper only used by StyleBuilderCustom.cpp | |
| 90 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const Document&); | |
| 91 | |
| 92 // Only used by Element.cpp | |
| 93 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con st String&, Element*); | |
| 94 | |
| 95 // Only used by CSSValuePool.cpp. | |
| 96 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); | |
| 97 | |
| 98 private: | |
| 99 BisonCSSParser m_bisonParser; | |
| 100 }; | |
| 101 | |
| 102 // FIXME: This has nothing to do with the parser! | |
| 103 CSSPropertyID cssPropertyID(const String&); | |
| 104 | |
| 105 } | |
| 106 | |
| 107 #endif // CSSParser_h | |
| OLD | NEW |