Changeset 201001 in webkit
- Timestamp:
- May 17, 2016 1:46:49 AM (8 years ago)
- Location:
- branches/safari-602.1.32-branch
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-602.1.32-branch/LayoutTests/ChangeLog
r200590 r201001 1 2016-05-17 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r200778. rdar://problem/25840861 4 5 2016-05-12 Eric Carlson <eric.carlson@apple.com> 6 7 Adjust "main content" video heuristic 8 https://bugs.webkit.org/show_bug.cgi?id=157532 9 10 Reviewed by Darin Adler. 11 12 * media/video-main-content-allow.html: 13 * media/video-main-content-autoplay-expected.txt: Added. 14 * media/video-main-content-autoplay.html: Added. 15 * media/video-main-content-deny-too-small.html: 16 1 17 2016-05-09 Simon Fraser <simon.fraser@apple.com> 2 18 -
branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-allow.html
r197953 r201001 23 23 <style> 24 24 video { 25 width: 600px;26 height: 4 00px;25 width: 270px; 26 height: 480px; 27 27 } 28 28 </style> -
branches/safari-602.1.32-branch/LayoutTests/media/video-main-content-deny-too-small.html
r197953 r201001 8 8 function go() { 9 9 video = document.createElement('video'); 10 video.controls = "" 10 11 run('internals.setMediaElementRestrictions(video, "RequireUserGestureForVideoRateChange,OverrideUserGestureRequirementForMainContent")'); 11 12 document.body.appendChild(video); … … 28 29 <style> 29 30 video { 30 width: 200px;31 height: 100px;31 width: 400px; 32 height: 299px; 32 33 } 33 34 </style> -
branches/safari-602.1.32-branch/Source/WebCore/ChangeLog
r200989 r201001 1 2016-05-17 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r200778. rdar://problem/25840861 4 5 2016-05-12 Eric Carlson <eric.carlson@apple.com> 6 7 Adjust "main content" video heuristic 8 https://bugs.webkit.org/show_bug.cgi?id=157532 9 <rdar://problem/25840861> 10 11 Reviewed by Darin Adler. 12 13 Test: media/video-main-content-autoplay.html, plus existing tests updated. 14 15 * html/MediaElementSession.cpp: 16 (WebCore::MediaElementSession::canControlControlsManager): Use isElementLargeEnoughForMainContent. 17 (WebCore::isMainContent): Ditto. 18 (WebCore::isElementLargeEnoughForMainContent): Check video area and aspect ratio. 19 (WebCore::MediaElementSession::mainContentCheckTimerFired): Call result.setToNonUserAgentShadowAncestor 20 so it doesn't hit test the video controls in the shadow DOM. 21 1 22 2016-05-16 Dean Jackson <dino@apple.com> 2 23 -
branches/safari-602.1.32-branch/Source/WebCore/html/MediaElementSession.cpp
r200540 r201001 55 55 namespace WebCore { 56 56 57 static const int elementMainContentMinimumWidth = 400;58 static const int elementMainContentMinimumHeight = 300;59 57 static const double elementMainContentCheckInterval = .250; 60 58 61 59 static bool isMainContent(const HTMLMediaElement&); 60 static bool isElementLargeEnoughForMainContent(const HTMLMediaElement&); 62 61 63 62 #if !LOG_DISABLED … … 225 224 return false; 226 225 227 if ( element.hasVideo() && renderer->clientWidth() >= elementMainContentMinimumWidth && renderer->clientHeight() >= elementMainContentMinimumHeight)228 226 if (isElementLargeEnoughForMainContent(element)) 227 return true; 229 228 230 229 if (ScriptController::processingUserGestureForMedia()) … … 507 506 return false; 508 507 509 if (renderer->clientWidth() < elementMainContentMinimumWidth 510 || renderer->clientHeight() < elementMainContentMinimumHeight) 508 if (!isElementLargeEnoughForMainContent(element)) 511 509 return false; 512 510 … … 536 534 // Elements which are obscured by other elements cannot be main content. 537 535 mainRenderView.hitTest(request, result); 536 result.setToNonUserAgentShadowAncestor(); 538 537 Element* hitElement = result.innerElement(); 539 538 if (hitElement != &element) … … 543 542 } 544 543 544 static bool isElementLargeEnoughForMainContent(const HTMLMediaElement& element) 545 { 546 static const double elementMainContentAreaMinimum = 400 * 300; 547 static const double maximumAspectRatio = 1.8; // Slightly larger than 16:9. 548 static const double minimumAspectRatio = .5; // Slightly smaller than 16:9. 549 550 // Elements which have not yet been laid out, or which are not yet in the DOM, cannot be main content. 551 RenderBox* renderer = downcast<RenderBox>(element.renderer()); 552 if (!renderer) 553 return false; 554 555 double width = renderer->clientWidth(); 556 double height = renderer->clientHeight(); 557 double area = width * height; 558 double aspectRatio = width / height; 559 return area >= elementMainContentAreaMinimum && aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio; 560 } 561 545 562 void MediaElementSession::mainContentCheckTimerFired() 546 563 {
Note: See TracChangeset
for help on using the changeset viewer.