| 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/MediaQueryParser.h" | 9 #include "core/css/parser/MediaQueryParser.h" |
| 10 #include "platform/heap/Handle.h" | |
| 11 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| 12 | 11 |
| 13 namespace WebCore { | 12 namespace WebCore { |
| 14 | 13 |
| 15 class SizesAttributeParser { | 14 class SizesAttributeParser { |
| 16 STACK_ALLOCATED(); | |
| 17 public: | 15 public: |
| 18 static unsigned findEffectiveSize(const String& attribute, PassRefPtr<MediaV
alues>); | 16 static unsigned findEffectiveSize(const String& attribute, PassRefPtr<MediaV
alues>); |
| 19 | 17 |
| 20 private: | 18 private: |
| 21 SizesAttributeParser(PassRefPtr<MediaValues> mediaValues) | 19 SizesAttributeParser(PassRefPtr<MediaValues> mediaValues) |
| 22 : m_mediaValues(mediaValues) | 20 : m_mediaValues(mediaValues) |
| 23 , m_length(0) | 21 , m_length(0) |
| 24 { | 22 { |
| 25 } | 23 } |
| 26 | 24 |
| 27 bool parse(Vector<MediaQueryToken>& tokens); | 25 bool parse(Vector<MediaQueryToken>& tokens); |
| 28 bool parseMediaConditionAndLength(TokenIterator startToken, TokenIterator en
dToken); | 26 bool parseMediaConditionAndLength(TokenIterator startToken, TokenIterator en
dToken); |
| 29 unsigned effectiveSize(); | 27 unsigned effectiveSize(); |
| 30 bool calculateLengthInPixels(TokenIterator startToken, TokenIterator endToke
n, unsigned& result); | 28 bool calculateLengthInPixels(TokenIterator startToken, TokenIterator endToke
n, unsigned& result); |
| 31 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); | 29 bool mediaConditionMatches(PassRefPtr<MediaQuerySet> mediaCondition); |
| 32 unsigned effectiveSizeDefaultValue(); | 30 unsigned effectiveSizeDefaultValue(); |
| 33 | 31 |
| 34 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; | 32 RefPtr<MediaQuerySet> m_mediaCondition; |
| 35 RefPtr<MediaValues> m_mediaValues; | 33 RefPtr<MediaValues> m_mediaValues; |
| 36 unsigned m_length; | 34 unsigned m_length; |
| 37 }; | 35 }; |
| 38 | 36 |
| 39 } // namespace | 37 } // namespace |
| 40 | 38 |
| 41 #endif | 39 #endif |
| 42 | 40 |
| OLD | NEW |