Title: [147452] tags/Safari-537.35.6/Source/WebCore
- Revision
- 147452
- Author
- [email protected]
- Date
- 2013-04-02 10:50:14 -0700 (Tue, 02 Apr 2013)
Log Message
Merged r147240. <rdar://problem/13256956>
Modified Paths
Diff
Modified: tags/Safari-537.35.6/Source/WebCore/ChangeLog (147451 => 147452)
--- tags/Safari-537.35.6/Source/WebCore/ChangeLog 2013-04-02 17:49:32 UTC (rev 147451)
+++ tags/Safari-537.35.6/Source/WebCore/ChangeLog 2013-04-02 17:50:14 UTC (rev 147452)
@@ -1,5 +1,27 @@
2013-04-01 Lucas Forschler <[email protected]>
+ Merge r147240
+
+ 2013-03-29 Dean Jackson <[email protected]>
+
+ Snapshotted plugins must be able to restart on appropriate mouseup events
+ https://bugs.webkit.org/show_bug.cgi?id=113577
+
+ Reviewed by Tim Horton.
+
+ If the page content prevents the default behaviour of a mousedown event, then a snapshotted
+ plugin would never receive a click event, and thus be unable to restart. We have to also
+ look for a mouseup that happens with an associated mousedown, and trigger restart. This
+ won't call any page code - it's just behind the scenes.
+
+ * rendering/RenderSnapshottedPlugIn.cpp:
+ (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn): Initialize new member variable.
+ (WebCore::RenderSnapshottedPlugIn::handleEvent): Track the state of mousedown and up pairs, and restart
+ if you see an appropriate mouseup.
+ * rendering/RenderSnapshottedPlugIn.h: New member variable to track mouse state.
+
+2013-04-01 Lucas Forschler <[email protected]>
+
Merge r146995
2013-03-27 Dean Jackson <[email protected]>
Modified: tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (147451 => 147452)
--- tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-04-02 17:49:32 UTC (rev 147451)
+++ tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-04-02 17:50:14 UTC (rev 147452)
@@ -46,6 +46,7 @@
RenderSnapshottedPlugIn::RenderSnapshottedPlugIn(HTMLPlugInImageElement* element)
: RenderEmbeddedObject(element)
, m_snapshotResource(RenderImageResource::create())
+ , m_isPotentialMouseActivation(false)
{
m_snapshotResource->initialize(this);
}
@@ -154,17 +155,27 @@
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
- if (event->type() == eventNames().clickEvent) {
- if (mouseEvent->button() != LeftButton)
- return;
+ // If we're a snapshotted plugin, we want to make sure we activate on
+ // clicks even if the page is preventing our default behaviour. Otherwise
+ // we can never restart. One we do restart, then the page will happily
+ // block the new plugin in the normal renderer. All this means we have to
+ // be on the lookout for a mouseup event that comes after a mousedown
+ // event. The code below is not completely foolproof, but the worst that
+ // could happen is that a snapshotted plugin restarts.
+ if (event->type() == eventNames().mouseoutEvent)
+ m_isPotentialMouseActivation = false;
+
+ if (mouseEvent->button() != LeftButton)
+ return;
+
+ if (event->type() == eventNames().clickEvent || (m_isPotentialMouseActivation && event->type() == eventNames().mouseupEvent)) {
+ m_isPotentialMouseActivation = false;
plugInImageElement()->setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick);
plugInImageElement()->userDidClickSnapshot(mouseEvent);
event->setDefaultHandled();
} else if (event->type() == eventNames().mousedownEvent) {
- if (mouseEvent->button() != LeftButton)
- return;
-
+ m_isPotentialMouseActivation = true;
event->setDefaultHandled();
}
}
Modified: tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.h (147451 => 147452)
--- tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2013-04-02 17:49:32 UTC (rev 147451)
+++ tags/Safari-537.35.6/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2013-04-02 17:50:14 UTC (rev 147452)
@@ -58,6 +58,7 @@
virtual void layout() OVERRIDE;
OwnPtr<RenderImageResource> m_snapshotResource;
+ bool m_isPotentialMouseActivation;
};
inline RenderSnapshottedPlugIn* toRenderSnapshottedPlugIn(RenderObject* object)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes