Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp

Issue 2431613002: Initial viewport is not the same as FrameView rect. (Closed)
Patch Set: DCHECK that initial viewport size is read from main frame only. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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();
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/MediaValuesInitialViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698