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 21 matching lines...) Expand all Loading... |
32 #include "core/CSSValueKeywords.h" | 32 #include "core/CSSValueKeywords.h" |
33 #include "core/css/CSSDefaultStyleSheets.h" | 33 #include "core/css/CSSDefaultStyleSheets.h" |
34 #include "core/css/CSSPrimitiveValueMappings.h" | 34 #include "core/css/CSSPrimitiveValueMappings.h" |
35 #include "core/css/CSSToLengthConversionData.h" | 35 #include "core/css/CSSToLengthConversionData.h" |
36 #include "core/css/StylePropertySet.h" | 36 #include "core/css/StylePropertySet.h" |
37 #include "core/css/StyleRule.h" | 37 #include "core/css/StyleRule.h" |
38 #include "core/css/resolver/ScopedStyleResolver.h" | 38 #include "core/css/resolver/ScopedStyleResolver.h" |
39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
40 #include "core/dom/NodeComputedStyle.h" | 40 #include "core/dom/NodeComputedStyle.h" |
41 #include "core/dom/ViewportDescription.h" | 41 #include "core/dom/ViewportDescription.h" |
| 42 #include "core/frame/FrameView.h" |
42 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
46 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); | 47 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); |
47 | 48 |
48 ViewportStyleResolver::ViewportStyleResolver(Document* document) | 49 ViewportStyleResolver::ViewportStyleResolver(Document* document) |
49 : m_document(document) | 50 : m_document(document) |
50 , m_hasAuthorStyle(false) | 51 , m_hasAuthorStyle(false) |
51 { | 52 { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 194 |
194 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) | 195 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) |
195 return Length(ExtendToZoom); | 196 return Length(ExtendToZoom); |
196 | 197 |
197 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); | 198 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); |
198 | 199 |
199 // If we have viewport units the conversion will mark the document style as
having viewport units. | 200 // If we have viewport units the conversion will mark the document style as
having viewport units. |
200 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); | 201 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); |
201 documentStyle->setHasViewportUnits(false); | 202 documentStyle->setHasViewportUnits(false); |
202 | 203 |
| 204 FrameView* view = m_document->view(); |
| 205 float width = view ? view->width() : 0; |
| 206 float height = view ? view->height() : 0; |
| 207 |
203 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle)
; | 208 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle)
; |
204 CSSToLengthConversionData::ViewportSize viewportSize(m_document->layoutView(
)); | 209 CSSToLengthConversionData::ViewportSize viewportSize(width, height); |
205 | 210 |
206 if (primitiveValue->getValueID() == CSSValueAuto) | 211 if (primitiveValue->getValueID() == CSSValueAuto) |
207 return Length(Auto); | 212 return Length(Auto); |
208 | 213 |
209 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do
cumentStyle, fontSizes, viewportSize, 1.0f)); | 214 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do
cumentStyle, fontSizes, viewportSize, 1.0f)); |
210 if (documentStyle->hasViewportUnits()) | 215 if (documentStyle->hasViewportUnits()) |
211 m_document->setHasViewportUnits(); | 216 m_document->setHasViewportUnits(); |
212 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); | 217 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); |
213 | 218 |
214 return result; | 219 return result; |
215 } | 220 } |
216 | 221 |
217 DEFINE_TRACE(ViewportStyleResolver) | 222 DEFINE_TRACE(ViewportStyleResolver) |
218 { | 223 { |
219 visitor->trace(m_propertySet); | 224 visitor->trace(m_propertySet); |
220 visitor->trace(m_document); | 225 visitor->trace(m_document); |
221 } | 226 } |
222 | 227 |
223 } // namespace blink | 228 } // namespace blink |
OLD | NEW |