Changeset 148547 in webkit
- Timestamp:
- Apr 16, 2013, 3:01:38 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148545 r148547 1 2013-04-16 Dean Jackson <dino@apple.com> 2 3 PlugIns that resize in user gestures should be immune to snapshotting 4 https://bugs.webkit.org/show_bug.cgi?id=114697 5 <rdar://problem/13666258> 6 7 Reviewed by Tim Horton. 8 9 Now that we snapshot plugins if they resize above the snapshotting threshold, 10 we need to make sure that we don't do it in response to a user gesture 11 such as a click. 12 13 Due to the complexities of real-world content and the way they often do 14 things using timeout, I copied the code from the generic user gesture 15 timeout, which gives a 5 second grace period after clicks. 16 17 * html/HTMLPlugInImageElement.cpp: 18 (WebCore::documentHadRecentUserGesture): New static function to share the code for 19 checking the time since the last click (or whatever). 20 (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting): Make sure 21 to test for a user gesture. 22 (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Move the 23 code into the new function. 24 1 25 2013-04-15 Sam Weinig <sam@webkit.org> 2 26 -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r148487 r148547 539 539 } 540 540 541 static bool documentHadRecentUserGesture(Document* document) 542 { 543 double lastKnownUserGestureTimestamp = document->lastHandledUserGestureTimestamp(); 544 545 if (document->frame() != document->page()->mainFrame() && document->page()->mainFrame() && document->page()->mainFrame()->document()) 546 lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document->page()->mainFrame()->document()->lastHandledUserGestureTimestamp()); 547 548 if (currentTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold) 549 return true; 550 551 return false; 552 } 553 541 554 void HTMLPlugInImageElement::checkSizeChangeForSnapshotting() 542 555 { 543 if (!m_needsCheckForSizeChange || m_snapshotDecision != MaySnapshotWhenResized )556 if (!m_needsCheckForSizeChange || m_snapshotDecision != MaySnapshotWhenResized || documentHadRecentUserGesture(document())) 544 557 return; 545 558 … … 610 623 } 611 624 612 double lastKnownUserGestureTimestamp = document()->lastHandledUserGestureTimestamp(); 613 if (!inMainFrame && document()->page()->mainFrame() && document()->page()->mainFrame()->document()) 614 lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document()->page()->mainFrame()->document()->lastHandledUserGestureTimestamp()); 615 if (currentTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold) { 625 if (documentHadRecentUserGesture(document())) { 616 626 LOG(Plugins, "%p Plug-in was created shortly after a user gesture, set to play", this); 617 627 m_snapshotDecision = NeverSnapshot;
Note:
See TracChangeset
for help on using the changeset viewer.