| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 2 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
| 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef ViewportStyleResolver_h | 30 #ifndef ViewportStyleResolver_h |
| 31 #define ViewportStyleResolver_h | 31 #define ViewportStyleResolver_h |
| 32 | 32 |
| 33 #include "CSSPropertyNames.h" | 33 #include "CSSPropertyNames.h" |
| 34 #include "core/css/RuleSet.h" |
| 34 #include "core/platform/Length.h" | 35 #include "core/platform/Length.h" |
| 35 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 36 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 class Document; | 41 class Document; |
| 41 class MutableStylePropertySet; | 42 class MutableStylePropertySet; |
| 42 class StyleRuleViewport; | 43 class StyleRuleViewport; |
| 43 | 44 |
| 44 class ViewportStyleResolver : public RefCounted<ViewportStyleResolver> { | 45 class ViewportStyleResolver : public RefCounted<ViewportStyleResolver> { |
| 45 public: | 46 public: |
| 46 static PassRefPtr<ViewportStyleResolver> create(Document* document) | 47 static PassRefPtr<ViewportStyleResolver> create(Document* document) |
| 47 { | 48 { |
| 48 return adoptRef(new ViewportStyleResolver(document)); | 49 return adoptRef(new ViewportStyleResolver(document)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 ~ViewportStyleResolver(); | 52 ~ViewportStyleResolver(); |
| 52 | 53 |
| 53 void setHasAuthorStyle() { m_hasAuthorStyle = true; } | 54 enum Origin { UserAgentOrigin, AuthorOrigin }; |
| 54 void addViewportRule(StyleRuleViewport*); | 55 |
| 56 void collectViewportRules(RuleSet*, Origin); |
| 55 | 57 |
| 56 void clearDocument(); | 58 void clearDocument(); |
| 57 void resolve(); | 59 void resolve(); |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 explicit ViewportStyleResolver(Document*); | 62 explicit ViewportStyleResolver(Document*); |
| 61 | 63 |
| 64 void addViewportRule(StyleRuleViewport*, Origin); |
| 65 |
| 62 float viewportArgumentValue(CSSPropertyID) const; | 66 float viewportArgumentValue(CSSPropertyID) const; |
| 63 Length viewportLengthValue(CSSPropertyID) const; | 67 Length viewportLengthValue(CSSPropertyID) const; |
| 64 | 68 |
| 65 Document* m_document; | 69 Document* m_document; |
| 66 RefPtr<MutableStylePropertySet> m_propertySet; | 70 RefPtr<MutableStylePropertySet> m_propertySet; |
| 67 bool m_hasAuthorStyle; | 71 bool m_hasAuthorStyle; |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 } // namespace WebCore | 74 } // namespace WebCore |
| 71 | 75 |
| 72 #endif // ViewportStyleResolver_h | 76 #endif // ViewportStyleResolver_h |
| OLD | NEW |