| 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" | 10 #include "platform/heap/Handle.h" |
| 11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
| 12 | 12 |
| 13 namespace WebCore { | 13 namespace WebCore { |
| 14 | 14 |
| 15 class SizesAttributeParser { | 15 class SizesAttributeParser { |
| 16 STACK_ALLOCATED(); | 16 STACK_ALLOCATED(); |
| 17 public: | 17 public: |
| 18 static unsigned findEffectiveSize(const String& attribute, PassRefPtr<MediaV
alues>); | 18 static unsigned findEffectiveSize(const String& attribute, PassRefPtr<MediaV
alues>, bool& viewportDependant); |
| 19 | 19 |
| 20 private: | 20 private: |
| 21 SizesAttributeParser(PassRefPtr<MediaValues> mediaValues) | 21 SizesAttributeParser(PassRefPtr<MediaValues> mediaValues) |
| 22 : m_mediaValues(mediaValues) | 22 : m_mediaValues(mediaValues) |
| 23 , m_length(0) | 23 , m_length(0) |
| 24 , m_lengthWasSet(false) | 24 , m_lengthWasSet(false) |
| 25 , m_viewportDependant(false) |
| 25 { | 26 { |
| 26 } | 27 } |
| 27 | 28 |
| 28 bool parse(Vector<MediaQueryToken>& tokens); | 29 bool parse(Vector<MediaQueryToken>& tokens); |
| 29 bool parseMediaConditionAndLength(MediaQueryTokenIterator startToken, MediaQ
ueryTokenIterator endToken); | 30 bool parseMediaConditionAndLength(MediaQueryTokenIterator startToken, MediaQ
ueryTokenIterator endToken); |
| 30 unsigned effectiveSize(); | 31 unsigned effectiveSize(); |
| 31 bool calculateLengthInPixels(MediaQueryTokenIterator startToken, MediaQueryT
okenIterator endToken, unsigned& result); | 32 bool calculateLengthInPixels(MediaQueryTokenIterator startToken, MediaQueryT
okenIterator endToken, unsigned& result); |
| 32 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); | 33 bool mediaConditionMatches(PassRefPtrWillBeRawPtr<MediaQuerySet> mediaCondit
ion); |
| 33 unsigned effectiveSizeDefaultValue(); | 34 unsigned effectiveSizeDefaultValue(); |
| 35 bool viewportDependant() const { return m_viewportDependant; } |
| 34 | 36 |
| 35 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; | 37 RefPtrWillBeMember<MediaQuerySet> m_mediaCondition; |
| 36 RefPtr<MediaValues> m_mediaValues; | 38 RefPtr<MediaValues> m_mediaValues; |
| 37 unsigned m_length; | 39 unsigned m_length; |
| 38 bool m_lengthWasSet; | 40 bool m_lengthWasSet; |
| 41 bool m_viewportDependant; |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 } // namespace | 44 } // namespace |
| 42 | 45 |
| 43 #endif | 46 #endif |
| 44 | 47 |
| OLD | NEW |