OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 void WebPluginContainerImpl::paint(GraphicsContext* context, const IntRect& rect
) | 112 void WebPluginContainerImpl::paint(GraphicsContext* context, const IntRect& rect
) |
113 { | 113 { |
114 if (!parent()) | 114 if (!parent()) |
115 return; | 115 return; |
116 | 116 |
117 // Don't paint anything if the plugin doesn't intersect. | 117 // Don't paint anything if the plugin doesn't intersect. |
118 if (!frameRect().intersects(rect)) | 118 if (!frameRect().intersects(rect)) |
119 return; | 119 return; |
120 | 120 |
121 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele
ment->layoutObject(), DisplayItem::Type::WebPlugin)) | 121 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele
ment->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint())) |
122 return; | 122 return; |
123 | 123 |
124 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje
ct(), DisplayItem::Type::WebPlugin, rect); | 124 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje
ct(), DisplayItem::Type::WebPlugin, rect, LayoutPoint()); |
125 context->save(); | 125 context->save(); |
126 | 126 |
127 ASSERT(parent()->isFrameView()); | 127 ASSERT(parent()->isFrameView()); |
128 FrameView* view = toFrameView(parent()); | 128 FrameView* view = toFrameView(parent()); |
129 | 129 |
130 // The plugin is positioned in the root frame's coordinates, so it needs to | 130 // The plugin is positioned in the root frame's coordinates, so it needs to |
131 // be painted in them too. | 131 // be painted in them too. |
132 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); | 132 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); |
133 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig
in.y())); | 133 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig
in.y())); |
134 | 134 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions); | 335 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions); |
336 } | 336 } |
337 | 337 |
338 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const | 338 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const |
339 { | 339 { |
340 return m_webPlugin->printBegin(printParams); | 340 return m_webPlugin->printBegin(printParams); |
341 } | 341 } |
342 | 342 |
343 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext* gc, cons
t IntRect& printRect) | 343 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext* gc, cons
t IntRect& printRect) |
344 { | 344 { |
345 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*gc, *m_element-
>layoutObject(), DisplayItem::Type::WebPlugin)) | 345 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*gc, *m_element-
>layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint())) |
346 return; | 346 return; |
347 | 347 |
348 LayoutObjectDrawingRecorder drawingRecorder(*gc, *m_element->layoutObject(),
DisplayItem::Type::WebPlugin, printRect); | 348 LayoutObjectDrawingRecorder drawingRecorder(*gc, *m_element->layoutObject(),
DisplayItem::Type::WebPlugin, printRect, LayoutPoint()); |
349 gc->save(); | 349 gc->save(); |
350 WebCanvas* canvas = gc->canvas(); | 350 WebCanvas* canvas = gc->canvas(); |
351 m_webPlugin->printPage(pageNumber, canvas); | 351 m_webPlugin->printPage(pageNumber, canvas); |
352 gc->restore(); | 352 gc->restore(); |
353 } | 353 } |
354 | 354 |
355 void WebPluginContainerImpl::printEnd() | 355 void WebPluginContainerImpl::printEnd() |
356 { | 356 { |
357 m_webPlugin->printEnd(); | 357 m_webPlugin->printEnd(); |
358 } | 358 } |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 for (size_t i = 0; i < cutOutRects.size(); i++) | 952 for (size_t i = 0; i < cutOutRects.size(); i++) |
953 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 953 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
954 } | 954 } |
955 | 955 |
956 bool WebPluginContainerImpl::pluginShouldPersist() const | 956 bool WebPluginContainerImpl::pluginShouldPersist() const |
957 { | 957 { |
958 return m_webPlugin->shouldPersist(); | 958 return m_webPlugin->shouldPersist(); |
959 } | 959 } |
960 | 960 |
961 } // namespace blink | 961 } // namespace blink |
OLD | NEW |