Title: [244562] trunk/Source/WebCore
Revision
244562
Author
[email protected]
Date
2019-04-23 13:32:39 -0700 (Tue, 23 Apr 2019)

Log Message

Web Inspector: Canvas: support recording TypedOMCSSImageValue
https://bugs.webkit.org/show_bug.cgi?id=192609

Reviewed by Timothy Hatcher.

* inspector/InspectorCanvas.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::indexForData):
(WebCore::InspectorCanvas::buildAction):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244561 => 244562)


--- trunk/Source/WebCore/ChangeLog	2019-04-23 20:31:51 UTC (rev 244561)
+++ trunk/Source/WebCore/ChangeLog	2019-04-23 20:32:39 UTC (rev 244562)
@@ -1,3 +1,15 @@
+2019-04-23  Devin Rousso  <[email protected]>
+
+        Web Inspector: Canvas: support recording TypedOMCSSImageValue
+        https://bugs.webkit.org/show_bug.cgi?id=192609
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorCanvas.h:
+        * inspector/InspectorCanvas.cpp:
+        (WebCore::InspectorCanvas::indexForData):
+        (WebCore::InspectorCanvas::buildAction):
+
 2019-04-23  Andres Gonzalez  <[email protected]>
 
         Accessibility text search and selection API enhancements.

Modified: trunk/Source/WebCore/inspector/InspectorCanvas.cpp (244561 => 244562)


--- trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2019-04-23 20:31:51 UTC (rev 244561)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.cpp	2019-04-23 20:32:39 UTC (rev 244562)
@@ -57,6 +57,9 @@
 #include "RecordingSwizzleTypes.h"
 #include "SVGPathUtilities.h"
 #include "StringAdaptors.h"
+#if ENABLE(CSS_TYPED_OM)
+#include "TypedOMCSSImageValue.h"
+#endif
 #if ENABLE(WEBGL)
 #include "WebGLRenderingContext.h"
 #endif
@@ -454,6 +457,22 @@
                 array->addItem(indexForData(scriptCallStack->at(i)));
             item = WTFMove(array);
         },
+#if ENABLE(CSS_TYPED_OM)
+        [&] (const RefPtr<TypedOMCSSImageValue>& cssImageValue) {
+            String dataURL = "data:,"_s;
+
+            if (auto* cachedImage = cssImageValue->image()) {
+                auto* image = cachedImage->image();
+                if (image && image != &Image::nullImage()) {
+                    auto imageBuffer = ImageBuffer::create(image->size(), RenderingMode::Unaccelerated);
+                    imageBuffer->context().drawImage(*image, FloatPoint(0, 0));
+                    dataURL = imageBuffer->toDataURL("image/png");
+                }
+            }
+
+            index = indexForData(dataURL);
+        },
+#endif
         [&] (const ScriptCallFrame& scriptCallFrame) {
             auto array = JSON::ArrayOf<double>::create();
             array->addItem(indexForData(scriptCallFrame.functionName()));
@@ -664,8 +683,7 @@
             [&] (const RefPtr<HTMLVideoElement>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::Image); },
 #endif
 #if ENABLE(CSS_TYPED_OM)
-            // FIXME implement: <https://bugs.webkit.org/show_bug.cgi?id=192609>.
-            [&] (const RefPtr<TypedOMCSSImageValue>&) { },
+            [&] (const RefPtr<TypedOMCSSImageValue>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::Image); },
 #endif
             [&] (const RefPtr<ImageBitmap>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageBitmap); },
             [&] (const RefPtr<ImageData>& value) { addParameter(indexForData(value), RecordingSwizzleTypes::ImageData); },

Modified: trunk/Source/WebCore/inspector/InspectorCanvas.h (244561 => 244562)


--- trunk/Source/WebCore/inspector/InspectorCanvas.h	2019-04-23 20:31:51 UTC (rev 244561)
+++ trunk/Source/WebCore/inspector/InspectorCanvas.h	2019-04-23 20:32:39 UTC (rev 244562)
@@ -43,6 +43,9 @@
 class HTMLVideoElement;
 class ImageBitmap;
 class ImageData;
+#if ENABLE(CSS_TYPED_OM)
+class TypedOMCSSImageValue;
+#endif
 
 typedef String ErrorString;
 
@@ -94,6 +97,9 @@
         RefPtr<ImageData>,
         RefPtr<ImageBitmap>,
         RefPtr<Inspector::ScriptCallStack>,
+#if ENABLE(CSS_TYPED_OM)
+        RefPtr<TypedOMCSSImageValue>,
+#endif
         Inspector::ScriptCallFrame,
         String
     >;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to