Changeset 147693 in webkit
- Timestamp:
- Apr 4, 2013 6:25:05 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147692 r147693 1 2013-04-04 Dean Jackson <dino@apple.com> 2 3 Don't dispatch delayed click if snapshotted plugin was triggered by a click on the label 4 https://bugs.webkit.org/show_bug.cgi?id=113982 5 6 Reviewed by Tim Horton. 7 8 We regressed the way clicks were sent on to restarted plugins when we moved to a 9 Shadow Root - we were always sending the click. We should only send the click 10 on if the user clicked on the main plugin content, and not send it when you 11 click directly on the label. 12 13 * html/HTMLPlugInImageElement.cpp: 14 (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): Keep a reference to the container and label. 15 (WebCore::HTMLPlugInImageElement::partOfSnapshotLabel): New method that detects if a Node was part 16 of the snapshot label. 17 (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): Only record the event if you should forward it on. 18 * html/HTMLPlugInImageElement.h: 19 (HTMLPlugInImageElement): New parameter to userDidClickSnapshot and member variables for shadow content. 20 * rendering/RenderSnapshottedPlugIn.cpp: 21 (WebCore::RenderSnapshottedPlugIn::handleEvent): Ask the plugin if the clicked target was the snapshot label. 22 1 23 2013-04-04 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 24 -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r147659 r147693 348 348 Document* doc = document(); 349 349 350 RefPtr<Element>shadowContainer = HTMLDivElement::create(doc);351 shadowContainer->setPseudo(AtomicString("-webkit-snapshotted-plugin-content", AtomicString::ConstructFromLiteral));350 m_shadowContainer = HTMLDivElement::create(doc); 351 m_shadowContainer->setPseudo(AtomicString("-webkit-snapshotted-plugin-content", AtomicString::ConstructFromLiteral)); 352 352 353 353 RefPtr<Element> container = HTMLDivElement::create(doc); … … 358 358 container->appendChild(overlay, ASSERT_NO_EXCEPTION); 359 359 360 RefPtr<Element> label = HTMLDivElement::create(doc);361 label->setAttribute(classAttr, AtomicString("snapshot-label", AtomicString::ConstructFromLiteral));360 m_snapshotLabel = HTMLDivElement::create(doc); 361 m_snapshotLabel->setAttribute(classAttr, AtomicString("snapshot-label", AtomicString::ConstructFromLiteral)); 362 362 363 363 String titleText = snapshottedPlugInLabelTitle(); … … 375 375 title->setAttribute(classAttr, AtomicString("snapshot-title", AtomicString::ConstructFromLiteral)); 376 376 title->appendChild(doc->createTextNode(titleText), ASSERT_NO_EXCEPTION); 377 label->appendChild(title, ASSERT_NO_EXCEPTION);377 m_snapshotLabel->appendChild(title, ASSERT_NO_EXCEPTION); 378 378 379 379 RefPtr<Element> subTitle = HTMLDivElement::create(doc); 380 380 subTitle->setAttribute(classAttr, AtomicString("snapshot-subtitle", AtomicString::ConstructFromLiteral)); 381 381 subTitle->appendChild(doc->createTextNode(subtitleText), ASSERT_NO_EXCEPTION); 382 label->appendChild(subTitle, ASSERT_NO_EXCEPTION);383 384 container->appendChild( label, ASSERT_NO_EXCEPTION);382 m_snapshotLabel->appendChild(subTitle, ASSERT_NO_EXCEPTION); 383 384 container->appendChild(m_snapshotLabel, ASSERT_NO_EXCEPTION); 385 385 386 386 // Make this into a button for accessibility clients. … … 392 392 container->setAttribute(roleAttr, "button"); 393 393 394 shadowContainer->appendChild(container, ASSERT_NO_EXCEPTION); 395 root->appendChild(shadowContainer, ASSERT_NO_EXCEPTION); 394 m_shadowContainer->appendChild(container, ASSERT_NO_EXCEPTION); 395 root->appendChild(m_shadowContainer, ASSERT_NO_EXCEPTION); 396 } 397 398 bool HTMLPlugInImageElement::partOfSnapshotLabel(Node* node) 399 { 400 return node && (node == m_snapshotLabel.get() || node->isDescendantOf(m_snapshotLabel.get())); 396 401 } 397 402 … … 464 469 } 465 470 466 void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event) 467 { 468 m_pendingClickEventFromSnapshot = event; 471 void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event, bool forwardEvent) 472 { 473 if (forwardEvent) 474 m_pendingClickEventFromSnapshot = event; 475 469 476 String plugInOrigin = m_loadedUrl.host(); 470 477 if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()) && document()->page()->settings()->autostartOriginPlugInSnapshottingEnabled()) -
trunk/Source/WebCore/html/HTMLPlugInImageElement.h
r147591 r147693 75 75 void setNeedsWidgetUpdate(bool needsWidgetUpdate) { m_needsWidgetUpdate = needsWidgetUpdate; } 76 76 77 void userDidClickSnapshot(PassRefPtr<MouseEvent> );77 void userDidClickSnapshot(PassRefPtr<MouseEvent>, bool forwardEvent); 78 78 void updateSnapshotInfo(); 79 79 Image* snapshotImage() const { return m_snapshotImage.get(); } … … 84 84 85 85 void setIsPrimarySnapshottedPlugIn(bool); 86 bool partOfSnapshotLabel(Node*); 86 87 87 88 protected: … … 143 144 Timer<HTMLPlugInImageElement> m_removeSnapshotTimer; 144 145 RefPtr<Image> m_snapshotImage; 146 RefPtr<Element> m_shadowContainer; 147 RefPtr<Element> m_snapshotLabel; 145 148 bool m_createdDuringUserGesture; 146 149 bool m_restartedPlugin; -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r147240 r147693 172 172 if (event->type() == eventNames().clickEvent || (m_isPotentialMouseActivation && event->type() == eventNames().mouseupEvent)) { 173 173 m_isPotentialMouseActivation = false; 174 plugInImageElement()->setDisplayState(HTMLPlugInElement::RestartingWithPendingMouseClick); 175 plugInImageElement()->userDidClickSnapshot(mouseEvent); 174 bool clickWasOnLabel = plugInImageElement()->partOfSnapshotLabel(event->target()->toNode()); 175 plugInImageElement()->setDisplayState(clickWasOnLabel ? HTMLPlugInElement::Restarting : HTMLPlugInElement::RestartingWithPendingMouseClick); 176 plugInImageElement()->userDidClickSnapshot(mouseEvent, !clickWasOnLabel); 176 177 event->setDefaultHandled(); 177 178 } else if (event->type() == eventNames().mousedownEvent) {
Note: See TracChangeset
for help on using the changeset viewer.