Chromium Code Reviews| 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" | |
| 43 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 43 #include "core/layout/LayoutView.h" | |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); | 47 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); |
| 48 | 48 |
| 49 ViewportStyleResolver::ViewportStyleResolver(Document* document) | 49 ViewportStyleResolver::ViewportStyleResolver(Document* document) |
| 50 : m_document(document) | 50 : m_document(document) |
| 51 , m_hasAuthorStyle(false) | 51 , m_hasAuthorStyle(false) |
| 52 { | 52 { |
| 53 ASSERT(m_document); | 53 ASSERT(m_document); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 194 |
| 195 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) | 195 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) |
| 196 return Length(ExtendToZoom); | 196 return Length(ExtendToZoom); |
| 197 | 197 |
| 198 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); | 198 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); |
| 199 | 199 |
| 200 // 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. |
| 201 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); | 201 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); |
| 202 documentStyle->setHasViewportUnits(false); | 202 documentStyle->setHasViewportUnits(false); |
| 203 | 203 |
| 204 FrameView* view = m_document->view(); | 204 LayoutView* view = m_document->layoutView(); |
| 205 float width = view ? view->width() : 0; | 205 float width = view ? view->viewportSizeForViewportUnits().width() : 0; |
|
jbroman
2016/01/20 15:44:28
This seems to be the same logic that's in Viewport
bokan
2016/01/20 16:41:10
Done.
| |
| 206 float height = view ? view->height() : 0; | 206 float height = view ? view->viewportSizeForViewportUnits().height() : 0; |
| 207 | 207 |
| 208 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ; | 208 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ; |
| 209 CSSToLengthConversionData::ViewportSize viewportSize(width, height); | 209 CSSToLengthConversionData::ViewportSize viewportSize(width, height); |
| 210 | 210 |
| 211 if (primitiveValue->getValueID() == CSSValueAuto) | 211 if (primitiveValue->getValueID() == CSSValueAuto) |
| 212 return Length(Auto); | 212 return Length(Auto); |
| 213 | 213 |
| 214 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do cumentStyle, fontSizes, viewportSize, 1.0f)); | 214 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do cumentStyle, fontSizes, viewportSize, 1.0f)); |
| 215 if (documentStyle->hasViewportUnits()) | 215 if (documentStyle->hasViewportUnits()) |
| 216 m_document->setHasViewportUnits(); | 216 m_document->setHasViewportUnits(); |
| 217 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); | 217 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); |
| 218 | 218 |
| 219 return result; | 219 return result; |
| 220 } | 220 } |
| 221 | 221 |
| 222 DEFINE_TRACE(ViewportStyleResolver) | 222 DEFINE_TRACE(ViewportStyleResolver) |
| 223 { | 223 { |
| 224 visitor->trace(m_propertySet); | 224 visitor->trace(m_propertySet); |
| 225 visitor->trace(m_document); | 225 visitor->trace(m_document); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |