Changeset 146679 in webkit
- Timestamp:
- Mar 22, 2013, 4:43:21 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r146677 r146679 1 2013-03-22 Tim Horton <timothy_horton@apple.com> 2 3 Plugin Snapshotting: Auto-start dominant plugins 4 https://bugs.webkit.org/show_bug.cgi?id=113111 5 <rdar://problem/13475726> 6 7 Reviewed by Dean Jackson. 8 9 * html/HTMLPlugInElement.cpp: 10 (WebCore::HTMLPlugInElement::defaultEventHandler): 11 Acknowledge the new "Restarting" DisplayState. 12 * html/HTMLPlugInElement.h: 13 Rename PlayingWithPendingMouseClick to RestartingWithPendingMouseClick for accuracy. 14 Add "Restarting" DisplayState, so we can be aware that the plugin is intentionally restarting and not re-snapshot it. 15 * html/HTMLPlugInImageElement.cpp: 16 (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Remove m_isPrimarySnapshottedPlugIn. 17 (WebCore::classNameForShadowRoot): Remove m_isPrimarySnapshottedPlugIn. 18 (WebCore::HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn): Restart the plugin when it becomes primary. 19 (WebCore::HTMLPlugInImageElement::updateSnapshotInfo): Remove m_isPrimarySnapshottedPlugIn. 20 (WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn): 21 Move the plugin to Restarting unless it's already marked as PendingMouseClick. 22 (WebCore::HTMLPlugInImageElement::simulatedMouseClickTimerFired): Match the PlayingWithPendingMouseClick rename. 23 (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Don't snapshot if we're restarting. 24 * html/HTMLPlugInImageElement.h: Remove m_isPrimarySnapshottedPlugIn. 25 * rendering/RenderSnapshottedPlugIn.cpp: 26 (WebCore::RenderSnapshottedPlugIn::paint): Acknowledge the new "Restarting" DisplayState. 27 (WebCore::RenderSnapshottedPlugIn::getCursor): Acknowledge the new "Restarting" DisplayState. 28 (WebCore::RenderSnapshottedPlugIn::handleEvent): Match the PlayingWithPendingMouseClick rename. 29 1 30 2013-03-19 Martin Robinson <mrobinson@igalia.com> 2 31 -
trunk/Source/WebCore/html/HTMLPlugInElement.cpp
r145934 r146679 204 204 } 205 205 206 if (r->isSnapshottedPlugIn() && displayState() < PlayingWithPendingMouseClick) {206 if (r->isSnapshottedPlugIn() && displayState() < Restarting) { 207 207 toRenderSnapshottedPlugIn(r)->handleEvent(event); 208 208 HTMLFrameOwnerElement::defaultEventHandler(event); -
trunk/Source/WebCore/html/HTMLPlugInElement.h
r145196 r146679 52 52 WaitingForSnapshot, 53 53 DisplayingSnapshot, 54 PlayingWithPendingMouseClick, 54 Restarting, 55 RestartingWithPendingMouseClick, 55 56 Playing 56 57 }; -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r146248 r146679 77 77 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages) 78 78 , m_needsDocumentActivationCallbacks(false) 79 , m_isPrimarySnapshottedPlugIn(false)80 79 , m_simulatedMouseClickTimer(this, &HTMLPlugInImageElement::simulatedMouseClickTimerFired, simulatedMouseClickTimerDelay) 81 80 , m_swapRendererTimer(this, &HTMLPlugInImageElement::swapRendererTimerFired) … … 303 302 } 304 303 305 static AtomicString classNameForShadowRoot(const Node* node , bool isPrimary)304 static AtomicString classNameForShadowRoot(const Node* node) 306 305 { 307 306 DEFINE_STATIC_LOCAL(const AtomicString, plugInTinySizeClassName, ("tiny", AtomicString::ConstructFromLiteral)); … … 309 308 DEFINE_STATIC_LOCAL(const AtomicString, plugInMediumSizeClassName, ("medium", AtomicString::ConstructFromLiteral)); 310 309 DEFINE_STATIC_LOCAL(const AtomicString, plugInLargeSizeClassName, ("large", AtomicString::ConstructFromLiteral)); 311 DEFINE_STATIC_LOCAL(const AtomicString, plugInLargeSizePrimaryClassName, ("large primary", AtomicString::ConstructFromLiteral));312 310 313 311 RenderBox* renderBox = static_cast<RenderBox*>(node->renderer()); … … 324 322 return plugInMediumSizeClassName; 325 323 326 return isPrimary ? plugInLargeSizePrimaryClassName :plugInLargeSizeClassName;324 return plugInLargeSizeClassName; 327 325 } 328 326 329 327 void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn) 330 328 { 331 m_isPrimarySnapshottedPlugIn = isPrimarySnapshottedPlugIn; 332 333 updateSnapshotInfo(); 329 if (isPrimarySnapshottedPlugIn) 330 restartSnapshottedPlugIn(); 334 331 } 335 332 … … 341 338 342 339 Element* shadowContainer = toElement(root->firstChild()); 343 shadowContainer->setAttribute(classAttr, classNameForShadowRoot(this , m_isPrimarySnapshottedPlugIn));340 shadowContainer->setAttribute(classAttr, classNameForShadowRoot(this)); 344 341 } 345 342 … … 458 455 void HTMLPlugInImageElement::restartSnapshottedPlugIn() 459 456 { 457 if (displayState() != RestartingWithPendingMouseClick) 458 setDisplayState(Restarting); 459 460 460 reattach(); 461 461 } … … 469 469 void HTMLPlugInImageElement::simulatedMouseClickTimerFired(DeferrableOneShotTimer<HTMLPlugInImageElement>*) 470 470 { 471 ASSERT(displayState() == PlayingWithPendingMouseClick);471 ASSERT(displayState() == RestartingWithPendingMouseClick); 472 472 ASSERT(m_pendingClickEventFromSnapshot); 473 473 … … 548 548 // We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to 549 549 // reset the display state. 550 if (displayState() != PlayingWithPendingMouseClick)550 if (displayState() != RestartingWithPendingMouseClick && displayState() != Restarting) 551 551 setDisplayState(WaitingForSnapshot); 552 552 } -
trunk/Source/WebCore/html/HTMLPlugInImageElement.h
r146248 r146679 122 122 bool m_shouldPreferPlugInsForImages; 123 123 bool m_needsDocumentActivationCallbacks; 124 bool m_isPrimarySnapshottedPlugIn;125 124 RefPtr<RenderStyle> m_customStyleForPageCache; 126 125 RefPtr<MouseEvent> m_pendingClickEventFromSnapshot; -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r145934 r146679 89 89 void RenderSnapshottedPlugIn::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 90 90 { 91 if (paintInfo.phase == PaintPhaseForeground && plugInImageElement()->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick) {91 if (paintInfo.phase == PaintPhaseForeground && plugInImageElement()->displayState() < HTMLPlugInElement::Restarting) { 92 92 paintSnapshot(paintInfo, paintOffset); 93 93 } … … 141 141 CursorDirective RenderSnapshottedPlugIn::getCursor(const LayoutPoint& point, Cursor& overrideCursor) const 142 142 { 143 if (plugInImageElement()->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick) {143 if (plugInImageElement()->displayState() < HTMLPlugInElement::Restarting) { 144 144 overrideCursor = handCursor(); 145 145 return SetCursor; … … 159 159 return; 160 160 161 plugInImageElement()->setDisplayState(HTMLPlugInElement:: PlayingWithPendingMouseClick);161 plugInImageElement()->setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick); 162 162 plugInImageElement()->userDidClickSnapshot(mouseEvent); 163 163 event->setDefaultHandled(); -
trunk/Source/WebKit2/ChangeLog
r146673 r146679 1 2013-03-22 Tim Horton <timothy_horton@apple.com> 2 3 Plugin Snapshotting: Auto-start dominant plugins 4 https://bugs.webkit.org/show_bug.cgi?id=113111 5 <rdar://problem/13475726> 6 7 Reviewed by Dean Jackson. 8 9 * WebProcess/Plugins/PluginView.cpp: 10 (WebKit::PluginView::didInitializePlugin): 11 (WebKit::PluginView::paint): 12 (WebKit::PluginView::invalidateRect): 13 (WebKit::PluginView::isAcceleratedCompositingEnabled): 14 Acknowledge the new "Restarting" DisplayState. 15 1 16 2013-03-21 Jer Noble <jer.noble@apple.com> 2 17 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r146250 r146679 570 570 571 571 #if PLATFORM(MAC) 572 if (m_pluginElement->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick) {572 if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting) { 573 573 if (frame() && !frame()->settings()->maximumPlugInSnapshotAttempts()) { 574 574 m_pluginElement->setDisplayState(HTMLPlugInElement::DisplayingSnapshot); … … 710 710 void PluginView::paint(GraphicsContext* context, const IntRect& /*dirtyRect*/) 711 711 { 712 if (!m_plugin || !m_isInitialized || m_pluginElement->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick)712 if (!m_plugin || !m_isInitialized || m_pluginElement->displayState() < HTMLPlugInElement::Restarting) 713 713 return; 714 714 … … 1216 1216 #endif 1217 1217 1218 if (m_pluginElement->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick)1218 if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting) 1219 1219 return; 1220 1220 … … 1374 1374 return false; 1375 1375 1376 if (m_pluginElement->displayState() < HTMLPlugInElement:: PlayingWithPendingMouseClick)1376 if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting) 1377 1377 return false; 1378 1378 return settings->acceleratedCompositingEnabled();
Note:
See TracChangeset
for help on using the changeset viewer.