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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 gfx::Rect* clip) { | 846 gfx::Rect* clip) { |
847 if (!always_on_top_) | 847 if (!always_on_top_) |
848 return false; | 848 return false; |
849 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) | 849 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) |
850 return false; | 850 return false; |
851 | 851 |
852 // We specifically want to compare against the area covered by the backing | 852 // We specifically want to compare against the area covered by the backing |
853 // store when seeing if we cover the given paint bounds, since the backing | 853 // store when seeing if we cover the given paint bounds, since the backing |
854 // store could be smaller than the declared plugin area. | 854 // store could be smaller than the declared plugin area. |
855 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); | 855 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); |
| 856 // ImageDatas created by NaCl don't have a PlatformImage, so can't be |
| 857 // optimized this way. |
| 858 if (!image_data->PlatformImage()) |
| 859 return false; |
856 gfx::Rect plugin_backing_store_rect( | 860 gfx::Rect plugin_backing_store_rect( |
857 PP_ToGfxPoint(view_data_.rect.point), | 861 PP_ToGfxPoint(view_data_.rect.point), |
858 gfx::Size(image_data->width(), image_data->height())); | 862 gfx::Size(image_data->width(), image_data->height())); |
859 | 863 |
860 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); | 864 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); |
861 clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); | 865 clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); |
862 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); | 866 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
863 if (!plugin_paint_rect.Contains(paint_bounds)) | 867 if (!plugin_paint_rect.Contains(paint_bounds)) |
864 return false; | 868 return false; |
865 | 869 |
866 *dib = image_data->platform_image()->GetTransportDIB(); | 870 *dib = image_data->PlatformImage()->GetTransportDIB(); |
867 *location = plugin_backing_store_rect; | 871 *location = plugin_backing_store_rect; |
868 *clip = clip_page; | 872 *clip = clip_page; |
869 return true; | 873 return true; |
870 } | 874 } |
871 | 875 |
872 string16 PluginInstance::GetSelectedText(bool html) { | 876 string16 PluginInstance::GetSelectedText(bool html) { |
873 // Keep a reference on the stack. See NOTE above. | 877 // Keep a reference on the stack. See NOTE above. |
874 scoped_refptr<PluginInstance> ref(this); | 878 scoped_refptr<PluginInstance> ref(this); |
875 if (!LoadSelectionInterface()) | 879 if (!LoadSelectionInterface()) |
876 return string16(); | 880 return string16(); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 screen_size_for_fullscreen_ = gfx::Size(); | 2228 screen_size_for_fullscreen_ = gfx::Size(); |
2225 WebElement element = container_->element(); | 2229 WebElement element = container_->element(); |
2226 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2230 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2227 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2231 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2228 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2232 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2229 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2233 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2230 } | 2234 } |
2231 | 2235 |
2232 } // namespace ppapi | 2236 } // namespace ppapi |
2233 } // namespace webkit | 2237 } // namespace webkit |
OLD | NEW |