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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 | 1595 |
1596 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { | 1596 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { |
1597 RenderWidget* widget = RenderWidget::Create(GetRoutingID(), compositor_deps_, | 1597 RenderWidget* widget = RenderWidget::Create(GetRoutingID(), compositor_deps_, |
1598 popup_type, screen_info_); | 1598 popup_type, screen_info_); |
1599 if (!widget) | 1599 if (!widget) |
1600 return NULL; | 1600 return NULL; |
1601 if (screen_metrics_emulator_) { | 1601 if (screen_metrics_emulator_) { |
1602 widget->SetPopupOriginAdjustmentsForEmulation( | 1602 widget->SetPopupOriginAdjustmentsForEmulation( |
1603 screen_metrics_emulator_.get()); | 1603 screen_metrics_emulator_.get()); |
1604 } | 1604 } |
1605 return widget->webwidget(); | 1605 return widget->GetWebWidget(); |
1606 } | 1606 } |
1607 | 1607 |
1608 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { | 1608 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace() { |
1609 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 1609 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
1610 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1610 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
1611 } | 1611 } |
1612 | 1612 |
1613 void RenderViewImpl::printPage(WebLocalFrame* frame) { | 1613 void RenderViewImpl::printPage(WebLocalFrame* frame) { |
1614 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 1614 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
1615 PrintPage(frame, input_handler().handling_input_event())); | 1615 PrintPage(frame, input_handler().handling_input_event())); |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 frame_widget_->setIsTransparent(!opaque); | 2556 frame_widget_->setIsTransparent(!opaque); |
2557 if (compositor_) | 2557 if (compositor_) |
2558 compositor_->setHasTransparentBackground(!opaque); | 2558 compositor_->setHasTransparentBackground(!opaque); |
2559 } | 2559 } |
2560 | 2560 |
2561 void RenderViewImpl::OnSetActive(bool active) { | 2561 void RenderViewImpl::OnSetActive(bool active) { |
2562 if (webview()) | 2562 if (webview()) |
2563 webview()->setIsActive(active); | 2563 webview()->setIsActive(active); |
2564 } | 2564 } |
2565 | 2565 |
| 2566 blink::WebWidget* RenderViewImpl::GetWebWidget() const { |
| 2567 if (frame_widget_) |
| 2568 return frame_widget_; |
| 2569 |
| 2570 return RenderWidget::GetWebWidget(); |
| 2571 } |
| 2572 |
2566 void RenderViewImpl::CloseForFrame() { | 2573 void RenderViewImpl::CloseForFrame() { |
2567 DCHECK(frame_widget_); | 2574 DCHECK(frame_widget_); |
2568 frame_widget_->close(); | 2575 frame_widget_->close(); |
2569 frame_widget_ = nullptr; | 2576 frame_widget_ = nullptr; |
2570 } | 2577 } |
2571 | 2578 |
2572 void RenderViewImpl::Close() { | 2579 void RenderViewImpl::Close() { |
2573 // We need to grab a pointer to the doomed WebView before we destroy it. | 2580 // We need to grab a pointer to the doomed WebView before we destroy it. |
2574 WebView* doomed = webview_; | 2581 WebView* doomed = webview_; |
2575 RenderWidget::Close(); | 2582 RenderWidget::Close(); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2859 | 2866 |
2860 // TODO(trchen): Cleanup the device scale factor mess. | 2867 // TODO(trchen): Cleanup the device scale factor mess. |
2861 // device scale will be applied in WebKit | 2868 // device scale will be applied in WebKit |
2862 // --> zoom_rect doesn't include device scale, | 2869 // --> zoom_rect doesn't include device scale, |
2863 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 2870 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
2864 canvas.scale(new_total_scale / device_scale_factor_, | 2871 canvas.scale(new_total_scale / device_scale_factor_, |
2865 new_total_scale / device_scale_factor_); | 2872 new_total_scale / device_scale_factor_); |
2866 canvas.translate(-zoom_rect.x() * device_scale_factor_, | 2873 canvas.translate(-zoom_rect.x() * device_scale_factor_, |
2867 -zoom_rect.y() * device_scale_factor_); | 2874 -zoom_rect.y() * device_scale_factor_); |
2868 | 2875 |
2869 DCHECK(webwidget_->isAcceleratedCompositingActive()); | 2876 DCHECK(webview_->isAcceleratedCompositingActive()); |
2870 webwidget_->paintIgnoringCompositing(&canvas, zoom_rect); | 2877 webview_->paintIgnoringCompositing(&canvas, zoom_rect); |
2871 } | 2878 } |
2872 | 2879 |
2873 gfx::Rect zoom_rect_in_screen = | 2880 gfx::Rect zoom_rect_in_screen = |
2874 zoom_rect - gfx::Vector2d(inner_viewport_offset.width, | 2881 zoom_rect - gfx::Vector2d(inner_viewport_offset.width, |
2875 inner_viewport_offset.height); | 2882 inner_viewport_offset.height); |
2876 | 2883 |
2877 gfx::Rect physical_window_zoom_rect = gfx::ToEnclosingRect( | 2884 gfx::Rect physical_window_zoom_rect = gfx::ToEnclosingRect( |
2878 ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect_in_screen))); | 2885 ClientRectToPhysicalWindowRect(gfx::RectF(zoom_rect_in_screen))); |
2879 | 2886 |
2880 Send(new ViewHostMsg_ShowDisambiguationPopup( | 2887 Send(new ViewHostMsg_ShowDisambiguationPopup( |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 return render_frame->focused_pepper_plugin(); | 3020 return render_frame->focused_pepper_plugin(); |
3014 } | 3021 } |
3015 frame = frame->traverseNext(false); | 3022 frame = frame->traverseNext(false); |
3016 } | 3023 } |
3017 | 3024 |
3018 return nullptr; | 3025 return nullptr; |
3019 } | 3026 } |
3020 #endif | 3027 #endif |
3021 | 3028 |
3022 } // namespace content | 3029 } // namespace content |
OLD | NEW |