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

Side by Side Diff: content/renderer/render_widget.cc

Issue 16048003: Fix race between DPI and window size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove semicolon Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, 332 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK,
333 OnViewContextSwapBuffersComplete) 333 OnViewContextSwapBuffersComplete)
334 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) 334 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive)
335 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) 335 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
336 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) 336 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition)
337 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize) 337 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize)
338 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) 338 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
339 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) 339 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted)
340 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) 340 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
341 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) 341 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
342 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged)
343 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) 342 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
344 #if defined(OS_ANDROID) 343 #if defined(OS_ANDROID)
345 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged) 344 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged)
346 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) 345 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded)
347 #endif 346 #endif
348 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot) 347 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot)
349 IPC_MESSAGE_UNHANDLED(handled = false) 348 IPC_MESSAGE_UNHANDLED(handled = false)
350 IPC_END_MESSAGE_MAP() 349 IPC_END_MESSAGE_MAP()
351 return handled; 350 return handled;
352 } 351 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 456 }
458 457
459 // Got a response from the browser after the renderer decided to create a new 458 // Got a response from the browser after the renderer decided to create a new
460 // view. 459 // view.
461 void RenderWidget::OnCreatingNewAck() { 460 void RenderWidget::OnCreatingNewAck() {
462 DCHECK(routing_id_ != MSG_ROUTING_NONE); 461 DCHECK(routing_id_ != MSG_ROUTING_NONE);
463 462
464 CompleteInit(); 463 CompleteInit();
465 } 464 }
466 465
467 void RenderWidget::OnResize(const gfx::Size& new_size, 466 void RenderWidget::OnResize(const ViewMsg_Resize_Params& params) {
468 const gfx::Size& physical_backing_size, 467 screen_info_ = params.screen_info;
469 float overdraw_bottom_height, 468 SetDeviceScaleFactor(screen_info_.deviceScaleFactor);
470 const gfx::Rect& resizer_rect, 469 Resize(params.new_size, params.physical_backing_size,
471 bool is_fullscreen) { 470 params.overdraw_bottom_height, params.resizer_rect,
472 Resize(new_size, physical_backing_size, overdraw_bottom_height, resizer_rect, 471 params.is_fullscreen, SEND_RESIZE_ACK);
473 is_fullscreen, SEND_RESIZE_ACK); 472 size_browser_expects_ = params.new_size;
474 size_browser_expects_ = new_size;
475 } 473 }
476 474
477 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { 475 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) {
478 if (resizer_rect_ != resizer_rect) { 476 if (resizer_rect_ != resizer_rect) {
479 gfx::Rect view_rect(size_); 477 gfx::Rect view_rect(size_);
480 478
481 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); 479 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_);
482 if (!old_damage_rect.IsEmpty()) 480 if (!old_damage_rect.IsEmpty())
483 paint_aggregator_.InvalidateRect(old_damage_rect); 481 paint_aggregator_.InvalidateRect(old_damage_rect);
484 482
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 void RenderWidget::OnSmoothScrollCompleted() { 1944 void RenderWidget::OnSmoothScrollCompleted() {
1947 pending_smooth_scroll_gesture_.Run(); 1945 pending_smooth_scroll_gesture_.Run();
1948 } 1946 }
1949 1947
1950 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { 1948 void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
1951 if (!webwidget_) 1949 if (!webwidget_)
1952 return; 1950 return;
1953 webwidget_->setTextDirection(direction); 1951 webwidget_->setTextDirection(direction);
1954 } 1952 }
1955 1953
1956 void RenderWidget::OnScreenInfoChanged(
1957 const WebKit::WebScreenInfo& screen_info) {
1958 screen_info_ = screen_info;
1959 SetDeviceScaleFactor(screen_info.deviceScaleFactor);
1960 }
1961
1962 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect, 1954 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
1963 const gfx::Rect& window_screen_rect) { 1955 const gfx::Rect& window_screen_rect) {
1964 view_screen_rect_ = view_screen_rect; 1956 view_screen_rect_ = view_screen_rect;
1965 window_screen_rect_ = window_screen_rect; 1957 window_screen_rect_ = window_screen_rect;
1966 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); 1958 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id()));
1967 } 1959 }
1968 1960
1969 #if defined(OS_ANDROID) 1961 #if defined(OS_ANDROID)
1970 void RenderWidget::OnImeBatchStateChanged(bool is_begin) { 1962 void RenderWidget::OnImeBatchStateChanged(bool is_begin) {
1971 Send(new ViewHostMsg_ImeBatchStateChanged_ACK(routing_id(), is_begin)); 1963 Send(new ViewHostMsg_ImeBatchStateChanged_ACK(routing_id(), is_begin));
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 2381
2390 if (!context->Initialize( 2382 if (!context->Initialize(
2391 attributes, 2383 attributes,
2392 false /* bind generates resources */, 2384 false /* bind generates resources */,
2393 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2385 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2394 return NULL; 2386 return NULL;
2395 return context.release(); 2387 return context.release();
2396 } 2388 }
2397 2389
2398 } // namespace content 2390 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698