| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 browser_controls_shrink_blink_size_ = | 2513 browser_controls_shrink_blink_size_ = |
| 2514 params.browser_controls_shrink_blink_size; | 2514 params.browser_controls_shrink_blink_size; |
| 2515 top_controls_height_ = params.top_controls_height; | 2515 top_controls_height_ = params.top_controls_height; |
| 2516 | 2516 |
| 2517 RenderWidget::OnResize(params); | 2517 RenderWidget::OnResize(params); |
| 2518 | 2518 |
| 2519 if (old_visible_viewport_size != visible_viewport_size_) | 2519 if (old_visible_viewport_size != visible_viewport_size_) |
| 2520 has_scrolled_focused_editable_node_into_rect_ = false; | 2520 has_scrolled_focused_editable_node_into_rect_ = false; |
| 2521 } | 2521 } |
| 2522 | 2522 |
| 2523 void RenderViewImpl::RenderWidgetDidFlushPaint() { | |
| 2524 // If the RenderWidget is closing down then early-exit, otherwise we'll crash. | |
| 2525 // See crbug.com/112921. | |
| 2526 if (!webview()) | |
| 2527 return; | |
| 2528 | |
| 2529 WebFrame* main_frame = webview()->mainFrame(); | |
| 2530 for (WebFrame* frame = main_frame; frame; frame = frame->traverseNext()) { | |
| 2531 // TODO(nasko): This is a hack for the case in which the top-level | |
| 2532 // frame is being rendered in another process. It will not | |
| 2533 // behave correctly for out of process iframes. | |
| 2534 if (frame->isWebLocalFrame()) { | |
| 2535 main_frame = frame; | |
| 2536 break; | |
| 2537 } | |
| 2538 } | |
| 2539 | |
| 2540 // There's nothing to do if there are no local frames in this RenderView's | |
| 2541 // frame tree. This can happen if DidFlushPaint is called after the | |
| 2542 // RenderView's local main frame is swapped to a remote frame. See | |
| 2543 // http://crbug.com/513552. | |
| 2544 if (main_frame->isWebRemoteFrame()) | |
| 2545 return; | |
| 2546 | |
| 2547 // If we have a provisional frame we are between the start and commit stages | |
| 2548 // of loading and we don't want to save stats. | |
| 2549 if (!main_frame->provisionalDataSource()) { | |
| 2550 WebDataSource* ds = main_frame->dataSource(); | |
| 2551 if (!ds) | |
| 2552 return; | |
| 2553 | |
| 2554 DocumentState* document_state = DocumentState::FromDataSource(ds); | |
| 2555 | |
| 2556 // TODO(jar): The following code should all be inside a method, probably in | |
| 2557 // NavigatorState. | |
| 2558 Time now = Time::Now(); | |
| 2559 if (document_state->first_paint_time().is_null()) { | |
| 2560 document_state->set_first_paint_time(now); | |
| 2561 } | |
| 2562 if (document_state->first_paint_after_load_time().is_null() && | |
| 2563 !document_state->finish_load_time().is_null()) { | |
| 2564 document_state->set_first_paint_after_load_time(now); | |
| 2565 } | |
| 2566 } | |
| 2567 } | |
| 2568 | |
| 2569 void RenderViewImpl::OnClearFocusedElement() { | 2523 void RenderViewImpl::OnClearFocusedElement() { |
| 2570 if (webview()) | 2524 if (webview()) |
| 2571 webview()->clearFocusedElement(); | 2525 webview()->clearFocusedElement(); |
| 2572 } | 2526 } |
| 2573 | 2527 |
| 2574 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { | 2528 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { |
| 2575 if (frame_widget_) | 2529 if (frame_widget_) |
| 2576 frame_widget_->setIsTransparent(!opaque); | 2530 frame_widget_->setIsTransparent(!opaque); |
| 2577 if (compositor_) | 2531 if (compositor_) |
| 2578 compositor_->setHasTransparentBackground(!opaque); | 2532 compositor_->setHasTransparentBackground(!opaque); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 NotifyInputEventHandled(input_event->type, | 2994 NotifyInputEventHandled(input_event->type, |
| 3041 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2995 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3042 } | 2996 } |
| 3043 | 2997 |
| 3044 std::unique_ptr<InputEventAck> ack( | 2998 std::unique_ptr<InputEventAck> ack( |
| 3045 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2999 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 3046 OnInputEventAck(std::move(ack)); | 3000 OnInputEventAck(std::move(ack)); |
| 3047 } | 3001 } |
| 3048 | 3002 |
| 3049 } // namespace content | 3003 } // namespace content |
| OLD | NEW |