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

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

Issue 1844013002: Fix main thread top controls scrolling to mirror CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@propertyTreesBoundsDelta
Patch Set: Let ResizeWebWidget decide whether to resize Created 4 years, 8 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 // 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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 page_id_(-1), 620 page_id_(-1),
621 next_page_id_(params.next_page_id), 621 next_page_id_(params.next_page_id),
622 history_list_offset_(-1), 622 history_list_offset_(-1),
623 history_list_length_(0), 623 history_list_length_(0),
624 frames_in_progress_(0), 624 frames_in_progress_(0),
625 target_url_status_(TARGET_NONE), 625 target_url_status_(TARGET_NONE),
626 uses_temporary_zoom_level_(false), 626 uses_temporary_zoom_level_(false),
627 #if defined(OS_ANDROID) 627 #if defined(OS_ANDROID)
628 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), 628 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH),
629 #endif 629 #endif
630 top_controls_shrink_blink_size_(false),
631 top_controls_height_(0.f),
630 has_focus_(false), 632 has_focus_(false),
631 has_scrolled_focused_editable_node_into_rect_(false), 633 has_scrolled_focused_editable_node_into_rect_(false),
632 main_render_frame_(nullptr), 634 main_render_frame_(nullptr),
633 frame_widget_(nullptr), 635 frame_widget_(nullptr),
634 speech_recognition_dispatcher_(NULL), 636 speech_recognition_dispatcher_(NULL),
635 mouse_lock_dispatcher_(NULL), 637 mouse_lock_dispatcher_(NULL),
636 #if defined(OS_ANDROID) 638 #if defined(OS_ANDROID)
637 expected_content_intent_id_(0), 639 expected_content_intent_id_(0),
638 #endif 640 #endif
639 #if defined(ENABLE_PLUGINS) 641 #if defined(ENABLE_PLUGINS)
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 // TODO(port): we don't support theming on non-Windows platforms yet 2593 // TODO(port): we don't support theming on non-Windows platforms yet
2592 NOTIMPLEMENTED(); 2594 NOTIMPLEMENTED();
2593 #endif 2595 #endif
2594 } 2596 }
2595 2597
2596 void RenderViewImpl::OnMoveOrResizeStarted() { 2598 void RenderViewImpl::OnMoveOrResizeStarted() {
2597 if (webview()) 2599 if (webview())
2598 webview()->hidePopups(); 2600 webview()->hidePopups();
2599 } 2601 }
2600 2602
2603 void RenderViewImpl::ResizeWebWidget(const ResizeParams& params) {
2604 bool resized = size_ != params.new_size ||
2605 physical_backing_size_ != params.physical_backing_size ||
2606 top_controls_height_ != params.top_controls_height;
2607
2608 size_ = params.new_size;
2609 physical_backing_size_ = params.physical_backing_size;
2610 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size;
2611 top_controls_height_ = params.top_controls_height;
2612
2613 gfx::Size new_widget_size = size_;
2614 if (IsUseZoomForDSFEnabled()) {
2615 new_widget_size = gfx::ScaleToCeiledSize(new_widget_size,
2616 GetOriginalDeviceScaleFactor());
2617 }
2618
2619 if (resized)
2620 webview()->resizeWithTopControls(new_widget_size,
2621 top_controls_height_,
2622 top_controls_shrink_blink_size_);
2623 }
2624
2601 void RenderViewImpl::OnResize(const ResizeParams& params) { 2625 void RenderViewImpl::OnResize(const ResizeParams& params) {
2602 TRACE_EVENT0("renderer", "RenderViewImpl::OnResize"); 2626 TRACE_EVENT0("renderer", "RenderViewImpl::OnResize");
2603 if (webview()) { 2627 if (webview()) {
2604 webview()->hidePopups(); 2628 webview()->hidePopups();
2605 if (send_preferred_size_changes_) { 2629 if (send_preferred_size_changes_) {
2606 webview()->mainFrame()->setCanHaveScrollbars( 2630 webview()->mainFrame()->setCanHaveScrollbars(
2607 ShouldDisplayScrollbars(params.new_size.width(), 2631 ShouldDisplayScrollbars(params.new_size.width(),
2608 params.new_size.height())); 2632 params.new_size.height()));
2609 } 2633 }
2610 if (display_mode_ != params.display_mode) { 2634 if (display_mode_ != params.display_mode) {
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 if (IsUseZoomForDSFEnabled()) { 3347 if (IsUseZoomForDSFEnabled()) {
3324 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); 3348 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3325 } else { 3349 } else {
3326 webview()->setDeviceScaleFactor(device_scale_factor_); 3350 webview()->setDeviceScaleFactor(device_scale_factor_);
3327 } 3351 }
3328 webview()->settings()->setPreferCompositingToLCDTextEnabled( 3352 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3329 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 3353 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3330 } 3354 }
3331 3355
3332 } // namespace content 3356 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698