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

Side by Side Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2177333002: Move setWindowRect and windowRect calls from WebViewClient to WebWidgetClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change CHECK to a DCHECK Created 4 years, 4 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void* ChromeClientImpl::webView() const 178 void* ChromeClientImpl::webView() const
179 { 179 {
180 return static_cast<void*>(m_webView); 180 return static_cast<void*>(m_webView);
181 } 181 }
182 182
183 void ChromeClientImpl::chromeDestroyed() 183 void ChromeClientImpl::chromeDestroyed()
184 { 184 {
185 // Our lifetime is bound to the WebViewImpl. 185 // Our lifetime is bound to the WebViewImpl.
186 } 186 }
187 187
188 void ChromeClientImpl::setWindowRect(const IntRect& r) 188 void ChromeClientImpl::setWindowRect(const IntRect& r, LocalFrame* frame)
189 { 189 {
190 if (m_webView->client()) 190 DCHECK(frame == m_webView->mainFrameImpl()->frame());
dcheng 2016/08/15 18:22:44 Nit: DCHECK_EQ
lfg 2016/08/16 21:02:13 Done.
191 m_webView->client()->setWindowRect(r); 191 WebWidgetClient* client = WebLocalFrameImpl::fromFrame(frame)->frameWidget() ->client();
192
193 if (client)
dcheng 2016/08/15 18:22:44 Do we need to nullcheck this? It looks like the ca
lfg 2016/08/16 21:02:13 It's been a while, so I don't remember exactly, bu
194 client->setWindowRect(r);
192 } 195 }
193 196
194 IntRect ChromeClientImpl::windowRect() 197 IntRect ChromeClientImpl::rootWindowRect()
195 { 198 {
196 WebRect rect; 199 WebRect rect;
197 if (m_webView->client()) { 200 if (m_webView->client()) {
198 rect = m_webView->client()->rootWindowRect(); 201 rect = m_webView->client()->rootWindowRect();
199 } else { 202 } else {
200 // These numbers will be fairly wrong. The window's x/y coordinates will 203 // These numbers will be fairly wrong. The window's x/y coordinates will
201 // be the top left corner of the screen and the size will be the content 204 // be the top left corner of the screen and the size will be the content
202 // size instead of the window size. 205 // size instead of the window size.
203 rect.width = m_webView->size().width; 206 rect.width = m_webView->size().width;
204 rect.height = m_webView->size().height; 207 rect.height = m_webView->size().height;
205 } 208 }
206 return IntRect(rect); 209 return IntRect(rect);
207 } 210 }
208 211
209 IntRect ChromeClientImpl::pageRect() 212 IntRect ChromeClientImpl::pageRect()
210 { 213 {
211 // We hide the details of the window's border thickness from the web page by 214 // We hide the details of the window's border thickness from the web page by
212 // simple re-using the window position here. So, from the point-of-view of 215 // simple re-using the window position here. So, from the point-of-view of
213 // the web page, the window has no border. 216 // the web page, the window has no border.
214 return windowRect(); 217 return rootWindowRect();
215 } 218 }
216 219
217 void ChromeClientImpl::focus() 220 void ChromeClientImpl::focus()
218 { 221 {
219 if (m_webView->client()) 222 if (m_webView->client())
220 m_webView->client()->didFocus(); 223 m_webView->client()->didFocus();
221 } 224 }
222 225
223 bool ChromeClientImpl::canTakeFocus(WebFocusType) 226 bool ChromeClientImpl::canTakeFocus(WebFocusType)
224 { 227 {
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 { 1082 {
1080 return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext) .release()); 1083 return wrapUnique(m_webView->scheduler()->createFrameScheduler(blameContext) .release());
1081 } 1084 }
1082 1085
1083 double ChromeClientImpl::lastFrameTimeMonotonic() const 1086 double ChromeClientImpl::lastFrameTimeMonotonic() const
1084 { 1087 {
1085 return m_webView->lastFrameTimeMonotonic(); 1088 return m_webView->lastFrameTimeMonotonic();
1086 } 1089 }
1087 1090
1088 } // namespace blink 1091 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698