| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/MediaValues.h" | 6 #include "core/css/MediaValues.h" |
| 7 | 7 |
| 8 #include "core/css/CSSHelper.h" | 8 #include "core/css/CSSHelper.h" |
| 9 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
| 10 #include "core/css/MediaValuesDynamic.h" | 10 #include "core/css/MediaValuesDynamic.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 PassRefPtr<MediaValues> MediaValues::createDynamicIfFrameExists(LocalFrame* fram
e) | 27 PassRefPtr<MediaValues> MediaValues::createDynamicIfFrameExists(LocalFrame* fram
e) |
| 28 { | 28 { |
| 29 if (frame) | 29 if (frame) |
| 30 return MediaValuesDynamic::create(frame); | 30 return MediaValuesDynamic::create(frame); |
| 31 return MediaValuesCached::create(); | 31 return MediaValuesCached::create(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 int MediaValues::calculateViewportWidth(LocalFrame* frame) const | 34 int MediaValues::calculateViewportWidth(LocalFrame* frame) const |
| 35 { | 35 { |
| 36 ASSERT(frame && frame->view() && frame->document()); | 36 ASSERT(frame && frame->view() && frame->document()); |
| 37 int viewportWidth = frame->view()->layoutSize(IncludeScrollbars).width(); | 37 return frame->view()->layoutSize(IncludeScrollbars).width(); |
| 38 return adjustForAbsoluteZoom(viewportWidth, frame->document()->renderView())
; | |
| 39 } | 38 } |
| 40 | 39 |
| 41 int MediaValues::calculateViewportHeight(LocalFrame* frame) const | 40 int MediaValues::calculateViewportHeight(LocalFrame* frame) const |
| 42 { | 41 { |
| 43 ASSERT(frame && frame->view() && frame->document()); | 42 ASSERT(frame && frame->view() && frame->document()); |
| 44 int viewportHeight = frame->view()->layoutSize(IncludeScrollbars).height(); | 43 return frame->view()->layoutSize(IncludeScrollbars).height(); |
| 45 return adjustForAbsoluteZoom(viewportHeight, frame->document()->renderView()
); | |
| 46 } | 44 } |
| 47 | 45 |
| 48 int MediaValues::calculateDeviceWidth(LocalFrame* frame) const | 46 int MediaValues::calculateDeviceWidth(LocalFrame* frame) const |
| 49 { | 47 { |
| 50 ASSERT(frame && frame->view() && frame->settings() && frame->host()); | 48 ASSERT(frame && frame->view() && frame->settings() && frame->host()); |
| 51 int deviceWidth = static_cast<int>(screenRect(frame->view()).width()); | 49 int deviceWidth = static_cast<int>(screenRect(frame->view()).width()); |
| 52 return deviceWidth; | 50 return deviceWidth; |
| 53 } | 51 } |
| 54 | 52 |
| 55 int MediaValues::calculateDeviceHeight(LocalFrame* frame) const | 53 int MediaValues::calculateDeviceHeight(LocalFrame* frame) const |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 194 } |
| 197 | 195 |
| 198 LocalFrame* MediaValues::frameFrom(Document& document) | 196 LocalFrame* MediaValues::frameFrom(Document& document) |
| 199 { | 197 { |
| 200 Document* executingDocument = document.importsController() ? document.import
sController()->master() : &document; | 198 Document* executingDocument = document.importsController() ? document.import
sController()->master() : &document; |
| 201 ASSERT(executingDocument); | 199 ASSERT(executingDocument); |
| 202 return executingDocument->frame(); | 200 return executingDocument->frame(); |
| 203 } | 201 } |
| 204 | 202 |
| 205 } // namespace | 203 } // namespace |
| OLD | NEW |