Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/MediaValuesInitialViewport.h" | 5 #include "core/css/MediaValuesInitialViewport.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/layout/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 MediaValues* MediaValuesInitialViewport::create(LocalFrame& frame) { | 14 MediaValues* MediaValuesInitialViewport::create(LocalFrame& frame) { |
| 15 return new MediaValuesInitialViewport(frame); | 15 return new MediaValuesInitialViewport(frame); |
| 16 } | 16 } |
| 17 | 17 |
| 18 MediaValuesInitialViewport::MediaValuesInitialViewport(LocalFrame& frame) | 18 MediaValuesInitialViewport::MediaValuesInitialViewport(LocalFrame& frame) |
| 19 : MediaValuesDynamic(&frame) {} | 19 : MediaValuesDynamic(&frame) {} |
| 20 | 20 |
| 21 double MediaValuesInitialViewport::viewportWidth() const { | 21 double MediaValuesInitialViewport::viewportWidth() const { |
| 22 DCHECK(m_frame->view() && m_frame->document()); | 22 DCHECK(m_frame->view()); |
| 23 int viewportWidth = m_frame->view()->frameRect().width(); | 23 return m_frame->view()->initialViewportWidth(); |
|
bokan
2016/10/18 17:19:26
I'm a stranger around these parts, but m_frame can
rune
2016/10/18 22:09:53
Right, MediaValuesInitialViewport are only used fo
bokan
2016/10/18 22:28:06
Ok. I'm fine with either approach though DCHECKs f
rune
2016/10/18 22:56:12
DCHECKs added.
| |
| 24 return adjustDoubleForAbsoluteZoom( | |
| 25 viewportWidth, m_frame->document()->layoutViewItem().styleRef()); | |
| 26 } | 24 } |
| 27 | 25 |
| 28 double MediaValuesInitialViewport::viewportHeight() const { | 26 double MediaValuesInitialViewport::viewportHeight() const { |
| 29 DCHECK(m_frame->view() && m_frame->document()); | 27 DCHECK(m_frame->view()); |
| 30 int viewportHeight = m_frame->view()->frameRect().height(); | 28 return m_frame->view()->initialViewportHeight(); |
| 31 return adjustDoubleForAbsoluteZoom( | |
| 32 viewportHeight, m_frame->document()->layoutViewItem().styleRef()); | |
| 33 } | 29 } |
| 34 | 30 |
| 35 } // namespace blink | 31 } // namespace blink |
| OLD | NEW |