| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef URLRegistry_h | 31 #ifndef NewCSSTokenizer_h |
| 32 #define URLRegistry_h | 32 #define NewCSSTokenizer_h |
| 33 | 33 |
| 34 #include "core/css/parser/CSSToken.h" |
| 35 #include "core/html/parser/InputStreamPreprocessor.h" |
| 34 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 35 | 37 |
| 36 namespace WebCore { | 38 namespace WebCore { |
| 37 | 39 |
| 38 class KURL; | 40 class CSSInputStream; |
| 39 class SecurityOrigin; | |
| 40 class URLRegistry; | |
| 41 | 41 |
| 42 class URLRegistrable { | 42 class NewCSSTokenizer { |
| 43 WTF_MAKE_NONCOPYABLE(NewCSSTokenizer); |
| 44 WTF_MAKE_FAST_ALLOCATED; |
| 43 public: | 45 public: |
| 44 virtual ~URLRegistrable() { } | 46 NewCSSTokenizer(); |
| 45 virtual URLRegistry& registry() const = 0; | 47 |
| 48 CSSToken nextToken(CSSInputStream&); |
| 49 static void tokenize(String, Vector<CSSToken>&); |
| 50 |
| 51 private: |
| 52 UChar consume(); |
| 53 void reconsume(UChar); |
| 54 |
| 55 CSSToken consumeStringTokenUntil(UChar); |
| 56 CSSToken consumeNumericToken(); |
| 57 CSSToken consumeIdentLikeToken(); |
| 58 CSSToken consumeNumber(); |
| 59 CSSToken consumeURLToken(); |
| 60 |
| 61 void consumeUntilNotWhitespace(); |
| 62 void consumeThroughCommentEndOrUntilEOF(); |
| 63 |
| 64 bool consumeIfNext(UChar); |
| 65 bool consumeIfNext(String); |
| 66 String consumeName(); |
| 67 UChar consumeEscape(); |
| 68 |
| 69 bool nextCharIsNameChar(); |
| 70 bool nextTwoCharsAreValidEscape(); |
| 71 bool nextCharsAreNumber(); |
| 72 bool nextCharsAreIdentifier(); |
| 73 double convertToNumber(String); |
| 74 |
| 75 CSSInputStream* m_input; |
| 46 }; | 76 }; |
| 47 | 77 |
| 48 class URLRegistry { | |
| 49 WTF_MAKE_FAST_ALLOCATED; | |
| 50 public: | |
| 51 virtual ~URLRegistry() { } | |
| 52 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) = 0; | |
| 53 virtual void unregisterURL(const KURL&) = 0; | |
| 54 | |
| 55 // These are optional APIs | |
| 56 virtual URLRegistrable* lookup(const String&) { ASSERT_NOT_REACHED(); return
0; } | |
| 57 virtual bool contains(const String&) { ASSERT_NOT_REACHED(); return false; } | |
| 58 }; | |
| 59 | 78 |
| 60 } // namespace WebCore | 79 } // namespace WebCore |
| 61 | 80 |
| 62 #endif // URLRegistry_h | 81 #endif // NewCSSTokenizer_h |
| OLD | NEW |