Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 1969083002: Scale tickmark's coordinates to dip to viewport in use-zoom-for-dfs mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bit_cast.h" 10 #include "base/bit_cast.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include "third_party/WebKit/public/web/WebPluginScriptForbiddenScope.h" 112 #include "third_party/WebKit/public/web/WebPluginScriptForbiddenScope.h"
113 #include "third_party/WebKit/public/web/WebPrintParams.h" 113 #include "third_party/WebKit/public/web/WebPrintParams.h"
114 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" 114 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
115 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 115 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
116 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 116 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
117 #include "third_party/WebKit/public/web/WebScriptSource.h" 117 #include "third_party/WebKit/public/web/WebScriptSource.h"
118 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 118 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
119 #include "third_party/WebKit/public/web/WebView.h" 119 #include "third_party/WebKit/public/web/WebView.h"
120 #include "third_party/khronos/GLES2/gl2.h" 120 #include "third_party/khronos/GLES2/gl2.h"
121 #include "ui/events/blink/blink_event_util.h" 121 #include "ui/events/blink/blink_event_util.h"
122 #include "ui/gfx/geometry/rect_conversions.h"
122 #include "ui/gfx/image/image_skia.h" 123 #include "ui/gfx/image/image_skia.h"
123 #include "ui/gfx/image/image_skia_rep.h" 124 #include "ui/gfx/image/image_skia_rep.h"
124 #include "ui/gfx/range/range.h" 125 #include "ui/gfx/range/range.h"
125 #include "url/origin.h" 126 #include "url/origin.h"
126 #include "v8/include/v8.h" 127 #include "v8/include/v8.h"
127 128
128 #if defined(ENABLE_PRINTING) 129 #if defined(ENABLE_PRINTING)
129 // nogncheck because dependency on //printing is conditional upon 130 // nogncheck because dependency on //printing is conditional upon
130 // enable_basic_printing or enable_print_preview flags. 131 // enable_basic_printing or enable_print_preview flags.
131 #include "printing/metafile_skia_wrapper.h" // nogncheck 132 #include "printing/metafile_skia_wrapper.h" // nogncheck
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 2592
2592 void PepperPluginInstanceImpl::SetTickmarks(PP_Instance instance, 2593 void PepperPluginInstanceImpl::SetTickmarks(PP_Instance instance,
2593 const PP_Rect* tickmarks, 2594 const PP_Rect* tickmarks,
2594 uint32_t count) { 2595 uint32_t count) {
2595 if (!render_frame_ || !render_frame_->GetWebFrame()) 2596 if (!render_frame_ || !render_frame_->GetWebFrame())
2596 return; 2597 return;
2597 2598
2598 blink::WebVector<blink::WebRect> tickmarks_converted( 2599 blink::WebVector<blink::WebRect> tickmarks_converted(
2599 static_cast<size_t>(count)); 2600 static_cast<size_t>(count));
2600 for (uint32_t i = 0; i < count; ++i) { 2601 for (uint32_t i = 0; i < count; ++i) {
2601 tickmarks_converted[i] = blink::WebRect(tickmarks[i].point.x, 2602 gfx::RectF tickmark(tickmarks[i].point.x,
2602 tickmarks[i].point.y, 2603 tickmarks[i].point.y,
2603 tickmarks[i].size.width, 2604 tickmarks[i].size.width,
2604 tickmarks[i].size.height); 2605 tickmarks[i].size.height);
2606 tickmark.Scale(1 / viewport_to_dip_scale_);
2607 tickmarks_converted[i] = blink::WebRect(gfx::ToEnclosedRect(tickmark));
2605 } 2608 }
2606 blink::WebLocalFrame* frame = render_frame_->GetWebFrame(); 2609 blink::WebLocalFrame* frame = render_frame_->GetWebFrame();
2607 frame->setTickmarks(tickmarks_converted); 2610 frame->setTickmarks(tickmarks_converted);
2608 } 2611 }
2609 2612
2610 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) { 2613 PP_Bool PepperPluginInstanceImpl::IsFullscreen(PP_Instance instance) {
2611 return PP_FromBool(view_data_.is_fullscreen); 2614 return PP_FromBool(view_data_.is_fullscreen);
2612 } 2615 }
2613 2616
2614 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance, 2617 PP_Bool PepperPluginInstanceImpl::SetFullscreen(PP_Instance instance,
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 } 3343 }
3341 3344
3342 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { 3345 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const {
3343 rect->set_x(rect->x() / viewport_to_dip_scale_); 3346 rect->set_x(rect->x() / viewport_to_dip_scale_);
3344 rect->set_y(rect->y() / viewport_to_dip_scale_); 3347 rect->set_y(rect->y() / viewport_to_dip_scale_);
3345 rect->set_width(rect->width() / viewport_to_dip_scale_); 3348 rect->set_width(rect->width() / viewport_to_dip_scale_);
3346 rect->set_height(rect->height() / viewport_to_dip_scale_); 3349 rect->set_height(rect->height() / viewport_to_dip_scale_);
3347 } 3350 }
3348 3351
3349 } // namespace content 3352 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698