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&); |
20 | 20 |
21 float length(); | 21 float length(); |
22 | 22 |
23 private: | 23 private: |
24 bool parse(Vector<CSSParserToken>& tokens); | 24 bool parse(CSSParserTokenRange); |
25 float effectiveSize(); | 25 float effectiveSize(); |
26 bool calculateLengthInPixels(CSSParserTokenRange, float& result); | 26 bool calculateLengthInPixels(CSSParserTokenRange, float& result); |
27 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); | 27 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); |
28 unsigned effectiveSizeDefaultValue(); | 28 unsigned effectiveSizeDefaultValue(); |
29 | 29 |
30 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; | 30 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; |
31 RefPtr<MediaValues> m_mediaValues; | 31 RefPtr<MediaValues> m_mediaValues; |
32 float m_length; | 32 float m_length; |
33 bool m_lengthWasSet; | 33 bool m_lengthWasSet; |
34 Vector<CSSParserToken> m_tokens; | |
35 bool m_isValid; | 34 bool m_isValid; |
36 }; | 35 }; |
37 | 36 |
38 } // namespace | 37 } // namespace |
39 | 38 |
40 #endif | 39 #endif |
41 | 40 |
OLD | NEW |