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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintParams.h" | 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintParams.h" |
60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintScalingOption
.h" | 60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPrintScalingOption
.h" |
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" | 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 63 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
64 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
67 #include "ui/base/range/range.h" | 67 #include "ui/base/range/range.h" |
68 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 68 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 69 #include "ui/gfx/rect_conversions.h" |
69 #include "webkit/plugins/plugin_constants.h" | 70 #include "webkit/plugins/plugin_constants.h" |
70 #include "webkit/plugins/ppapi/common.h" | 71 #include "webkit/plugins/ppapi/common.h" |
71 #include "webkit/plugins/ppapi/event_conversion.h" | 72 #include "webkit/plugins/ppapi/event_conversion.h" |
72 #include "webkit/plugins/ppapi/fullscreen_container.h" | 73 #include "webkit/plugins/ppapi/fullscreen_container.h" |
73 #include "webkit/plugins/ppapi/gfx_conversion.h" | 74 #include "webkit/plugins/ppapi/gfx_conversion.h" |
74 #include "webkit/plugins/ppapi/host_globals.h" | 75 #include "webkit/plugins/ppapi/host_globals.h" |
75 #include "webkit/plugins/ppapi/message_channel.h" | 76 #include "webkit/plugins/ppapi/message_channel.h" |
76 #include "webkit/plugins/ppapi/npapi_glue.h" | 77 #include "webkit/plugins/ppapi/npapi_glue.h" |
77 #include "webkit/plugins/ppapi/plugin_module.h" | 78 #include "webkit/plugins/ppapi/plugin_module.h" |
78 #include "webkit/plugins/ppapi/plugin_object.h" | 79 #include "webkit/plugins/ppapi/plugin_object.h" |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 | 1008 |
1008 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); | 1009 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); |
1009 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. | 1010 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. |
1010 gfx::Rect relative_paint_bounds(paint_bounds); | 1011 gfx::Rect relative_paint_bounds(paint_bounds); |
1011 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); | 1012 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); |
1012 | 1013 |
1013 gfx::Rect pixel_plugin_backing_store_rect( | 1014 gfx::Rect pixel_plugin_backing_store_rect( |
1014 0, 0, image_data->width(), image_data->height()); | 1015 0, 0, image_data->width(), image_data->height()); |
1015 float scale = GetBoundGraphics2D()->GetScale(); | 1016 float scale = GetBoundGraphics2D()->GetScale(); |
1016 gfx::Rect plugin_backing_store_rect = | 1017 gfx::Rect plugin_backing_store_rect = |
1017 pixel_plugin_backing_store_rect.Scale(scale); | 1018 ToEnclosingRect(pixel_plugin_backing_store_rect.Scale(scale)); |
1018 | 1019 |
1019 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); | 1020 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); |
1020 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); | 1021 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
1021 if (!plugin_paint_rect.Contains(relative_paint_bounds)) | 1022 if (!plugin_paint_rect.Contains(relative_paint_bounds)) |
1022 return false; | 1023 return false; |
1023 | 1024 |
1024 // Don't do optimized painting if the area to paint intersects with the | 1025 // Don't do optimized painting if the area to paint intersects with the |
1025 // cut-out rects, otherwise we will paint over them. | 1026 // cut-out rects, otherwise we will paint over them. |
1026 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); | 1027 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); |
1027 iter != cut_outs_rects_.end(); ++iter) { | 1028 iter != cut_outs_rects_.end(); ++iter) { |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 screen_size_for_fullscreen_ = gfx::Size(); | 2684 screen_size_for_fullscreen_ = gfx::Size(); |
2684 WebElement element = container_->element(); | 2685 WebElement element = container_->element(); |
2685 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2686 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2686 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2687 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2687 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2688 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2688 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2689 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2689 } | 2690 } |
2690 | 2691 |
2691 } // namespace ppapi | 2692 } // namespace ppapi |
2692 } // namespace webkit | 2693 } // namespace webkit |
OLD | NEW |