Diff
Modified: tags/Safari-537.35.1/Source/WebCore/ChangeLog (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/ChangeLog 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/ChangeLog 2013-03-25 20:36:38 UTC (rev 146812)
@@ -1,5 +1,38 @@
2013-03-25 Lucas Forschler <lforsch...@apple.com>
+ Merge r146679
+
+ 2013-03-22 Tim Horton <timothy_hor...@apple.com>
+
+ Plugin Snapshotting: Auto-start dominant plugins
+ https://bugs.webkit.org/show_bug.cgi?id=113111
+ <rdar://problem/13475726>
+
+ Reviewed by Dean Jackson.
+
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::defaultEventHandler):
+ Acknowledge the new "Restarting" DisplayState.
+ * html/HTMLPlugInElement.h:
+ Rename PlayingWithPendingMouseClick to RestartingWithPendingMouseClick for accuracy.
+ Add "Restarting" DisplayState, so we can be aware that the plugin is intentionally restarting and not re-snapshot it.
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Remove m_isPrimarySnapshottedPlugIn.
+ (WebCore::classNameForShadowRoot): Remove m_isPrimarySnapshottedPlugIn.
+ (WebCore::HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn): Restart the plugin when it becomes primary.
+ (WebCore::HTMLPlugInImageElement::updateSnapshotInfo): Remove m_isPrimarySnapshottedPlugIn.
+ (WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn):
+ Move the plugin to Restarting unless it's already marked as PendingMouseClick.
+ (WebCore::HTMLPlugInImageElement::simulatedMouseClickTimerFired): Match the PlayingWithPendingMouseClick rename.
+ (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): Don't snapshot if we're restarting.
+ * html/HTMLPlugInImageElement.h: Remove m_isPrimarySnapshottedPlugIn.
+ * rendering/RenderSnapshottedPlugIn.cpp:
+ (WebCore::RenderSnapshottedPlugIn::paint): Acknowledge the new "Restarting" DisplayState.
+ (WebCore::RenderSnapshottedPlugIn::getCursor): Acknowledge the new "Restarting" DisplayState.
+ (WebCore::RenderSnapshottedPlugIn::handleEvent): Match the PlayingWithPendingMouseClick rename.
+
+2013-03-25 Lucas Forschler <lforsch...@apple.com>
+
Merge r146563
2013-03-21 Jer Noble <jer.no...@apple.com>
Modified: tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.cpp (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.cpp 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.cpp 2013-03-25 20:36:38 UTC (rev 146812)
@@ -203,7 +203,7 @@
return;
}
- if (r->isSnapshottedPlugIn() && displayState() < PlayingWithPendingMouseClick) {
+ if (r->isSnapshottedPlugIn() && displayState() < Restarting) {
toRenderSnapshottedPlugIn(r)->handleEvent(event);
HTMLFrameOwnerElement::defaultEventHandler(event);
return;
Modified: tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.h (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.h 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInElement.h 2013-03-25 20:36:38 UTC (rev 146812)
@@ -51,7 +51,8 @@
enum DisplayState {
WaitingForSnapshot,
DisplayingSnapshot,
- PlayingWithPendingMouseClick,
+ Restarting,
+ RestartingWithPendingMouseClick,
Playing
};
DisplayState displayState() const { return m_displayState; }
Modified: tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.cpp (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-03-25 20:36:38 UTC (rev 146812)
@@ -76,7 +76,6 @@
, m_needsWidgetUpdate(!createdByParser)
, m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages)
, m_needsDocumentActivationCallbacks(false)
- , m_isPrimarySnapshottedPlugIn(false)
, m_simulatedMouseClickTimer(this, &HTMLPlugInImageElement::simulatedMouseClickTimerFired, simulatedMouseClickTimerDelay)
, m_swapRendererTimer(this, &HTMLPlugInImageElement::swapRendererTimerFired)
, m_createdDuringUserGesture(ScriptController::processingUserGesture())
@@ -302,13 +301,12 @@
renderer()->repaint();
}
-static AtomicString classNameForShadowRoot(const Node* node, bool isPrimary)
+static AtomicString classNameForShadowRoot(const Node* node)
{
DEFINE_STATIC_LOCAL(const AtomicString, plugInTinySizeClassName, ("tiny", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(const AtomicString, plugInSmallSizeClassName, ("small", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(const AtomicString, plugInMediumSizeClassName, ("medium", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(const AtomicString, plugInLargeSizeClassName, ("large", AtomicString::ConstructFromLiteral));
- DEFINE_STATIC_LOCAL(const AtomicString, plugInLargeSizePrimaryClassName, ("large primary", AtomicString::ConstructFromLiteral));
RenderBox* renderBox = static_cast<RenderBox*>(node->renderer());
LayoutUnit width = renderBox->contentWidth();
@@ -323,14 +321,13 @@
if (width < sizingMediumWidthThreshold || height < sizingMediumHeightThreshold)
return plugInMediumSizeClassName;
- return isPrimary ? plugInLargeSizePrimaryClassName : plugInLargeSizeClassName;
+ return plugInLargeSizeClassName;
}
void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn)
{
- m_isPrimarySnapshottedPlugIn = isPrimarySnapshottedPlugIn;
-
- updateSnapshotInfo();
+ if (isPrimarySnapshottedPlugIn)
+ restartSnapshottedPlugIn();
}
void HTMLPlugInImageElement::updateSnapshotInfo()
@@ -340,7 +337,7 @@
return;
Element* shadowContainer = toElement(root->firstChild());
- shadowContainer->setAttribute(classAttr, classNameForShadowRoot(this, m_isPrimarySnapshottedPlugIn));
+ shadowContainer->setAttribute(classAttr, classNameForShadowRoot(this));
}
void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
@@ -457,6 +454,9 @@
void HTMLPlugInImageElement::restartSnapshottedPlugIn()
{
+ if (displayState() != RestartingWithPendingMouseClick)
+ setDisplayState(Restarting);
+
reattach();
}
@@ -468,7 +468,7 @@
void HTMLPlugInImageElement::simulatedMouseClickTimerFired(DeferrableOneShotTimer<HTMLPlugInImageElement>*)
{
- ASSERT(displayState() == PlayingWithPendingMouseClick);
+ ASSERT(displayState() == RestartingWithPendingMouseClick);
ASSERT(m_pendingClickEventFromSnapshot);
dispatchSimulatedClick(m_pendingClickEventFromSnapshot.get(), SendMouseOverUpDownEvents, DoNotShowPressedLook);
@@ -547,7 +547,7 @@
LOG(Plugins, "%p Plug-in hash %x is %dx%d, origin is not auto-start, set to wait for snapshot", this, m_plugInOriginHash, contentWidth, contentHeight);
// We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to
// reset the display state.
- if (displayState() != PlayingWithPendingMouseClick)
+ if (displayState() != RestartingWithPendingMouseClick && displayState() != Restarting)
setDisplayState(WaitingForSnapshot);
}
Modified: tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.h (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.h 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/html/HTMLPlugInImageElement.h 2013-03-25 20:36:38 UTC (rev 146812)
@@ -121,7 +121,6 @@
bool m_needsWidgetUpdate;
bool m_shouldPreferPlugInsForImages;
bool m_needsDocumentActivationCallbacks;
- bool m_isPrimarySnapshottedPlugIn;
RefPtr<RenderStyle> m_customStyleForPageCache;
RefPtr<MouseEvent> m_pendingClickEventFromSnapshot;
DeferrableOneShotTimer<HTMLPlugInImageElement> m_simulatedMouseClickTimer;
Modified: tags/Safari-537.35.1/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-03-25 20:36:38 UTC (rev 146812)
@@ -88,7 +88,7 @@
void RenderSnapshottedPlugIn::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (paintInfo.phase == PaintPhaseForeground && plugInImageElement()->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
+ if (paintInfo.phase == PaintPhaseForeground && plugInImageElement()->displayState() < HTMLPlugInElement::Restarting) {
paintSnapshot(paintInfo, paintOffset);
}
@@ -140,7 +140,7 @@
CursorDirective RenderSnapshottedPlugIn::getCursor(const LayoutPoint& point, Cursor& overrideCursor) const
{
- if (plugInImageElement()->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
+ if (plugInImageElement()->displayState() < HTMLPlugInElement::Restarting) {
overrideCursor = handCursor();
return SetCursor;
}
@@ -158,7 +158,7 @@
if (mouseEvent->button() != LeftButton)
return;
- plugInImageElement()->setDisplayState(HTMLPlugInElement::PlayingWithPendingMouseClick);
+ plugInImageElement()->setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick);
plugInImageElement()->userDidClickSnapshot(mouseEvent);
event->setDefaultHandled();
} else if (event->type() == eventNames().mousedownEvent) {
Modified: tags/Safari-537.35.1/Source/WebKit2/ChangeLog (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebKit2/ChangeLog 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebKit2/ChangeLog 2013-03-25 20:36:38 UTC (rev 146812)
@@ -1,5 +1,24 @@
2013-03-25 Lucas Forschler <lforsch...@apple.com>
+ Merge r146679
+
+ 2013-03-22 Tim Horton <timothy_hor...@apple.com>
+
+ Plugin Snapshotting: Auto-start dominant plugins
+ https://bugs.webkit.org/show_bug.cgi?id=113111
+ <rdar://problem/13475726>
+
+ Reviewed by Dean Jackson.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::didInitializePlugin):
+ (WebKit::PluginView::paint):
+ (WebKit::PluginView::invalidateRect):
+ (WebKit::PluginView::isAcceleratedCompositingEnabled):
+ Acknowledge the new "Restarting" DisplayState.
+
+2013-03-25 Lucas Forschler <lforsch...@apple.com>
+
Merge r146551
2013-03-21 Tim Horton <timothy_hor...@apple.com>
Modified: tags/Safari-537.35.1/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (146811 => 146812)
--- tags/Safari-537.35.1/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2013-03-25 20:33:27 UTC (rev 146811)
+++ tags/Safari-537.35.1/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2013-03-25 20:36:38 UTC (rev 146812)
@@ -569,7 +569,7 @@
redeliverManualStream();
#if PLATFORM(MAC)
- if (m_pluginElement->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
+ if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting) {
if (frame() && !frame()->settings()->maximumPlugInSnapshotAttempts()) {
m_pluginElement->setDisplayState(HTMLPlugInElement::DisplayingSnapshot);
return;
@@ -709,7 +709,7 @@
void PluginView::paint(GraphicsContext* context, const IntRect& /*dirtyRect*/)
{
- if (!m_plugin || !m_isInitialized || m_pluginElement->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick)
+ if (!m_plugin || !m_isInitialized || m_pluginElement->displayState() < HTMLPlugInElement::Restarting)
return;
if (context->paintingDisabled()) {
@@ -1215,7 +1215,7 @@
return;
#endif
- if (m_pluginElement->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick)
+ if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting)
return;
RenderBoxModelObject* renderer = toRenderBoxModelObject(m_pluginElement->renderer());
@@ -1373,7 +1373,7 @@
if (!settings)
return false;
- if (m_pluginElement->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick)
+ if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting)
return false;
return settings->acceleratedCompositingEnabled();
}