Diff
Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (208713 => 208714)
--- branches/safari-602-branch/Source/WebCore/ChangeLog 2016-11-15 00:10:23 UTC (rev 208713)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog 2016-11-15 00:19:20 UTC (rev 208714)
@@ -1,3 +1,22 @@
+2016-11-14 Matthew Hanson <[email protected]>
+
+ Merge r208655. rdar://problem/29250302
+
+ 2016-11-12 Wenson Hsieh <[email protected]>
+
+ The main content heuristic should be robust when handling large media elements
+ https://bugs.webkit.org/show_bug.cgi?id=164676
+ <rdar://problem/29211503>
+
+ Reviewed by Eric Carlson.
+
+ Handles integer overflow gracefully when performing the main content check for very large media elements. If the
+ heuristic comes across such an element, it will now bail early and reject the video as main content. Also adds a
+ new API test: VideoControlsManager.VideoControlsManagerPageWithEnormousVideo.
+
+ * html/MediaElementSession.cpp:
+ (WebCore::isElementRectMostlyInMainFrame):
+
2016-11-06 Matthew Hanson <[email protected]>
Merge r208392. rdar://problem/28409526
Modified: branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp (208713 => 208714)
--- branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp 2016-11-15 00:10:23 UTC (rev 208713)
+++ branches/safari-602-branch/Source/WebCore/html/MediaElementSession.cpp 2016-11-15 00:19:20 UTC (rev 208714)
@@ -657,10 +657,13 @@
IntRect mainFrameRectAdjustedForScrollPosition = IntRect(-mainFrameView->documentScrollPositionRelativeToViewOrigin(), mainFrameView->contentsSize());
IntRect elementRectInMainFrame = element.clientRect();
- unsigned totalElementArea = elementRectInMainFrame.area().unsafeGet();
+ auto totalElementArea = elementRectInMainFrame.area<RecordOverflow>();
+ if (totalElementArea.hasOverflowed())
+ return false;
+
elementRectInMainFrame.intersect(mainFrameRectAdjustedForScrollPosition);
- return elementRectInMainFrame.area().unsafeGet() > totalElementArea / 2;
+ return elementRectInMainFrame.area().unsafeGet() > totalElementArea.unsafeGet() / 2;
}
static bool isElementLargeRelativeToMainFrame(const HTMLMediaElement& element)
Modified: branches/safari-602-branch/Tools/ChangeLog (208713 => 208714)
--- branches/safari-602-branch/Tools/ChangeLog 2016-11-15 00:10:23 UTC (rev 208713)
+++ branches/safari-602-branch/Tools/ChangeLog 2016-11-15 00:19:20 UTC (rev 208714)
@@ -1,3 +1,23 @@
+2016-11-14 Matthew Hanson <[email protected]>
+
+ Merge r208655. rdar://problem/29250302
+
+ 2016-11-12 Wenson Hsieh <[email protected]>
+
+ The main content heuristic should be robust when handling large media elements
+ https://bugs.webkit.org/show_bug.cgi?id=164676
+ <rdar://problem/29211503>
+
+ Reviewed by Eric Carlson.
+
+ Added a new test verifying that enormous video elements are handled gracefully when put through the main
+ content heuristic.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html: Added.
+
2016-11-03 Matthew Hanson <[email protected]>
Merge r208340. rdar://problem/29092397
Modified: branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (208713 => 208714)
--- branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-11-15 00:10:23 UTC (rev 208713)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-11-15 00:19:20 UTC (rev 208714)
@@ -460,6 +460,7 @@
E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
+ F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; };
F4F137921D9B683E002BEC57 /* large-video-test-now-playing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */; };
F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */; };
F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */; };
@@ -588,6 +589,7 @@
7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */,
7A1458FC1AD5C07000E06772 /* mouse-button-listener.html in Copy Resources */,
7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */,
+ F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */,
F4F137921D9B683E002BEC57 /* large-video-test-now-playing.html in Copy Resources */,
2E9896151D8F093800739892 /* text-and-password-inputs.html in Copy Resources */,
F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */,
@@ -1155,6 +1157,7 @@
E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "large-input-field-focus-onload.html"; path = "Tests/WebKit2Cocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
+ F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "enormous-video-with-sound.html"; sourceTree = "<group>"; };
F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-test-now-playing.html"; sourceTree = "<group>"; };
F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-size-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
F4F405BB1D4C0CF8007A9707 /* skinny-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "skinny-autoplaying-video-with-audio.html"; sourceTree = "<group>"; };
@@ -1444,6 +1447,7 @@
2E1DFDF01D42E14400714A00 /* large-video-seek-to-beginning-and-play-after-ending.html */,
2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */,
2E1DFDEE1D42A6EB00714A00 /* large-videos-with-audio-autoplay.html */,
+ F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */,
F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */,
2E9896141D8F092B00739892 /* text-and-password-inputs.html */,
2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */,
Modified: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (208713 => 208714)
--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm 2016-11-15 00:10:23 UTC (rev 208713)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm 2016-11-15 00:19:20 UTC (rev 208714)
@@ -410,6 +410,14 @@
[webView expectControlsManager:NO afterReceivingMessage:@"playing"];
}
+TEST(VideoControlsManager, VideoControlsManagerPageWithEnormousVideo)
+{
+ RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+
+ [webView loadTestPageNamed:@"enormous-video-with-sound"];
+ [webView expectControlsManager:NO afterReceivingMessage:@"playing"];
+}
+
} // namespace TestWebKitAPI
#endif // WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201
Added: branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html (0 => 208714)
--- branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html (rev 0)
+++ branches/safari-602-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html 2016-11-15 00:19:20 UTC (rev 208714)
@@ -0,0 +1,15 @@
+<html>
+<head>
+<script>
+ function handlePlaying() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage("playing");
+ } catch(e) {
+ }
+ }
+</script>
+</head>
+<body>
+ <video autoplay src="" width=65536 height=65536 _onplaying_=handlePlaying()></video>
+</body>
+</html>