OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SizesAttributeParser_h | 5 #ifndef SizesAttributeParser_h |
6 #define SizesAttributeParser_h | 6 #define SizesAttributeParser_h |
7 | 7 |
8 #include "core/css/MediaValues.h" | 8 #include "core/css/MediaValues.h" |
9 #include "core/css/parser/MediaQueryBlockWatcher.h" | 9 #include "core/css/parser/MediaQueryBlockWatcher.h" |
10 #include "core/css/parser/MediaQueryParser.h" | 10 #include "core/css/parser/MediaQueryParser.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class SizesAttributeParser { | 16 class SizesAttributeParser { |
17 STACK_ALLOCATED(); | 17 STACK_ALLOCATED(); |
18 public: | 18 public: |
19 SizesAttributeParser(PassRefPtr<MediaValues>, const String&); | 19 SizesAttributeParser(PassRefPtr<MediaValues>, const String&, bool hasLocalFr
ame = true); |
20 | 20 |
21 bool viewportDependant() const { return m_viewportDependant; } | 21 bool viewportDependant() const { return m_viewportDependant; } |
22 float length(); | 22 float length(); |
23 | 23 |
24 private: | 24 private: |
25 bool parse(Vector<CSSParserToken>& tokens); | 25 bool parse(Vector<CSSParserToken>& tokens); |
26 bool parseMediaConditionAndLength(CSSParserTokenIterator startToken, CSSPars
erTokenIterator endToken); | 26 bool parseMediaConditionAndLength(CSSParserTokenIterator startToken, CSSPars
erTokenIterator endToken); |
27 float effectiveSize(); | 27 float effectiveSize(); |
28 bool calculateLengthInPixels(CSSParserTokenIterator startToken, CSSParserTok
enIterator endToken, float& result); | 28 bool calculateLengthInPixels(CSSParserTokenIterator startToken, CSSParserTok
enIterator endToken, float& result); |
29 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); | 29 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); |
30 unsigned effectiveSizeDefaultValue(); | 30 unsigned effectiveSizeDefaultValue(); |
31 | 31 |
32 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; | 32 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; |
33 RefPtr<MediaValues> m_mediaValues; | 33 RefPtr<MediaValues> m_mediaValues; |
34 float m_length; | 34 float m_length; |
35 bool m_lengthWasSet; | 35 bool m_lengthWasSet; |
36 bool m_viewportDependant; | 36 bool m_viewportDependant; |
37 Vector<CSSParserToken> m_tokens; | 37 Vector<CSSParserToken> m_tokens; |
38 bool m_isValid; | 38 bool m_isValid; |
39 MediaQueryBlockWatcher m_blockWatcher; | 39 MediaQueryBlockWatcher m_blockWatcher; |
| 40 bool m_hasLocalFrame; |
40 }; | 41 }; |
41 | 42 |
42 } // namespace | 43 } // namespace |
43 | 44 |
44 #endif | 45 #endif |
45 | 46 |
OLD | NEW |