Diff
Modified: trunk/LayoutTests/ChangeLog (195952 => 195953)
--- trunk/LayoutTests/ChangeLog 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/ChangeLog 2016-02-01 06:34:07 UTC (rev 195953)
@@ -1,3 +1,25 @@
+2016-01-31 Jeremy Jones <[email protected]>
+
+ Add resize event for HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=125715
+
+ Reviewed by Darin Adler.
+
+ Update test for change: move resize _javascript_ event from DOMWindow.idl to GlobalEventHandlers.idl
+ per https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
+
+ * fast/dom/event-handler-attributes-expected.txt: Rebaselined.
+ * fast/dom/event-handler-attributes.html:
+ Move resize from uniqueWindowEvents to eventsInGlobalEventHandlers.
+ * http/tests/media/hls/hls-video-resize-expected.txt: Added.
+ * http/tests/media/hls/hls-video-resize.html: Added.
+ * js/dom/dom-static-property-for-in-iteration-expected.txt: Rebaselined.
+ * media/video-resize-expected.txt: Added.
+ * media/video-resize.html: Added.
+ * media/video-test.js:
+ (requiredEvents): Deleted global. Value is now captured by closure.
+ (waitForEventsAndCall): Remove dependence on global variable, and fix event observation leak.
+
2016-01-31 Brent Fulgham <[email protected]>
Add "WebKit built-in PDF" Plugin to set of publicly visible plugins
Modified: trunk/LayoutTests/fast/dom/event-handler-attributes-expected.txt (195952 => 195953)
--- trunk/LayoutTests/fast/dom/event-handler-attributes-expected.txt 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/fast/dom/event-handler-attributes-expected.txt 2016-02-01 06:34:07 UTC (rev 195953)
@@ -148,6 +148,7 @@
PASS testScriptAttribute(document, "ratechange") is "document"
PASS testScriptAttribute(document, "readystatechange") is "document"
PASS testScriptAttribute(document, "reset") is "document"
+PASS testScriptAttribute(document, "resize") is "document"
PASS testScriptAttribute(document, "scroll") is "document"
PASS testScriptAttribute(document, "search") is "document"
PASS testScriptAttribute(document, "seeked") is "document"
@@ -180,7 +181,6 @@
PASS testScriptAttribute(document, "pagehide") is "none"
PASS testScriptAttribute(document, "pageshow") is "none"
PASS testScriptAttribute(document, "popstate") is "none"
-PASS testScriptAttribute(document, "resize") is "none"
PASS testScriptAttribute(document, "storage") is "none"
PASS testScriptAttribute(document, "transitionend") is "none"
PASS testScriptAttribute(document, "unload") is "none"
@@ -246,6 +246,7 @@
PASS testElementAttribute(element, "progress") is "target"
PASS testElementAttribute(element, "ratechange") is "target"
PASS testElementAttribute(element, "reset") is "target"
+PASS testElementAttribute(element, "resize") is "target"
PASS testElementAttribute(element, "scroll") is "target"
PASS testElementAttribute(element, "search") is "target"
PASS testElementAttribute(element, "seeked") is "target"
@@ -277,7 +278,6 @@
PASS testElementAttribute(element, "pageshow") is "none"
PASS testElementAttribute(element, "popstate") is "none"
PASS testElementAttribute(element, "readystatechange") is "none"
-PASS testElementAttribute(element, "resize") is "none"
PASS testElementAttribute(element, "selectionchange") is "none"
PASS testElementAttribute(element, "storage") is "none"
PASS testElementAttribute(element, "unload") is "none"
@@ -339,6 +339,7 @@
PASS testElementAttribute(inputElement, "progress") is "target"
PASS testElementAttribute(inputElement, "ratechange") is "target"
PASS testElementAttribute(inputElement, "reset") is "target"
+PASS testElementAttribute(inputElement, "resize") is "target"
PASS testElementAttribute(inputElement, "scroll") is "target"
PASS testElementAttribute(inputElement, "search") is "target"
PASS testElementAttribute(inputElement, "seeked") is "target"
@@ -370,7 +371,6 @@
PASS testElementAttribute(inputElement, "pageshow") is "none"
PASS testElementAttribute(inputElement, "popstate") is "none"
PASS testElementAttribute(inputElement, "readystatechange") is "none"
-PASS testElementAttribute(inputElement, "resize") is "none"
PASS testElementAttribute(inputElement, "selectionchange") is "none"
PASS testElementAttribute(inputElement, "storage") is "none"
PASS testElementAttribute(inputElement, "unload") is "none"
@@ -432,6 +432,7 @@
PASS testElementAttribute(audioElement, "progress") is "target"
PASS testElementAttribute(audioElement, "ratechange") is "target"
PASS testElementAttribute(audioElement, "reset") is "target"
+PASS testElementAttribute(audioElement, "resize") is "target"
PASS testElementAttribute(audioElement, "scroll") is "target"
PASS testElementAttribute(audioElement, "search") is "target"
PASS testElementAttribute(audioElement, "seeked") is "target"
@@ -463,7 +464,6 @@
PASS testElementAttribute(audioElement, "pageshow") is "none"
PASS testElementAttribute(audioElement, "popstate") is "none"
PASS testElementAttribute(audioElement, "readystatechange") is "none"
-PASS testElementAttribute(audioElement, "resize") is "none"
PASS testElementAttribute(audioElement, "selectionchange") is "none"
PASS testElementAttribute(audioElement, "storage") is "none"
PASS testElementAttribute(audioElement, "unload") is "none"
@@ -525,6 +525,7 @@
PASS testElementAttribute(videoElement, "progress") is "target"
PASS testElementAttribute(videoElement, "ratechange") is "target"
PASS testElementAttribute(videoElement, "reset") is "target"
+PASS testElementAttribute(videoElement, "resize") is "target"
PASS testElementAttribute(videoElement, "scroll") is "target"
PASS testElementAttribute(videoElement, "search") is "target"
PASS testElementAttribute(videoElement, "seeked") is "target"
@@ -556,7 +557,6 @@
PASS testElementAttribute(videoElement, "pageshow") is "none"
PASS testElementAttribute(videoElement, "popstate") is "none"
PASS testElementAttribute(videoElement, "readystatechange") is "none"
-PASS testElementAttribute(videoElement, "resize") is "none"
PASS testElementAttribute(videoElement, "selectionchange") is "none"
PASS testElementAttribute(videoElement, "storage") is "none"
PASS testElementAttribute(videoElement, "unload") is "none"
@@ -816,6 +816,7 @@
PASS testElementAttribute(rectElement, "progress") is "target"
PASS testElementAttribute(rectElement, "ratechange") is "target"
PASS testElementAttribute(rectElement, "reset") is "target"
+PASS testElementAttribute(rectElement, "resize") is "target"
PASS testElementAttribute(rectElement, "scroll") is "target"
PASS testElementAttribute(rectElement, "search") is "target"
PASS testElementAttribute(rectElement, "seeked") is "target"
@@ -847,7 +848,6 @@
PASS testElementAttribute(rectElement, "pageshow") is "none"
PASS testElementAttribute(rectElement, "popstate") is "none"
PASS testElementAttribute(rectElement, "readystatechange") is "none"
-PASS testElementAttribute(rectElement, "resize") is "none"
PASS testElementAttribute(rectElement, "selectionchange") is "none"
PASS testElementAttribute(rectElement, "storage") is "none"
PASS testElementAttribute(rectElement, "unload") is "none"
@@ -919,7 +919,7 @@
FAIL testElementAttribute(nonHTMLElement, "ratechange") should be none. Was script: target; content: none.
PASS testElementAttribute(nonHTMLElement, "readystatechange") is "none"
FAIL testElementAttribute(nonHTMLElement, "reset") should be none. Was script: target; content: none.
-PASS testElementAttribute(nonHTMLElement, "resize") is "none"
+FAIL testElementAttribute(nonHTMLElement, "resize") should be none. Was script: target; content: none.
FAIL testElementAttribute(nonHTMLElement, "scroll") should be none. Was script: target; content: none.
FAIL testElementAttribute(nonHTMLElement, "search") should be none. Was script: target; content: none.
FAIL testElementAttribute(nonHTMLElement, "seeked") should be none. Was script: target; content: none.
Modified: trunk/LayoutTests/fast/dom/event-handler-attributes.html (195952 => 195953)
--- trunk/LayoutTests/fast/dom/event-handler-attributes.html 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/fast/dom/event-handler-attributes.html 2016-02-01 06:34:07 UTC (rev 195953)
@@ -56,6 +56,7 @@
"progress",
"ratechange",
"reset",
+ "resize",
"scroll",
"seeked",
"seeking",
@@ -105,7 +106,6 @@
];
const uniqueWindowEvents = [
- "resize"
];
const uniqueDocumentEvents = [
Added: trunk/LayoutTests/http/tests/media/hls/hls-video-resize-expected.txt (0 => 195953)
--- trunk/LayoutTests/http/tests/media/hls/hls-video-resize-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/hls-video-resize-expected.txt 2016-02-01 06:34:07 UTC (rev 195953)
@@ -0,0 +1,16 @@
+
+Test <video> element initial resize event for HLS.
+
+EXPECTED (video.videoWidth == '0') OK
+EXPECTED (video.videoHeight == '0') OK
+EVENT(resize)
+Receive first resize event before loadedmetadata. OK
+EXPECTED (video.videoWidth == '0') OK
+EXPECTED (video.videoHeight == '0') OK
+EVENT(loadedmetadata)
+Receive loadmetadata event before second resize. OK
+EVENT(resize)
+EXPECTED (video.videoWidth == '640') OK
+EXPECTED (video.videoHeight == '480') OK
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/hls/hls-video-resize.html (0 => 195953)
--- trunk/LayoutTests/http/tests/media/hls/hls-video-resize.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/hls-video-resize.html 2016-02-01 06:34:07 UTC (rev 195953)
@@ -0,0 +1,52 @@
+<html>
+ <head>
+ <title><video> element initial resize event test for HLS</title>
+ <script src=""
+
+ <script>
+ function test()
+ {
+ var receiveLoadMetadata = false;
+ var receiveSecondResize = false;
+
+ findMediaElement();
+
+ testExpected("video.videoWidth", 0);
+ testExpected("video.videoHeight", 0);
+
+ waitForEventOnceOn(video, "error", function () {
+ failTest("Load failed.");
+ });
+
+ waitForEventOnceOn(video, "loadedmetadata", function () {
+ receiveLoadMetadata = true;
+ logResult(!receiveSecondResize, "Receive loadmetadata event before second resize.");
+ });
+
+ waitForEventOnceOn(video, "resize", function () {
+ logResult(!receiveLoadMetadata, "Receive first resize event before loadedmetadata.");
+
+ receivedFirstResizeEvent = true;
+ testExpected("video.videoWidth", 0);
+ testExpected("video.videoHeight", 0);
+
+ waitForEventOnceOn(video, "resize", function () {
+ receiveSecondResize = true;
+ testExpected("video.videoWidth", 640);
+ testExpected("video.videoHeight", 480);
+ endTest();
+ });
+ });
+
+ video.src = ""
+ }
+ </script>
+ </head>
+
+ <body _onload_="setTimeout(test, 100)">
+
+ <video controls width=640 height=480"></video>
+ <p>Test <video> element initial resize event for HLS.</p>
+
+ </body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (195952 => 195953)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-02-01 06:34:07 UTC (rev 195953)
@@ -1,3 +1,15 @@
+2016-01-31 Jeremy Jones <[email protected]>
+
+ Add resize event for HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=125715
+
+ Reviewed by Darin Adler.
+
+ Rebaselined test after moving 'resize' from DOMWindow.idl to GlobalEventHandlers.idl
+ per https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
+
+ * web-platform-tests/html/dom/interfaces-expected.txt:
+
2016-01-31 Youenn Fablet <[email protected]>
imported/w3c/web-platform-tests/streams-api/readable-streams/garbage-collection.html asserts frequently
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (195952 => 195953)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-02-01 06:34:07 UTC (rev 195953)
@@ -109,7 +109,7 @@
FAIL Document interface: attribute onprogress assert_equals: getter must be Function expected "function" but got "undefined"
FAIL Document interface: attribute onratechange assert_equals: getter must be Function expected "function" but got "undefined"
FAIL Document interface: attribute onreset assert_equals: getter must be Function expected "function" but got "undefined"
-FAIL Document interface: attribute onresize assert_true: The prototype object must have a property "onresize" expected true got false
+FAIL Document interface: attribute onresize assert_equals: getter must be Function expected "function" but got "undefined"
FAIL Document interface: attribute onscroll assert_equals: getter must be Function expected "function" but got "undefined"
FAIL Document interface: attribute onseeked assert_equals: getter must be Function expected "function" but got "undefined"
FAIL Document interface: attribute onseeking assert_equals: getter must be Function expected "function" but got "undefined"
@@ -341,7 +341,7 @@
PASS Document interface: iframe.contentDocument must inherit property "onprogress" with the proper type (140)
PASS Document interface: iframe.contentDocument must inherit property "onratechange" with the proper type (141)
PASS Document interface: iframe.contentDocument must inherit property "onreset" with the proper type (142)
-FAIL Document interface: iframe.contentDocument must inherit property "onresize" with the proper type (143) assert_inherits: property "onresize" not found in prototype chain
+PASS Document interface: iframe.contentDocument must inherit property "onresize" with the proper type (143)
PASS Document interface: iframe.contentDocument must inherit property "onscroll" with the proper type (144)
PASS Document interface: iframe.contentDocument must inherit property "onseeked" with the proper type (145)
PASS Document interface: iframe.contentDocument must inherit property "onseeking" with the proper type (146)
@@ -656,7 +656,7 @@
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onprogress" with the proper type (140)
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onratechange" with the proper type (141)
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onreset" with the proper type (142)
-FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "onresize" with the proper type (143) assert_inherits: property "onresize" not found in prototype chain
+PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onresize" with the proper type (143)
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onscroll" with the proper type (144)
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeked" with the proper type (145)
PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onseeking" with the proper type (146)
@@ -938,7 +938,7 @@
FAIL HTMLElement interface: attribute onprogress assert_own_property: expected property "onprogress" missing
FAIL HTMLElement interface: attribute onratechange assert_own_property: expected property "onratechange" missing
FAIL HTMLElement interface: attribute onreset assert_own_property: expected property "onreset" missing
-FAIL HTMLElement interface: attribute onresize assert_true: The prototype object must have a property "onresize" expected true got false
+FAIL HTMLElement interface: attribute onresize assert_own_property: expected property "onresize" missing
FAIL HTMLElement interface: attribute onscroll assert_own_property: expected property "onscroll" missing
FAIL HTMLElement interface: attribute onseeked assert_own_property: expected property "onseeked" missing
FAIL HTMLElement interface: attribute onseeking assert_own_property: expected property "onseeking" missing
@@ -1035,7 +1035,7 @@
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onprogress" with the proper type (78)
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onratechange" with the proper type (79)
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onreset" with the proper type (80)
-FAIL HTMLElement interface: document.createElement("noscript") must inherit property "onresize" with the proper type (81) assert_inherits: property "onresize" not found in prototype chain
+PASS HTMLElement interface: document.createElement("noscript") must inherit property "onresize" with the proper type (81)
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onscroll" with the proper type (82)
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onseeked" with the proper type (83)
PASS HTMLElement interface: document.createElement("noscript") must inherit property "onseeking" with the proper type (84)
Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (195952 => 195953)
--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt 2016-02-01 06:34:07 UTC (rev 195953)
@@ -111,6 +111,7 @@
PASS a["onprogress"] is null
PASS a["onratechange"] is null
PASS a["onreset"] is null
+PASS a["onresize"] is null
PASS a["onscroll"] is null
PASS a["onseeked"] is null
PASS a["onseeking"] is null
Added: trunk/LayoutTests/media/video-resize-expected.txt (0 => 195953)
--- trunk/LayoutTests/media/video-resize-expected.txt (rev 0)
+++ trunk/LayoutTests/media/video-resize-expected.txt 2016-02-01 06:34:07 UTC (rev 195953)
@@ -0,0 +1,10 @@
+
+Test <video> element initial resize event.
+
+EXPECTED (video.videoWidth == '0') OK
+EXPECTED (video.videoHeight == '0') OK
+EVENT(resize)
+EXPECTED (video.videoWidth == '320') OK
+EXPECTED (video.videoHeight == '240') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/video-resize.html (0 => 195953)
--- trunk/LayoutTests/media/video-resize.html (rev 0)
+++ trunk/LayoutTests/media/video-resize.html 2016-02-01 06:34:07 UTC (rev 195953)
@@ -0,0 +1,39 @@
+<html>
+ <head>
+ <title><video> element initial resize event test</title>
+ <script src=""
+ <script src=""
+
+ <script>
+ function test()
+ {
+ var receivedFirstResizeEvent = false;
+
+ findMediaElement();
+
+ testExpected("video.videoWidth", 0);
+ testExpected("video.videoHeight", 0);
+
+ waitForEventOnceOn(video, "loadedmetadata", function () {
+ logResult(receivedFirstResizeEvent, "Receive loadedmetadata after first resize event.");
+ });
+
+ waitForEventOnceOn(video, "resize", function () {
+ receivedFirstResizeEvent = true;
+ testExpected("video.videoWidth", 320);
+ testExpected("video.videoHeight", 240);
+ endTest();
+ });
+
+ video.src = "" "content/test");
+ }
+ </script>
+ </head>
+
+ <body _onload_="setTimeout(test, 100)">
+
+ <video controls width=640 height=480"></video>
+ <p>Test <video> element initial resize event.</p>
+
+ </body>
+</html>
Modified: trunk/LayoutTests/media/video-test.js (195952 => 195953)
--- trunk/LayoutTests/media/video-test.js 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/LayoutTests/media/video-test.js 2016-02-01 06:34:07 UTC (rev 195953)
@@ -349,19 +349,24 @@
}
}
-var requiredEvents = [];
-
function waitForEventsAndCall(eventList, func)
{
+ var requiredEvents = []
+
function _eventCallback(event)
{
if (!requiredEvents.length)
return;
- var index = requiredEvents.indexOf(event.type);
- if (index < 0)
+ for (var index = 0; index < requiredEvents.length; index++) {
+ if (requiredEvents[index][1] === event.type) {
+ break;
+ }
+ }
+ if (index >= requiredEvents.length)
return;
+ requiredEvents[index][0].removeEventListener(event, _eventCallback);
requiredEvents.splice(index, 1);
if (requiredEvents.length)
return;
@@ -369,10 +374,9 @@
func();
}
- requiredEvents = [];
for (var i = 0; i < eventList.length; i++) {
- requiredEvents[i] = eventList[i][1];
- eventList[i][0].addEventListener(requiredEvents[i], _eventCallback, true);
+ requiredEvents[i] = eventList[i].slice(0);
+ requiredEvents[i][0].addEventListener(requiredEvents[i][1], _eventCallback, true);
}
}
Modified: trunk/Source/WebCore/ChangeLog (195952 => 195953)
--- trunk/Source/WebCore/ChangeLog 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/ChangeLog 2016-02-01 06:34:07 UTC (rev 195953)
@@ -1,3 +1,33 @@
+2016-01-31 Jeremy Jones <[email protected]>
+
+ Add resize event for HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=125715
+
+ Reviewed by Darin Adler.
+
+ Tests: http/tests/media/hls/hls-video-resize.html
+ media/video-resize.html
+
+ Move resize _javascript_ event from DOMWindow.idl to GlobalEventHandlers.idl
+ per https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
+
+ Post resize event from video element when metadata loads and when content size changes.
+
+ * dom/GlobalEventHandlers.idl: Add onresize.
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::createEventHandlerNameMap): Add onresizeAttr.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setReadyState):
+ (WebCore::HTMLMediaElement::mediaPlayerSizeChanged):
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::scheduleResizeEvent):
+ (WebCore::HTMLMediaElement::scheduleResizeEventIfSizeChanged):
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::scheduleResizeEvent): Sechedule event.
+ (WebCore::HTMLVideoElement::scheduleResizeEventIfSizeChanged): Schedule event if size has changed.
+ * html/HTMLVideoElement.h: Add declarations.
+ * page/DOMWindow.idl: Remove onresize.
+
2016-01-31 Darin Adler <[email protected]>
Revert accidental behavior change from previous patch.
Modified: trunk/Source/WebCore/dom/GlobalEventHandlers.idl (195952 => 195953)
--- trunk/Source/WebCore/dom/GlobalEventHandlers.idl 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/dom/GlobalEventHandlers.idl 2016-02-01 06:34:07 UTC (rev 195953)
@@ -80,7 +80,7 @@
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
- // attribute EventHandler onresize;
+ attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (195952 => 195953)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2016-02-01 06:34:07 UTC (rev 195953)
@@ -314,6 +314,7 @@
&onprogressAttr,
&onratechangeAttr,
&onresetAttr,
+ &onresizeAttr,
&onscrollAttr,
&onsearchAttr,
&onseekedAttr,
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (195952 => 195953)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-02-01 06:34:07 UTC (rev 195953)
@@ -2150,6 +2150,7 @@
if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) {
prepareMediaFragmentURI();
scheduleEvent(eventNames().durationchangeEvent);
+ scheduleResizeEvent();
scheduleEvent(eventNames().loadedmetadataEvent);
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (hasEventListeners(eventNames().webkitplaybacktargetavailabilitychangedEvent))
@@ -4496,6 +4497,8 @@
downcast<MediaDocument>(document()).mediaElementNaturalSizeChanged(expandedIntSize(m_player->naturalSize()));
beginProcessingMediaPlayerCallback();
+ if (m_readyState > HAVE_NOTHING)
+ scheduleResizeEventIfSizeChanged();
if (renderer())
renderer()->updateFromElement();
endProcessingMediaPlayerCallback();
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (195952 => 195953)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2016-02-01 06:34:07 UTC (rev 195953)
@@ -638,6 +638,8 @@
void addPlayedRange(const MediaTime& start, const MediaTime& end);
void scheduleTimeupdateEvent(bool periodicEvent);
+ virtual void scheduleResizeEvent() { }
+ virtual void scheduleResizeEventIfSizeChanged() { }
// loading
void selectMediaResource();
Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (195952 => 195953)
--- trunk/Source/WebCore/html/HTMLVideoElement.cpp 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp 2016-02-01 06:34:07 UTC (rev 195953)
@@ -186,6 +186,20 @@
return clampToUnsigned(player()->naturalSize().height());
}
+void HTMLVideoElement::scheduleResizeEvent()
+{
+ m_lastReportedVideoWidth = videoWidth();
+ m_lastReportedVideoHeight = videoHeight();
+ scheduleEvent(eventNames().resizeEvent);
+}
+
+void HTMLVideoElement::scheduleResizeEventIfSizeChanged()
+{
+ if (m_lastReportedVideoWidth == videoWidth() && m_lastReportedVideoHeight == videoHeight())
+ return;
+ scheduleResizeEvent();
+}
+
bool HTMLVideoElement::isURLAttribute(const Attribute& attribute) const
{
return attribute.name() == posterAttr || HTMLMediaElement::isURLAttribute(attribute);
Modified: trunk/Source/WebCore/html/HTMLVideoElement.h (195952 => 195953)
--- trunk/Source/WebCore/html/HTMLVideoElement.h 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/html/HTMLVideoElement.h 2016-02-01 06:34:07 UTC (rev 195953)
@@ -41,7 +41,7 @@
WEBCORE_EXPORT unsigned videoWidth() const;
WEBCORE_EXPORT unsigned videoHeight() const;
-
+
// Fullscreen
void webkitEnterFullscreen(ExceptionCode&);
void webkitExitFullscreen();
@@ -89,6 +89,8 @@
private:
HTMLVideoElement(const QualifiedName&, Document&, bool);
+ virtual void scheduleResizeEvent() override;
+ virtual void scheduleResizeEventIfSizeChanged() override;
virtual bool rendererIsNeeded(const RenderStyle&) override;
virtual void didAttachRenderers() override;
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
@@ -110,6 +112,9 @@
std::unique_ptr<HTMLImageLoader> m_imageLoader;
AtomicString m_defaultPosterURL;
+
+ unsigned m_lastReportedVideoWidth { 0 };
+ unsigned m_lastReportedVideoHeight { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/page/DOMWindow.idl (195952 => 195953)
--- trunk/Source/WebCore/page/DOMWindow.idl 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebCore/page/DOMWindow.idl 2016-02-01 06:34:07 UTC (rev 195953)
@@ -215,9 +215,6 @@
// Event Handlers
- // FIXME: This should be in GlobalEventHandlers.idl according to HTML5 - https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
- [NotEnumerable] attribute EventHandler onresize;
-
// Unique to Element and DOMWindow
// FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
[NotEnumerable] attribute EventHandler onanimationend;
Modified: trunk/Source/WebInspectorUI/ChangeLog (195952 => 195953)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-02-01 06:34:07 UTC (rev 195953)
@@ -1,3 +1,15 @@
+2016-01-31 Jeremy Jones <[email protected]>
+
+ Add resize event for HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=125715
+
+ Reviewed by Darin Adler.
+
+ Add a display name for "resize" event.
+
+ * UserInterface/Models/ScriptTimelineRecord.js:
+ (WebInspector.ScriptTimelineRecord.EventType.displayName):
+
2016-01-30 Dave Hyatt <[email protected]>
Add the break-* properties to Web Inspector's completion set
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js (195952 => 195953)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js 2016-02-01 05:51:48 UTC (rev 195952)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js 2016-02-01 06:34:07 UTC (rev 195953)
@@ -292,6 +292,7 @@
nameMap.set("removesourcebuffer", "Remove Source Buffer");
nameMap.set("removestream", "Remove Stream");
nameMap.set("removetrack", "Remove Track");
+ nameMap.set("resize", "Resize");
nameMap.set("securitypolicyviolation", "Security Policy Violation");
nameMap.set("selectionchange", "Selection Change");
nameMap.set("selectstart", "Select Start");