OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/MediaValuesCached.h" | 5 #include "core/css/MediaValuesCached.h" |
6 | 6 |
7 #include "core/css/CSSPrimitiveValue.h" | 7 #include "core/css/CSSPrimitiveValue.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 defaultFontSize(16), | 28 defaultFontSize(16), |
29 threeDEnabled(false), | 29 threeDEnabled(false), |
30 strictMode(true), | 30 strictMode(true), |
31 displayMode(WebDisplayModeBrowser), | 31 displayMode(WebDisplayModeBrowser), |
32 displayShape(DisplayShapeRect), | 32 displayShape(DisplayShapeRect), |
33 colorGamut(ColorSpaceGamut::Unknown) {} | 33 colorGamut(ColorSpaceGamut::Unknown) {} |
34 | 34 |
35 MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( | 35 MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( |
36 Document& document) | 36 Document& document) |
37 : MediaValuesCached::MediaValuesCachedData() { | 37 : MediaValuesCached::MediaValuesCachedData() { |
38 ASSERT(isMainThread()); | 38 DCHECK(isMainThread()); |
39 LocalFrame* frame = MediaValues::frameFrom(document); | 39 LocalFrame* frame = MediaValues::frameFrom(document); |
40 // TODO(hiroshige): Clean up |frame->view()| conditions. | 40 // TODO(hiroshige): Clean up |frame->view()| conditions. |
41 ASSERT(!frame || frame->view()); | 41 DCHECK(!frame || frame->view()); |
42 if (frame && frame->view()) { | 42 if (frame && frame->view()) { |
43 ASSERT(frame->document() && !frame->document()->layoutViewItem().isNull()); | 43 DCHECK(frame->document()); |
| 44 DCHECK(!frame->document()->layoutViewItem().isNull()); |
44 | 45 |
45 // In case that frame is missing (e.g. for images that their document does | 46 // In case that frame is missing (e.g. for images that their document does |
46 // not have a frame) | 47 // not have a frame) |
47 // We simply leave the MediaValues object with the default | 48 // We simply leave the MediaValues object with the default |
48 // MediaValuesCachedData values. | 49 // MediaValuesCachedData values. |
49 viewportWidth = MediaValues::calculateViewportWidth(frame); | 50 viewportWidth = MediaValues::calculateViewportWidth(frame); |
50 viewportHeight = MediaValues::calculateViewportHeight(frame); | 51 viewportHeight = MediaValues::calculateViewportHeight(frame); |
51 deviceWidth = MediaValues::calculateDeviceWidth(frame); | 52 deviceWidth = MediaValues::calculateDeviceWidth(frame); |
52 deviceHeight = MediaValues::calculateDeviceHeight(frame); | 53 deviceHeight = MediaValues::calculateDeviceHeight(frame); |
53 devicePixelRatio = MediaValues::calculateDevicePixelRatio(frame); | 54 devicePixelRatio = MediaValues::calculateDevicePixelRatio(frame); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 179 |
179 DisplayShape MediaValuesCached::displayShape() const { | 180 DisplayShape MediaValuesCached::displayShape() const { |
180 return m_data.displayShape; | 181 return m_data.displayShape; |
181 } | 182 } |
182 | 183 |
183 ColorSpaceGamut MediaValuesCached::colorGamut() const { | 184 ColorSpaceGamut MediaValuesCached::colorGamut() const { |
184 return m_data.colorGamut; | 185 return m_data.colorGamut; |
185 } | 186 } |
186 | 187 |
187 } // namespace blink | 188 } // namespace blink |
OLD | NEW |