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

Unified Diff: third_party/WebKit/Source/core/paint/VideoPainter.cpp

Issue 2124893002: [SPv2] Use foreign layer support to enable composited video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge with master, integration test Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/paint/VideoPainterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/VideoPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/VideoPainter.cpp b/third_party/WebKit/Source/core/paint/VideoPainter.cpp
index dbeece3f8d8d5f1da7abb1610b9b5f3e8b8f206b..49ea54a6bbfed97026e035d2de081d3d9ca54d78 100644
--- a/third_party/WebKit/Source/core/paint/VideoPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/VideoPainter.cpp
@@ -13,6 +13,7 @@
#include "core/paint/PaintInfo.h"
#include "platform/geometry/LayoutPoint.h"
#include "platform/graphics/paint/ClipRecorder.h"
+#include "platform/graphics/paint/ForeignLayerDisplayItem.h"
namespace blink {
@@ -39,11 +40,25 @@ void VideoPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint&
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutVideo, paintInfo.phase))
return;
- LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInfo.phase, contentRect);
// Video frames are only painted in software for printing or capturing node images via web APIs.
bool forceSoftwareVideoPaint = paintInfo.getGlobalPaintFlags() & GlobalPaintFlattenCompositingLayers;
+ bool paintWithForeignLayer =
+ !displayingPoster && !forceSoftwareVideoPaint
+ && RuntimeEnabledFeatures::slimmingPaintV2Enabled();
+ if (paintWithForeignLayer) {
+ if (WebLayer* layer = m_layoutVideo.mediaElement()->platformLayer()) {
+ IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect);
+ recordForeignLayer(
+ context, m_layoutVideo, DisplayItem::ForeignLayerVideo, layer,
+ pixelSnappedRect.location(), pixelSnappedRect.size());
+ return;
+ }
+ }
+
+ LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInfo.phase, contentRect);
+
if (displayingPoster || !forceSoftwareVideoPaint) {
// This will display the poster image, if one is present, and otherwise paint nothing.
ImagePainter(m_layoutVideo).paintIntoRect(context, rect);
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/paint/VideoPainterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698