| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 // Don't paint anything if the plugin doesn't intersect. | 128 // Don't paint anything if the plugin doesn't intersect. |
| 129 if (!cullRect.intersectsCullRect(frameRect())) | 129 if (!cullRect.intersectsCullRect(frameRect())) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_webLayer) { | 132 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_webLayer) { |
| 133 // With Slimming Paint v2, composited plugins should have their layers | 133 // With Slimming Paint v2, composited plugins should have their layers |
| 134 // inserted rather than invoking WebPlugin::paint. | 134 // inserted rather than invoking WebPlugin::paint. |
| 135 recordForeignLayer( | 135 recordForeignLayer( |
| 136 context, *m_element->layoutObject(), DisplayItem::ForeignLayerPlugin
, | 136 context, *m_element->layoutObject(), DisplayItem::kForeignLayerPlugi
n, |
| 137 m_webLayer, location(), size()); | 137 m_webLayer, location(), size()); |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, *m_elem
ent->layoutObject(), DisplayItem::Type::WebPlugin)) | 141 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, *m_elem
ent->layoutObject(), DisplayItem::Type::kWebPlugin)) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 LayoutObjectDrawingRecorder drawingRecorder(context, *m_element->layoutObjec
t(), DisplayItem::Type::WebPlugin, cullRect.m_rect); | 144 LayoutObjectDrawingRecorder drawingRecorder(context, *m_element->layoutObjec
t(), DisplayItem::Type::kWebPlugin, cullRect.m_rect); |
| 145 context.save(); | 145 context.save(); |
| 146 | 146 |
| 147 DCHECK(parent()->isFrameView()); | 147 DCHECK(parent()->isFrameView()); |
| 148 FrameView* view = toFrameView(parent()); | 148 FrameView* view = toFrameView(parent()); |
| 149 | 149 |
| 150 // The plugin is positioned in the root frame's coordinates, so it needs to | 150 // The plugin is positioned in the root frame's coordinates, so it needs to |
| 151 // be painted in them too. | 151 // be painted in them too. |
| 152 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); | 152 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); |
| 153 context.translate(static_cast<float>(-origin.x()), static_cast<float>(-origi
n.y())); | 153 context.translate(static_cast<float>(-origin.x()), static_cast<float>(-origi
n.y())); |
| 154 | 154 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions); | 344 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions); |
| 345 } | 345 } |
| 346 | 346 |
| 347 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const | 347 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const |
| 348 { | 348 { |
| 349 return m_webPlugin->printBegin(printParams); | 349 return m_webPlugin->printBegin(printParams); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext& gc, cons
t IntRect& printRect) | 352 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext& gc, cons
t IntRect& printRect) |
| 353 { | 353 { |
| 354 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(gc, *m_element->
layoutObject(), DisplayItem::Type::WebPlugin)) | 354 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(gc, *m_element->
layoutObject(), DisplayItem::Type::kWebPlugin)) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 LayoutObjectDrawingRecorder drawingRecorder(gc, *m_element->layoutObject(),
DisplayItem::Type::WebPlugin, printRect); | 357 LayoutObjectDrawingRecorder drawingRecorder(gc, *m_element->layoutObject(),
DisplayItem::Type::kWebPlugin, printRect); |
| 358 gc.save(); | 358 gc.save(); |
| 359 WebCanvas* canvas = gc.canvas(); | 359 WebCanvas* canvas = gc.canvas(); |
| 360 m_webPlugin->printPage(pageNumber, canvas); | 360 m_webPlugin->printPage(pageNumber, canvas); |
| 361 gc.restore(); | 361 gc.restore(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void WebPluginContainerImpl::printEnd() | 364 void WebPluginContainerImpl::printEnd() |
| 365 { | 365 { |
| 366 m_webPlugin->printEnd(); | 366 m_webPlugin->printEnd(); |
| 367 } | 367 } |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 // frame view. | 937 // frame view. |
| 938 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 938 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
| 939 } | 939 } |
| 940 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 940 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 941 // Convert to the plugin position. | 941 // Convert to the plugin position. |
| 942 for (size_t i = 0; i < cutOutRects.size(); i++) | 942 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 943 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 943 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 944 } | 944 } |
| 945 | 945 |
| 946 } // namespace blink | 946 } // namespace blink |
| OLD | NEW |