OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 2 * Copyright (C) 2012-2013 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 m_document = 0; | 89 m_document = 0; |
90 } | 90 } |
91 | 91 |
92 void ViewportStyleResolver::resolve() | 92 void ViewportStyleResolver::resolve() |
93 { | 93 { |
94 if (!m_document) | 94 if (!m_document) |
95 return; | 95 return; |
96 | 96 |
97 if (!m_propertySet || (!m_hasAuthorStyle && m_document->hasLegacyViewportTag
())) { | 97 if (!m_propertySet || (!m_hasAuthorStyle && m_document->hasLegacyViewportTag
())) { |
98 ASSERT(!m_hasAuthorStyle); | 98 ASSERT(!m_hasAuthorStyle); |
99 m_propertySet = 0; | 99 m_propertySet = nullptr; |
100 m_document->setViewportDescription(ViewportDescription()); | 100 m_document->setViewportDescription(ViewportDescription()); |
101 return; | 101 return; |
102 } | 102 } |
103 | 103 |
104 ViewportDescription description(m_hasAuthorStyle ? ViewportDescription::Auth
orStyleSheet : ViewportDescription::UserAgentStyleSheet); | 104 ViewportDescription description(m_hasAuthorStyle ? ViewportDescription::Auth
orStyleSheet : ViewportDescription::UserAgentStyleSheet); |
105 | 105 |
106 description.userZoom = viewportArgumentValue(CSSPropertyUserZoom); | 106 description.userZoom = viewportArgumentValue(CSSPropertyUserZoom); |
107 description.zoom = viewportArgumentValue(CSSPropertyZoom); | 107 description.zoom = viewportArgumentValue(CSSPropertyZoom); |
108 description.minZoom = viewportArgumentValue(CSSPropertyMinZoom); | 108 description.minZoom = viewportArgumentValue(CSSPropertyMinZoom); |
109 description.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom); | 109 description.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom); |
110 description.minWidth = viewportLengthValue(CSSPropertyMinWidth); | 110 description.minWidth = viewportLengthValue(CSSPropertyMinWidth); |
111 description.maxWidth = viewportLengthValue(CSSPropertyMaxWidth); | 111 description.maxWidth = viewportLengthValue(CSSPropertyMaxWidth); |
112 description.minHeight = viewportLengthValue(CSSPropertyMinHeight); | 112 description.minHeight = viewportLengthValue(CSSPropertyMinHeight); |
113 description.maxHeight = viewportLengthValue(CSSPropertyMaxHeight); | 113 description.maxHeight = viewportLengthValue(CSSPropertyMaxHeight); |
114 description.orientation = viewportArgumentValue(CSSPropertyOrientation); | 114 description.orientation = viewportArgumentValue(CSSPropertyOrientation); |
115 | 115 |
116 m_document->setViewportDescription(description); | 116 m_document->setViewportDescription(description); |
117 | 117 |
118 m_propertySet = 0; | 118 m_propertySet = nullptr; |
119 m_hasAuthorStyle = false; | 119 m_hasAuthorStyle = false; |
120 } | 120 } |
121 | 121 |
122 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const | 122 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const |
123 { | 123 { |
124 float defaultValue = ViewportDescription::ValueAuto; | 124 float defaultValue = ViewportDescription::ValueAuto; |
125 | 125 |
126 // UserZoom default value is CSSValueZoom, which maps to true, meaning that | 126 // UserZoom default value is CSSValueZoom, which maps to true, meaning that |
127 // yes, it is user scalable. When the value is set to CSSValueFixed, we | 127 // yes, it is user scalable. When the value is set to CSSValueFixed, we |
128 // return false. | 128 // return false. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 Length result = primitiveValue->convertToLength<AnyConversion>(CSSToLengthCo
nversionData(documentStyle, documentStyle, width, height, 1.0f)); | 201 Length result = primitiveValue->convertToLength<AnyConversion>(CSSToLengthCo
nversionData(documentStyle, documentStyle, width, height, 1.0f)); |
202 if (documentStyle->hasViewportUnits()) | 202 if (documentStyle->hasViewportUnits()) |
203 m_document->setHasViewportUnits(); | 203 m_document->setHasViewportUnits(); |
204 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); | 204 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); |
205 | 205 |
206 return result; | 206 return result; |
207 } | 207 } |
208 | 208 |
209 } // namespace WebCore | 209 } // namespace WebCore |
OLD | NEW |