Title: [216154] trunk/Source/WebCore
Revision
216154
Author
[email protected]
Date
2017-05-03 16:21:12 -0700 (Wed, 03 May 2017)

Log Message

Implement the imageready event to reliably test the async image decoding
https://bugs.webkit.org/show_bug.cgi?id=171016

Patch by Said Abou-Hallawa <[email protected]> on 2017-05-03
Reviewed by Simon Fraser.

The event will be fired for each client of the image. Firing the event
will happen after finishing the decoding and repainting the client.

Existing tests will be modified in a separate patch to use this event.

* dom/Element.cpp:
(WebCore::Element::dispatchWebKitImageReadyEventForTesting):
* dom/Element.h:
* page/Settings.in:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::imageFrameAvailable):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216153 => 216154)


--- trunk/Source/WebCore/ChangeLog	2017-05-03 23:07:24 UTC (rev 216153)
+++ trunk/Source/WebCore/ChangeLog	2017-05-03 23:21:12 UTC (rev 216154)
@@ -1,3 +1,22 @@
+2017-05-03  Said Abou-Hallawa  <[email protected]>
+
+        Implement the imageready event to reliably test the async image decoding
+        https://bugs.webkit.org/show_bug.cgi?id=171016
+
+        Reviewed by Simon Fraser.
+
+        The event will be fired for each client of the image. Firing the event
+        will happen after finishing the decoding and repainting the client.
+
+        Existing tests will be modified in a separate patch to use this event.
+
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchWebKitImageReadyEventForTesting):
+        * dom/Element.h:
+        * page/Settings.in:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::imageFrameAvailable):
+
 2017-05-03  Tim Horton  <[email protected]>
 
         Maintain interaction information URL as a URL, not a string

Modified: trunk/Source/WebCore/dom/Element.cpp (216153 => 216154)


--- trunk/Source/WebCore/dom/Element.cpp	2017-05-03 23:07:24 UTC (rev 216153)
+++ trunk/Source/WebCore/dom/Element.cpp	2017-05-03 23:21:12 UTC (rev 216154)
@@ -2508,6 +2508,12 @@
     EventDispatcher::dispatchEvent(*this, FocusEvent::create(eventNames().blurEvent, false, false, document().defaultView(), 0, WTFMove(newFocusedElement)));
 }
 
+void Element::dispatchWebKitImageReadyEventForTesting()
+{
+    if (document().settings().webkitImageReadyEventEnabled())
+        dispatchEvent(Event::create("webkitImageFrameReady", true, true));
+}
+
 bool Element::dispatchMouseForceWillBegin()
 {
 #if ENABLE(MOUSE_FORCE_EVENTS)

Modified: trunk/Source/WebCore/dom/Element.h (216153 => 216154)


--- trunk/Source/WebCore/dom/Element.h	2017-05-03 23:07:24 UTC (rev 216153)
+++ trunk/Source/WebCore/dom/Element.h	2017-05-03 23:21:12 UTC (rev 216154)
@@ -491,6 +491,7 @@
     void dispatchFocusOutEvent(const AtomicString& eventType, RefPtr<Element>&& newFocusedElement);
     virtual void dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirection);
     virtual void dispatchBlurEvent(RefPtr<Element>&& newFocusedElement);
+    void dispatchWebKitImageReadyEventForTesting();
 
     WEBCORE_EXPORT bool dispatchMouseForceWillBegin();
 

Modified: trunk/Source/WebCore/page/Settings.in (216153 => 216154)


--- trunk/Source/WebCore/page/Settings.in	2017-05-03 23:07:24 UTC (rev 216153)
+++ trunk/Source/WebCore/page/Settings.in	2017-05-03 23:21:12 UTC (rev 216154)
@@ -285,6 +285,7 @@
 
 largeImageAsyncDecodingEnabled initial=true
 animatedImageAsyncDecodingEnabled initial=true
+webkitImageReadyEventEnabled initial=false
 
 shouldSuppressKeyboardInputDuringProvisionalNavigation initial=false
 

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (216153 => 216154)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2017-05-03 23:07:24 UTC (rev 216153)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2017-05-03 23:21:12 UTC (rev 216154)
@@ -1508,6 +1508,9 @@
     if (shouldRepaint || animatingState == ImageAnimatingState::No)
         imageChanged(&image, changeRect);
 
+    if (element() && image.image()->isBitmapImage())
+        element()->dispatchWebKitImageReadyEventForTesting();
+
     return shouldRepaint ? VisibleInViewportState::Yes : VisibleInViewportState::No;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to