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