Changeset 147240 in webkit
- Timestamp:
- Mar 29, 2013 12:31:45 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147238 r147240 1 2013-03-29 Dean Jackson <dino@apple.com> 2 3 Snapshotted plugins must be able to restart on appropriate mouseup events 4 https://bugs.webkit.org/show_bug.cgi?id=113577 5 6 Reviewed by Tim Horton. 7 8 If the page content prevents the default behaviour of a mousedown event, then a snapshotted 9 plugin would never receive a click event, and thus be unable to restart. We have to also 10 look for a mouseup that happens with an associated mousedown, and trigger restart. This 11 won't call any page code - it's just behind the scenes. 12 13 * rendering/RenderSnapshottedPlugIn.cpp: 14 (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn): Initialize new member variable. 15 (WebCore::RenderSnapshottedPlugIn::handleEvent): Track the state of mousedown and up pairs, and restart 16 if you see an appropriate mouseup. 17 * rendering/RenderSnapshottedPlugIn.h: New member variable to track mouse state. 18 1 19 2013-03-29 Simon Fraser <simon.fraser@apple.com> 2 20 -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r146679 r147240 47 47 : RenderEmbeddedObject(element) 48 48 , m_snapshotResource(RenderImageResource::create()) 49 , m_isPotentialMouseActivation(false) 49 50 { 50 51 m_snapshotResource->initialize(this); … … 155 156 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); 156 157 157 if (event->type() == eventNames().clickEvent) { 158 if (mouseEvent->button() != LeftButton) 159 return; 158 // If we're a snapshotted plugin, we want to make sure we activate on 159 // clicks even if the page is preventing our default behaviour. Otherwise 160 // we can never restart. One we do restart, then the page will happily 161 // block the new plugin in the normal renderer. All this means we have to 162 // be on the lookout for a mouseup event that comes after a mousedown 163 // event. The code below is not completely foolproof, but the worst that 164 // could happen is that a snapshotted plugin restarts. 160 165 166 if (event->type() == eventNames().mouseoutEvent) 167 m_isPotentialMouseActivation = false; 168 169 if (mouseEvent->button() != LeftButton) 170 return; 171 172 if (event->type() == eventNames().clickEvent || (m_isPotentialMouseActivation && event->type() == eventNames().mouseupEvent)) { 173 m_isPotentialMouseActivation = false; 161 174 plugInImageElement()->setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick); 162 175 plugInImageElement()->userDidClickSnapshot(mouseEvent); 163 176 event->setDefaultHandled(); 164 177 } else if (event->type() == eventNames().mousedownEvent) { 165 if (mouseEvent->button() != LeftButton) 166 return; 167 178 m_isPotentialMouseActivation = true; 168 179 event->setDefaultHandled(); 169 180 } -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h
r145934 r147240 59 59 60 60 OwnPtr<RenderImageResource> m_snapshotResource; 61 bool m_isPotentialMouseActivation; 61 62 }; 62 63
Note: See TracChangeset
for help on using the changeset viewer.