| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_plugin_instance.h" | 5 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 if (!bound_graphics_2d_ || !bound_graphics_2d_->is_always_opaque()) | 575 if (!bound_graphics_2d_ || !bound_graphics_2d_->is_always_opaque()) |
| 576 return false; | 576 return false; |
| 577 | 577 |
| 578 // We specifically want to compare against the area covered by the backing | 578 // We specifically want to compare against the area covered by the backing |
| 579 // store when seeing if we cover the given paint bounds, since the backing | 579 // store when seeing if we cover the given paint bounds, since the backing |
| 580 // store could be smaller than the declared plugin area. | 580 // store could be smaller than the declared plugin area. |
| 581 ImageData* image_data = bound_graphics_2d_->image_data(); | 581 ImageData* image_data = bound_graphics_2d_->image_data(); |
| 582 gfx::Rect plugin_backing_store_rect(position_.origin(), | 582 gfx::Rect plugin_backing_store_rect(position_.origin(), |
| 583 gfx::Size(image_data->width(), | 583 gfx::Size(image_data->width(), |
| 584 image_data->height())); | 584 image_data->height())); |
| 585 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_); | 585 gfx::Rect clip_page(clip_); |
| 586 clip_page.Offset(position_.origin()); |
| 587 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
| 586 if (!plugin_paint_rect.Contains(paint_bounds)) | 588 if (!plugin_paint_rect.Contains(paint_bounds)) |
| 587 return false; | 589 return false; |
| 588 | 590 |
| 589 *dib = image_data->platform_image()->GetTransportDIB(); | 591 *dib = image_data->platform_image()->GetTransportDIB(); |
| 590 *location = plugin_backing_store_rect; | 592 *location = plugin_backing_store_rect; |
| 591 *clip = clip_; | 593 *clip = clip_page; |
| 592 return true; | 594 return true; |
| 593 } | 595 } |
| 594 | 596 |
| 595 string16 PluginInstance::GetSelectedText(bool html) { | 597 string16 PluginInstance::GetSelectedText(bool html) { |
| 596 if (!LoadSelectionInterface()) | 598 if (!LoadSelectionInterface()) |
| 597 return string16(); | 599 return string16(); |
| 598 | 600 |
| 599 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), html); | 601 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), html); |
| 600 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); | 602 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); |
| 601 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. | 603 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 bounds.size.width = dest_rect.width(); | 1086 bounds.size.width = dest_rect.width(); |
| 1085 bounds.size.height = dest_rect.height(); | 1087 bounds.size.height = dest_rect.height(); |
| 1086 | 1088 |
| 1087 CGContextDrawImage(canvas, bounds, image); | 1089 CGContextDrawImage(canvas, bounds, image); |
| 1088 CGContextRestoreGState(canvas); | 1090 CGContextRestoreGState(canvas); |
| 1089 } | 1091 } |
| 1090 #endif // defined(OS_MACOSX) | 1092 #endif // defined(OS_MACOSX) |
| 1091 | 1093 |
| 1092 | 1094 |
| 1093 } // namespace pepper | 1095 } // namespace pepper |
| OLD | NEW |