OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 27 matching lines...) Expand all Loading... |
38 class CSSPreloadScanner { | 38 class CSSPreloadScanner { |
39 WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); | 39 WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); |
40 public: | 40 public: |
41 CSSPreloadScanner(); | 41 CSSPreloadScanner(); |
42 ~CSSPreloadScanner(); | 42 ~CSSPreloadScanner(); |
43 | 43 |
44 void reset(); | 44 void reset(); |
45 | 45 |
46 void scan(const HTMLToken::DataVector&, const SegmentedString&, PreloadReque
stStream&); | 46 void scan(const HTMLToken::DataVector&, const SegmentedString&, PreloadReque
stStream&); |
47 void scan(const String&, const SegmentedString&, PreloadRequestStream&); | 47 void scan(const String&, const SegmentedString&, PreloadRequestStream&); |
| 48 void setIsBeforeBody(const bool isBeforeBody) { m_isBeforeBody = isBeforeBod
y; } |
48 | 49 |
49 private: | 50 private: |
50 enum State { | 51 enum State { |
51 Initial, | 52 Initial, |
52 MaybeComment, | 53 MaybeComment, |
53 Comment, | 54 Comment, |
54 MaybeCommentEnd, | 55 MaybeCommentEnd, |
55 RuleStart, | 56 RuleStart, |
56 Rule, | 57 Rule, |
57 AfterRule, | 58 AfterRule, |
58 RuleValue, | 59 RuleValue, |
59 AfterRuleValue, | 60 AfterRuleValue, |
60 DoneParsingImportRules, | 61 DoneParsingImportRules, |
61 }; | 62 }; |
62 | 63 |
63 template<typename Char> | 64 template<typename Char> |
64 void scanCommon(const Char* begin, const Char* end, const SegmentedString&,
PreloadRequestStream&); | 65 void scanCommon(const Char* begin, const Char* end, const SegmentedString&,
PreloadRequestStream&); |
65 | 66 |
66 inline void tokenize(UChar, const SegmentedString&); | 67 inline void tokenize(UChar, const SegmentedString&); |
67 void emitRule(const SegmentedString&); | 68 void emitRule(const SegmentedString&); |
68 | 69 |
69 State m_state; | 70 State m_state; |
70 StringBuilder m_rule; | 71 StringBuilder m_rule; |
71 StringBuilder m_ruleValue; | 72 StringBuilder m_ruleValue; |
| 73 bool m_isBeforeBody; |
72 | 74 |
73 // Only non-zero during scan() | 75 // Only non-zero during scan() |
74 PreloadRequestStream* m_requests; | 76 PreloadRequestStream* m_requests; |
75 }; | 77 }; |
76 | 78 |
77 } | 79 } |
78 | 80 |
79 #endif | 81 #endif |
OLD | NEW |