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

Unified Diff: third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp

Issue 2414343002: Implement MediaValues for initial viewport. (Closed)
Patch Set: CORE_EXPORT in inheritance chain for Windows 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp
diff --git a/third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp b/third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0d9f776cd3dc65b6f77ac90dee16ac14a5c683db
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/MediaValuesInitialViewport.cpp
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/css/MediaValuesInitialViewport.h"
+
+#include "core/dom/Document.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+#include "core/layout/api/LayoutViewItem.h"
+
+namespace blink {
+
+MediaValues* MediaValuesInitialViewport::create(LocalFrame& frame) {
+ return new MediaValuesInitialViewport(frame);
+}
+
+MediaValuesInitialViewport::MediaValuesInitialViewport(LocalFrame& frame)
+ : MediaValuesDynamic(&frame) {}
+
+double MediaValuesInitialViewport::viewportWidth() const {
+ DCHECK(m_frame->view() && m_frame->document());
+ int viewportWidth = m_frame->view()->frameRect().width();
+ return adjustDoubleForAbsoluteZoom(
+ viewportWidth, m_frame->document()->layoutViewItem().styleRef());
+}
+
+double MediaValuesInitialViewport::viewportHeight() const {
+ DCHECK(m_frame->view() && m_frame->document());
+ int viewportHeight = m_frame->view()->frameRect().height();
+ return adjustDoubleForAbsoluteZoom(
+ viewportHeight, m_frame->document()->layoutViewItem().styleRef());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698