| 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 if (GetBoundGraphics2D()) | 868 if (GetBoundGraphics2D()) |
| 869 GetBoundGraphics2D()->ViewFlushedPaint(); | 869 GetBoundGraphics2D()->ViewFlushedPaint(); |
| 870 else if (GetBoundGraphics3D()) | 870 else if (GetBoundGraphics3D()) |
| 871 GetBoundGraphics3D()->ViewFlushedPaint(); | 871 GetBoundGraphics3D()->ViewFlushedPaint(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 bool PluginInstance::GetBitmapForOptimizedPluginPaint( | 874 bool PluginInstance::GetBitmapForOptimizedPluginPaint( |
| 875 const gfx::Rect& paint_bounds, | 875 const gfx::Rect& paint_bounds, |
| 876 TransportDIB** dib, | 876 TransportDIB** dib, |
| 877 gfx::Rect* location, | 877 gfx::Rect* location, |
| 878 gfx::Rect* clip) { | 878 gfx::Rect* clip, |
| 879 float* scale_factor) { |
| 879 if (!always_on_top_) | 880 if (!always_on_top_) |
| 880 return false; | 881 return false; |
| 881 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) | 882 if (!GetBoundGraphics2D() || !GetBoundGraphics2D()->is_always_opaque()) |
| 882 return false; | 883 return false; |
| 883 | 884 |
| 884 // We specifically want to compare against the area covered by the backing | 885 // We specifically want to compare against the area covered by the backing |
| 885 // store when seeing if we cover the given paint bounds, since the backing | 886 // store when seeing if we cover the given paint bounds, since the backing |
| 886 // store could be smaller than the declared plugin area. | 887 // store could be smaller than the declared plugin area. |
| 887 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); | 888 PPB_ImageData_Impl* image_data = GetBoundGraphics2D()->image_data(); |
| 888 // ImageDatas created by NaCl don't have a PlatformImage, so can't be | 889 // ImageDatas created by NaCl don't have a PlatformImage, so can't be |
| 889 // optimized this way. | 890 // optimized this way. |
| 890 if (!image_data->PlatformImage()) | 891 if (!image_data->PlatformImage()) |
| 891 return false; | 892 return false; |
| 892 gfx::Rect plugin_backing_store_rect( | 893 gfx::Rect plugin_backing_store_rect( |
| 893 PP_ToGfxPoint(view_data_.rect.point), | 894 PP_ToGfxPoint(view_data_.rect.point), |
| 894 gfx::Size(image_data->width(), image_data->height())); | 895 gfx::Size(image_data->width(), image_data->height())); |
| 895 | 896 |
| 896 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); | 897 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); |
| 897 clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); | 898 clip_page.Offset(PP_ToGfxPoint(view_data_.rect.point)); |
| 898 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); | 899 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
| 899 if (!plugin_paint_rect.Contains(paint_bounds)) | 900 if (!plugin_paint_rect.Contains(paint_bounds)) |
| 900 return false; | 901 return false; |
| 901 | 902 |
| 902 *dib = image_data->PlatformImage()->GetTransportDIB(); | 903 *dib = image_data->PlatformImage()->GetTransportDIB(); |
| 903 *location = plugin_backing_store_rect; | 904 *location = plugin_backing_store_rect; |
| 904 *clip = clip_page; | 905 *clip = clip_page; |
| 906 *scale_factor = GetBoundGraphics2D()->GetScale(); |
| 905 return true; | 907 return true; |
| 906 } | 908 } |
| 907 | 909 |
| 908 string16 PluginInstance::GetSelectedText(bool html) { | 910 string16 PluginInstance::GetSelectedText(bool html) { |
| 909 // Keep a reference on the stack. See NOTE above. | 911 // Keep a reference on the stack. See NOTE above. |
| 910 scoped_refptr<PluginInstance> ref(this); | 912 scoped_refptr<PluginInstance> ref(this); |
| 911 if (!LoadSelectionInterface()) | 913 if (!LoadSelectionInterface()) |
| 912 return string16(); | 914 return string16(); |
| 913 | 915 |
| 914 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), | 916 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 screen_size_for_fullscreen_ = gfx::Size(); | 2426 screen_size_for_fullscreen_ = gfx::Size(); |
| 2425 WebElement element = container_->element(); | 2427 WebElement element = container_->element(); |
| 2426 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2428 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2427 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2429 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2428 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2430 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2429 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2431 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2430 } | 2432 } |
| 2431 | 2433 |
| 2432 } // namespace ppapi | 2434 } // namespace ppapi |
| 2433 } // namespace webkit | 2435 } // namespace webkit |
| OLD | NEW |