OLD | NEW |
---|---|
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 Loading... | |
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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2608 params.new_size.height())); | 2610 params.new_size.height())); |
2609 } | 2611 } |
2610 if (display_mode_ != params.display_mode) { | 2612 if (display_mode_ != params.display_mode) { |
2611 display_mode_ = params.display_mode; | 2613 display_mode_ = params.display_mode; |
2612 webview()->setDisplayMode(display_mode_); | 2614 webview()->setDisplayMode(display_mode_); |
2613 } | 2615 } |
2614 } | 2616 } |
2615 | 2617 |
2616 gfx::Size old_visible_viewport_size = visible_viewport_size_; | 2618 gfx::Size old_visible_viewport_size = visible_viewport_size_; |
2617 | 2619 |
2620 if (top_controls_height_ || params.top_controls_height) { | |
2621 // When top controls are present, we need to resize the Blink widget and | |
2622 // change the top controls height at the same time to prevent the viewport | |
2623 // from changing scroll offset due to a clamp in between the two operations. | |
2624 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size; | |
2625 top_controls_height_ = params.top_controls_height; | |
2626 gfx::Size new_view_size = params.new_size; | |
2627 if (IsUseZoomForDSFEnabled()) { | |
2628 new_view_size = gfx::ScaleToCeiledSize(new_view_size, | |
2629 GetOriginalDeviceScaleFactor()); | |
2630 } | |
2631 webview()->resizeWithTopControls(new_view_size, | |
no sievers
2016/04/08 19:26:02
webview() is null-checked everywhere else in OnRes
bokan
2016/04/11 19:54:15
This is gone now in addressing the comment below.
| |
2632 top_controls_height_, | |
no sievers
2016/04/08 19:26:02
I find it slightly weird that we end up calling re
bokan
2016/04/11 19:54:15
I moved it since we didn't want this method to exi
| |
2633 top_controls_shrink_blink_size_); | |
2634 } | |
2635 | |
2618 RenderWidget::OnResize(params); | 2636 RenderWidget::OnResize(params); |
2619 | 2637 |
2620 if (old_visible_viewport_size != visible_viewport_size_) | 2638 if (old_visible_viewport_size != visible_viewport_size_) |
2621 has_scrolled_focused_editable_node_into_rect_ = false; | 2639 has_scrolled_focused_editable_node_into_rect_ = false; |
2622 } | 2640 } |
2623 | 2641 |
2624 void RenderViewImpl::RenderWidgetDidCommitAndDrawCompositorFrame() { | 2642 void RenderViewImpl::RenderWidgetDidCommitAndDrawCompositorFrame() { |
2625 #if defined(ENABLE_PLUGINS) | 2643 #if defined(ENABLE_PLUGINS) |
2626 // Notify all instances that we painted. The same caveats apply as for | 2644 // Notify all instances that we painted. The same caveats apply as for |
2627 // ViewFlushedPaint regarding instances closing themselves, so we take | 2645 // ViewFlushedPaint regarding instances closing themselves, so we take |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3323 if (IsUseZoomForDSFEnabled()) { | 3341 if (IsUseZoomForDSFEnabled()) { |
3324 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3342 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3325 } else { | 3343 } else { |
3326 webview()->setDeviceScaleFactor(device_scale_factor_); | 3344 webview()->setDeviceScaleFactor(device_scale_factor_); |
3327 } | 3345 } |
3328 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3346 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3329 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3347 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3330 } | 3348 } |
3331 | 3349 |
3332 } // namespace content | 3350 } // namespace content |
OLD | NEW |