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 14 matching lines...) Expand all Loading... |
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 "core/CSSPropertyNames.h" | 33 #include "core/CSSPropertyNames.h" |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/css/MediaQueryEvaluator.h" |
35 #include "core/css/RuleSet.h" | 36 #include "core/css/RuleSet.h" |
36 #include "platform/Length.h" | 37 #include "platform/Length.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class Document; | 41 class Document; |
41 class MutableStylePropertySet; | 42 class MutableStylePropertySet; |
42 class StyleRuleViewport; | 43 class StyleRuleViewport; |
43 | 44 |
44 class CORE_EXPORT ViewportStyleResolver | 45 class CORE_EXPORT ViewportStyleResolver |
45 : public GarbageCollected<ViewportStyleResolver> { | 46 : public GarbageCollected<ViewportStyleResolver> { |
46 public: | 47 public: |
47 static ViewportStyleResolver* create(Document* document) { | 48 static ViewportStyleResolver* create(Document* document) { |
48 return new ViewportStyleResolver(document); | 49 return new ViewportStyleResolver(document); |
49 } | 50 } |
50 | 51 |
51 enum Origin { UserAgentOrigin, AuthorOrigin }; | 52 void reset(); |
52 | 53 void collectViewportRulesFromUASheets(); |
53 void collectViewportRules(); | 54 void collectViewportRulesFromAuthorSheet(const CSSStyleSheet&); |
54 void collectViewportRules(RuleSet*, Origin); | |
55 void resolve(); | 55 void resolve(); |
| 56 bool isAffectedByInitialViewportChange(); |
56 | 57 |
57 DECLARE_TRACE(); | 58 DECLARE_TRACE(); |
58 | 59 |
59 private: | 60 private: |
60 explicit ViewportStyleResolver(Document*); | 61 explicit ViewportStyleResolver(Document*); |
61 | 62 |
62 void addViewportRule(StyleRuleViewport*, Origin); | 63 enum Origin { UserAgentOrigin, AuthorOrigin }; |
| 64 |
| 65 void collectViewportChildRules(const HeapVector<Member<StyleRuleBase>>&, |
| 66 Origin); |
| 67 void addViewportRule(StyleRuleViewport&, Origin); |
63 | 68 |
64 float viewportArgumentValue(CSSPropertyID) const; | 69 float viewportArgumentValue(CSSPropertyID) const; |
65 Length viewportLengthValue(CSSPropertyID) const; | 70 Length viewportLengthValue(CSSPropertyID); |
66 | 71 |
67 Member<Document> m_document; | 72 Member<Document> m_document; |
68 Member<MutableStylePropertySet> m_propertySet; | 73 Member<MutableStylePropertySet> m_propertySet; |
69 bool m_hasAuthorStyle; | 74 Member<MediaQueryEvaluator> m_initialViewportMedium; |
| 75 MediaQueryResultList m_viewportDependentMediaQueryResults; |
| 76 MediaQueryResultList m_deviceDependentMediaQueryResults; |
| 77 bool m_hasAuthorStyle = false; |
| 78 bool m_hasViewportUnits = false; |
70 }; | 79 }; |
71 | 80 |
72 } // namespace blink | 81 } // namespace blink |
73 | 82 |
74 #endif // ViewportStyleResolver_h | 83 #endif // ViewportStyleResolver_h |
OLD | NEW |