OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/npapi/webview_plugin.h" | 5 #include "webkit/plugins/npapi/webview_plugin.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (paintRect.IsEmpty()) | 121 if (paintRect.IsEmpty()) |
122 return; | 122 return; |
123 | 123 |
124 paintRect.Offset(-rect_.x(), -rect_.y()); | 124 paintRect.Offset(-rect_.x(), -rect_.y()); |
125 | 125 |
126 #if WEBKIT_USING_CG | 126 #if WEBKIT_USING_CG |
127 CGContextRef context = canvas; | 127 CGContextRef context = canvas; |
128 CGContextTranslateCTM(context, rect_.x(), rect_.y()); | 128 CGContextTranslateCTM(context, rect_.x(), rect_.y()); |
129 CGContextSaveGState(context); | 129 CGContextSaveGState(context); |
130 #elif WEBKIT_USING_SKIA | 130 #elif WEBKIT_USING_SKIA |
131 skia::PlatformCanvas* platform_canvas = canvas; | 131 canvas->translate(SkIntToScalar(rect_.x()), SkIntToScalar(rect_.y())); |
132 platform_canvas->translate(SkIntToScalar(rect_.x()), | 132 canvas->save(); |
133 SkIntToScalar(rect_.y())); | |
134 platform_canvas->save(); | |
135 #endif | 133 #endif |
136 | 134 |
137 web_view_->layout(); | 135 web_view_->layout(); |
138 web_view_->paint(canvas, paintRect); | 136 web_view_->paint(canvas, paintRect); |
139 | 137 |
140 #if WEBKIT_USING_SKIA | 138 #if WEBKIT_USING_SKIA |
141 platform_canvas->restore(); | 139 canvas->restore(); |
142 #elif WEBKIT_USING_CG | 140 #elif WEBKIT_USING_CG |
143 CGContextRestoreGState(context); | 141 CGContextRestoreGState(context); |
144 #endif | 142 #endif |
145 } | 143 } |
146 | 144 |
147 // Coordinates are relative to the containing window. | 145 // Coordinates are relative to the containing window. |
148 void WebViewPlugin::updateGeometry( | 146 void WebViewPlugin::updateGeometry( |
149 const WebRect& frame_rect, const WebRect& clip_rect, | 147 const WebRect& frame_rect, const WebRect& clip_rect, |
150 const WebVector<WebRect>& cut_out_rects, bool is_visible) { | 148 const WebVector<WebRect>& cut_out_rects, bool is_visible) { |
151 if (frame_rect != rect_) { | 149 if (frame_rect != rect_) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 240 } |
243 | 241 |
244 void WebViewPlugin::didReceiveResponse(WebFrame* frame, | 242 void WebViewPlugin::didReceiveResponse(WebFrame* frame, |
245 unsigned identifier, | 243 unsigned identifier, |
246 const WebURLResponse& response) { | 244 const WebURLResponse& response) { |
247 WebFrameClient::didReceiveResponse(frame, identifier, response); | 245 WebFrameClient::didReceiveResponse(frame, identifier, response); |
248 } | 246 } |
249 | 247 |
250 } // namespace npapi | 248 } // namespace npapi |
251 } // namespace webkit | 249 } // namespace webkit |
OLD | NEW |