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

Side by Side Diff: third_party/WebKit/Source/core/frame/Screen.cpp

Issue 2709263003: Removed FrameHost::settings() (Closed)
Patch Set: Switched if statement to use page Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "core/frame/Screen.h" 29 #include "core/frame/Screen.h"
30 30
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
35 #include "core/inspector/InspectorInstrumentation.h" 35 #include "core/inspector/InspectorInstrumentation.h"
36 #include "core/page/ChromeClient.h" 36 #include "core/page/ChromeClient.h"
37 #include "core/page/Page.h"
37 #include "public/platform/WebScreenInfo.h" 38 #include "public/platform/WebScreenInfo.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 Screen::Screen(LocalFrame* frame) : DOMWindowClient(frame) {} 42 Screen::Screen(LocalFrame* frame) : DOMWindowClient(frame) {}
42 43
43 int Screen::height() const { 44 int Screen::height() const {
44 if (!frame()) 45 if (!frame())
45 return 0; 46 return 0;
46 FrameHost* host = frame()->host(); 47 Page* page = frame()->page();
47 if (!host) 48 if (!page)
48 return 0; 49 return 0;
49 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 50 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
50 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 51 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
51 return lroundf(screenInfo.rect.height * screenInfo.deviceScaleFactor); 52 return lroundf(screenInfo.rect.height * screenInfo.deviceScaleFactor);
52 } 53 }
53 return host->chromeClient().screenInfo().rect.height; 54 return page->chromeClient().screenInfo().rect.height;
54 } 55 }
55 56
56 int Screen::width() const { 57 int Screen::width() const {
57 if (!frame()) 58 if (!frame())
58 return 0; 59 return 0;
59 FrameHost* host = frame()->host(); 60 Page* page = frame()->page();
60 if (!host) 61 if (!page)
61 return 0; 62 return 0;
62 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 63 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
63 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 64 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
64 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor); 65 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor);
65 } 66 }
66 return host->chromeClient().screenInfo().rect.width; 67 return page->chromeClient().screenInfo().rect.width;
67 } 68 }
68 69
69 unsigned Screen::colorDepth() const { 70 unsigned Screen::colorDepth() const {
70 if (!frame() || !frame()->host()) 71 if (!frame() || !frame()->host())
71 return 0; 72 return 0;
72 return static_cast<unsigned>( 73 return static_cast<unsigned>(
73 frame()->host()->chromeClient().screenInfo().depth); 74 frame()->host()->chromeClient().screenInfo().depth);
74 } 75 }
75 76
76 unsigned Screen::pixelDepth() const { 77 unsigned Screen::pixelDepth() const {
77 if (!frame()) 78 if (!frame())
78 return 0; 79 return 0;
79 return static_cast<unsigned>( 80 return static_cast<unsigned>(
80 frame()->host()->chromeClient().screenInfo().depth); 81 frame()->host()->chromeClient().screenInfo().depth);
81 } 82 }
82 83
83 int Screen::availLeft() const { 84 int Screen::availLeft() const {
84 if (!frame()) 85 if (!frame())
85 return 0; 86 return 0;
86 FrameHost* host = frame()->host(); 87 Page* page = frame()->page();
87 if (!host) 88 if (!page)
88 return 0; 89 return 0;
89 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 90 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
90 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 91 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
91 return lroundf(screenInfo.availableRect.x * screenInfo.deviceScaleFactor); 92 return lroundf(screenInfo.availableRect.x * screenInfo.deviceScaleFactor);
92 } 93 }
93 return static_cast<int>(host->chromeClient().screenInfo().availableRect.x); 94 return static_cast<int>(page->chromeClient().screenInfo().availableRect.x);
94 } 95 }
95 96
96 int Screen::availTop() const { 97 int Screen::availTop() const {
97 if (!frame()) 98 if (!frame())
98 return 0; 99 return 0;
99 FrameHost* host = frame()->host(); 100 Page* page = frame()->page();
100 if (!host) 101 if (!page)
101 return 0; 102 return 0;
102 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 103 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
103 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 104 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
104 return lroundf(screenInfo.availableRect.y * screenInfo.deviceScaleFactor); 105 return lroundf(screenInfo.availableRect.y * screenInfo.deviceScaleFactor);
105 } 106 }
106 return static_cast<int>(host->chromeClient().screenInfo().availableRect.y); 107 return static_cast<int>(page->chromeClient().screenInfo().availableRect.y);
107 } 108 }
108 109
109 int Screen::availHeight() const { 110 int Screen::availHeight() const {
110 if (!frame()) 111 if (!frame())
111 return 0; 112 return 0;
112 FrameHost* host = frame()->host(); 113 Page* page = frame()->page();
113 if (!host) 114 if (!page)
114 return 0; 115 return 0;
115 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 116 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
116 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 117 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
117 return lroundf(screenInfo.availableRect.height * 118 return lroundf(screenInfo.availableRect.height *
118 screenInfo.deviceScaleFactor); 119 screenInfo.deviceScaleFactor);
119 } 120 }
120 return host->chromeClient().screenInfo().availableRect.height; 121 return page->chromeClient().screenInfo().availableRect.height;
121 } 122 }
122 123
123 int Screen::availWidth() const { 124 int Screen::availWidth() const {
124 if (!frame()) 125 if (!frame())
125 return 0; 126 return 0;
126 FrameHost* host = frame()->host(); 127 Page* page = frame()->page();
127 if (!host) 128 if (!page)
128 return 0; 129 return 0;
129 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { 130 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) {
130 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); 131 WebScreenInfo screenInfo = page->chromeClient().screenInfo();
131 return lroundf(screenInfo.availableRect.width * 132 return lroundf(screenInfo.availableRect.width *
132 screenInfo.deviceScaleFactor); 133 screenInfo.deviceScaleFactor);
133 } 134 }
134 return host->chromeClient().screenInfo().availableRect.width; 135 return page->chromeClient().screenInfo().availableRect.width;
135 } 136 }
136 137
137 DEFINE_TRACE(Screen) { 138 DEFINE_TRACE(Screen) {
138 DOMWindowClient::trace(visitor); 139 DOMWindowClient::trace(visitor);
139 Supplementable<Screen>::trace(visitor); 140 Supplementable<Screen>::trace(visitor);
140 } 141 }
141 142
142 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | third_party/WebKit/Source/core/frame/VisualViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698