Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 14280004: Revert removal of events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 #include "Settings.h" 162 #include "Settings.h"
163 #include "ShadowRoot.h" 163 #include "ShadowRoot.h"
164 #include "StaticHashSetNodeList.h" 164 #include "StaticHashSetNodeList.h"
165 #include "StylePropertySet.h" 165 #include "StylePropertySet.h"
166 #include "StyleResolver.h" 166 #include "StyleResolver.h"
167 #include "StyleSheetContents.h" 167 #include "StyleSheetContents.h"
168 #include "StyleSheetList.h" 168 #include "StyleSheetList.h"
169 #include "TextAutosizer.h" 169 #include "TextAutosizer.h"
170 #include "TextResourceDecoder.h" 170 #include "TextResourceDecoder.h"
171 #include "Timer.h" 171 #include "Timer.h"
172 #include "TouchList.h"
173 #include "TraceEvent.h" 172 #include "TraceEvent.h"
174 #include "TransformSource.h" 173 #include "TransformSource.h"
175 #include "TreeWalker.h" 174 #include "TreeWalker.h"
176 #include "UserActionElementSet.h" 175 #include "UserActionElementSet.h"
177 #include "UserContentURLPattern.h" 176 #include "UserContentURLPattern.h"
178 #include "VisitedLinkState.h" 177 #include "VisitedLinkState.h"
179 #include "WebCoreMemoryInstrumentation.h" 178 #include "WebCoreMemoryInstrumentation.h"
180 #include "XMLDocumentParser.h" 179 #include "XMLDocumentParser.h"
181 #include "XMLHttpRequest.h" 180 #include "XMLHttpRequest.h"
182 #include "XMLNSNames.h" 181 #include "XMLNSNames.h"
(...skipping 20 matching lines...) Expand all
203 #endif 202 #endif
204 203
205 #if ENABLE(SVG) 204 #if ENABLE(SVG)
206 #include "SVGDocumentExtensions.h" 205 #include "SVGDocumentExtensions.h"
207 #include "SVGElementFactory.h" 206 #include "SVGElementFactory.h"
208 #include "SVGNames.h" 207 #include "SVGNames.h"
209 #include "SVGSVGElement.h" 208 #include "SVGSVGElement.h"
210 #include "SVGStyleElement.h" 209 #include "SVGStyleElement.h"
211 #endif 210 #endif
212 211
212 #if ENABLE(TOUCH_EVENTS)
213 #include "TouchList.h"
214 #endif
215
213 #if ENABLE(MATHML) 216 #if ENABLE(MATHML)
214 #include "MathMLElement.h" 217 #include "MathMLElement.h"
215 #include "MathMLElementFactory.h" 218 #include "MathMLElementFactory.h"
216 #include "MathMLNames.h" 219 #include "MathMLNames.h"
217 #endif 220 #endif
218 221
219 #include "CaptionUserPreferences.h" 222 #include "CaptionUserPreferences.h"
220 223
221 using namespace std; 224 using namespace std;
222 using namespace WTF; 225 using namespace WTF;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 ASSERT(!m_inPageCache); 548 ASSERT(!m_inPageCache);
546 ASSERT(!m_savedRenderer); 549 ASSERT(!m_savedRenderer);
547 ASSERT(m_ranges.isEmpty()); 550 ASSERT(m_ranges.isEmpty());
548 ASSERT(!m_styleRecalcTimer.isActive()); 551 ASSERT(!m_styleRecalcTimer.isActive());
549 ASSERT(!m_parentTreeScope); 552 ASSERT(!m_parentTreeScope);
550 ASSERT(!hasGuardRefCount()); 553 ASSERT(!hasGuardRefCount());
551 554
552 if (m_templateDocument) 555 if (m_templateDocument)
553 m_templateDocument->setTemplateDocumentHost(0); // balanced in templateD ocument(). 556 m_templateDocument->setTemplateDocumentHost(0); // balanced in templateD ocument().
554 557
558 #if ENABLE(TOUCH_EVENT_TRACKING)
555 if (Document* ownerDocument = this->ownerDocument()) 559 if (Document* ownerDocument = this->ownerDocument())
556 ownerDocument->didRemoveEventTargetNode(this); 560 ownerDocument->didRemoveEventTargetNode(this);
561 #endif
557 // FIXME: Should we reset m_domWindow when we detach from the Frame? 562 // FIXME: Should we reset m_domWindow when we detach from the Frame?
558 if (m_domWindow) 563 if (m_domWindow)
559 m_domWindow->resetUnlessSuspendedForPageCache(); 564 m_domWindow->resetUnlessSuspendedForPageCache();
560 565
561 m_scriptRunner.clear(); 566 m_scriptRunner.clear();
562 567
563 histogramMutationEventUsage(m_listenerTypes); 568 histogramMutationEventUsage(m_listenerTypes);
564 569
565 removeAllEventListeners(); 570 removeAllEventListeners();
566 571
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 m_focusedNode = 0; 2004 m_focusedNode = 0;
2000 m_activeElement = 0; 2005 m_activeElement = 0;
2001 2006
2002 ContainerNode::detach(); 2007 ContainerNode::detach();
2003 2008
2004 unscheduleStyleRecalc(); 2009 unscheduleStyleRecalc();
2005 2010
2006 if (render) 2011 if (render)
2007 render->destroy(); 2012 render->destroy();
2008 2013
2014 #if ENABLE(TOUCH_EVENTS)
2009 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument()) 2015 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument())
2010 parentDocument()->didRemoveEventTargetNode(this); 2016 parentDocument()->didRemoveEventTargetNode(this);
2017 #endif
2011 2018
2012 // This is required, as our Frame might delete itself as soon as it detaches 2019 // This is required, as our Frame might delete itself as soon as it detaches
2013 // us. However, this violates Node::detach() semantics, as it's never 2020 // us. However, this violates Node::detach() semantics, as it's never
2014 // possible to re-attach. Eventually Document::detach() should be renamed, 2021 // possible to re-attach. Eventually Document::detach() should be renamed,
2015 // or this setting of the frame to 0 could be made explicit in each of the 2022 // or this setting of the frame to 0 could be made explicit in each of the
2016 // callers of Document::detach(). 2023 // callers of Document::detach().
2017 m_frame = 0; 2024 m_frame = 0;
2018 m_renderArena.clear(); 2025 m_renderArena.clear();
2019 2026
2020 if (m_mediaQueryMatcher) 2027 if (m_mediaQueryMatcher)
(...skipping 3383 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 m_scriptedAnimationController->cancelCallback(id); 5411 m_scriptedAnimationController->cancelCallback(id);
5405 } 5412 }
5406 5413
5407 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) 5414 void Document::serviceScriptedAnimations(double monotonicAnimationStartTime)
5408 { 5415 {
5409 if (!m_scriptedAnimationController) 5416 if (!m_scriptedAnimationController)
5410 return; 5417 return;
5411 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS tartTime); 5418 m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationS tartTime);
5412 } 5419 }
5413 5420
5421 #if ENABLE(TOUCH_EVENTS)
5414 PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const 5422 PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const
5415 { 5423 {
5416 // FIXME: It's not clear from the documentation at 5424 // FIXME: It's not clear from the documentation at
5417 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html 5425 // http://developer.apple.com/library/safari/#documentation/UserExperience/R eference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
5418 // when this method should throw and nor is it by inspection of iOS behavior . It would be nice to verify any cases where it throws under iOS 5426 // when this method should throw and nor is it by inspection of iOS behavior . It would be nice to verify any cases where it throws under iOS
5419 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9 5427 // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=4781 9
5420 Frame* frame = window ? window->frame() : this->frame(); 5428 Frame* frame = window ? window->frame() : this->frame();
5421 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag eY, radiusX, radiusY, rotationAngle, force); 5429 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag eY, radiusX, radiusY, rotationAngle, force);
5422 } 5430 }
5431 #endif
5423 5432
5424 static void wheelEventHandlerCountChanged(Document* document) 5433 static void wheelEventHandlerCountChanged(Document* document)
5425 { 5434 {
5426 Page* page = document->page(); 5435 Page* page = document->page();
5427 if (!page) 5436 if (!page)
5428 return; 5437 return;
5429 5438
5430 ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(); 5439 ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator();
5431 if (!scrollingCoordinator) 5440 if (!scrollingCoordinator)
5432 return; 5441 return;
(...skipping 21 matching lines...) Expand all
5454 --m_wheelEventHandlerCount; 5463 --m_wheelEventHandlerCount;
5455 Frame* mainFrame = page() ? page()->mainFrame() : 0; 5464 Frame* mainFrame = page() ? page()->mainFrame() : 0;
5456 if (mainFrame) 5465 if (mainFrame)
5457 mainFrame->notifyChromeClientWheelEventHandlerCountChanged(); 5466 mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
5458 5467
5459 wheelEventHandlerCountChanged(this); 5468 wheelEventHandlerCountChanged(this);
5460 } 5469 }
5461 5470
5462 void Document::didAddTouchEventHandler(Node* handler) 5471 void Document::didAddTouchEventHandler(Node* handler)
5463 { 5472 {
5473 #if ENABLE(TOUCH_EVENTS)
5464 if (!m_touchEventTargets.get()) 5474 if (!m_touchEventTargets.get())
5465 m_touchEventTargets = adoptPtr(new TouchEventTargetSet); 5475 m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
5466 m_touchEventTargets->add(handler); 5476 m_touchEventTargets->add(handler);
5467 if (Document* parent = parentDocument()) { 5477 if (Document* parent = parentDocument()) {
5468 parent->didAddTouchEventHandler(this); 5478 parent->didAddTouchEventHandler(this);
5469 return; 5479 return;
5470 } 5480 }
5471 if (Page* page = this->page()) { 5481 if (Page* page = this->page()) {
5482 #if ENABLE(TOUCH_EVENT_TRACKING)
5472 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) 5483 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
5473 scrollingCoordinator->touchEventTargetRectsDidChange(this); 5484 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5485 #endif
5474 if (m_touchEventTargets->size() == 1) 5486 if (m_touchEventTargets->size() == 1)
5475 page->chrome()->client()->needTouchEvents(true); 5487 page->chrome()->client()->needTouchEvents(true);
5476 } 5488 }
5489 #else
5490 UNUSED_PARAM(handler);
5491 #endif
5477 } 5492 }
5478 5493
5479 void Document::didRemoveTouchEventHandler(Node* handler) 5494 void Document::didRemoveTouchEventHandler(Node* handler)
5480 { 5495 {
5496 #if ENABLE(TOUCH_EVENTS)
5481 if (!m_touchEventTargets.get()) 5497 if (!m_touchEventTargets.get())
5482 return; 5498 return;
5483 ASSERT(m_touchEventTargets->contains(handler)); 5499 ASSERT(m_touchEventTargets->contains(handler));
5484 m_touchEventTargets->remove(handler); 5500 m_touchEventTargets->remove(handler);
5485 if (Document* parent = parentDocument()) { 5501 if (Document* parent = parentDocument()) {
5486 parent->didRemoveTouchEventHandler(this); 5502 parent->didRemoveTouchEventHandler(this);
5487 return; 5503 return;
5488 } 5504 }
5489 5505
5490 Page* page = this->page(); 5506 Page* page = this->page();
5491 if (!page) 5507 if (!page)
5492 return; 5508 return;
5509 #if ENABLE(TOUCH_EVENT_TRACKING)
5493 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( )) 5510 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( ))
5494 scrollingCoordinator->touchEventTargetRectsDidChange(this); 5511 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5512 #endif
5495 if (m_touchEventTargets->size()) 5513 if (m_touchEventTargets->size())
5496 return; 5514 return;
5497 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) { 5515 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) {
5498 if (frame->document() && frame->document()->hasTouchEventHandlers()) 5516 if (frame->document() && frame->document()->hasTouchEventHandlers())
5499 return; 5517 return;
5500 } 5518 }
5501 page->chrome()->client()->needTouchEvents(false); 5519 page->chrome()->client()->needTouchEvents(false);
5520 #else
5521 UNUSED_PARAM(handler);
5522 #endif
5502 } 5523 }
5503 5524
5525 #if ENABLE(TOUCH_EVENTS)
5504 void Document::didRemoveEventTargetNode(Node* handler) 5526 void Document::didRemoveEventTargetNode(Node* handler)
5505 { 5527 {
5506 if (m_touchEventTargets) { 5528 if (m_touchEventTargets) {
5507 m_touchEventTargets->removeAll(handler); 5529 m_touchEventTargets->removeAll(handler);
5508 if ((handler == this || m_touchEventTargets->isEmpty()) && parentDocumen t()) 5530 if ((handler == this || m_touchEventTargets->isEmpty()) && parentDocumen t())
5509 parentDocument()->didRemoveEventTargetNode(this); 5531 parentDocument()->didRemoveEventTargetNode(this);
5510 } 5532 }
5511 } 5533 }
5534 #endif
5512 5535
5513 void Document::resetLastHandledUserGestureTimestamp() 5536 void Document::resetLastHandledUserGestureTimestamp()
5514 { 5537 {
5515 m_lastHandledUserGestureTimestamp = currentTime(); 5538 m_lastHandledUserGestureTimestamp = currentTime();
5516 } 5539 }
5517 5540
5518 HTMLIFrameElement* Document::seamlessParentIFrame() const 5541 HTMLIFrameElement* Document::seamlessParentIFrame() const
5519 { 5542 {
5520 if (!shouldDisplaySeamlesslyWithParent()) 5543 if (!shouldDisplaySeamlesslyWithParent())
5521 return 0; 5544 return 0;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5815 info.addMember(m_fullScreenChangeEventTargetQueue, "fullScreenChangeEventTar getQueue"); 5838 info.addMember(m_fullScreenChangeEventTargetQueue, "fullScreenChangeEventTar getQueue");
5816 info.addMember(m_fullScreenErrorEventTargetQueue, "fullScreenErrorEventTarge tQueue"); 5839 info.addMember(m_fullScreenErrorEventTargetQueue, "fullScreenErrorEventTarge tQueue");
5817 info.addMember(m_savedPlaceholderRenderStyle, "savedPlaceholderRenderStyle") ; 5840 info.addMember(m_savedPlaceholderRenderStyle, "savedPlaceholderRenderStyle") ;
5818 #if ENABLE(DIALOG_ELEMENT) 5841 #if ENABLE(DIALOG_ELEMENT)
5819 info.addMember(m_topLayerElements, "topLayerElements"); 5842 info.addMember(m_topLayerElements, "topLayerElements");
5820 #endif 5843 #endif
5821 info.addMember(m_loadEventDelayTimer, "loadEventDelayTimer"); 5844 info.addMember(m_loadEventDelayTimer, "loadEventDelayTimer");
5822 info.addMember(m_viewportArguments, "viewportArguments"); 5845 info.addMember(m_viewportArguments, "viewportArguments");
5823 info.addMember(m_documentTiming, "documentTiming"); 5846 info.addMember(m_documentTiming, "documentTiming");
5824 info.addMember(m_mediaQueryMatcher, "mediaQueryMatcher"); 5847 info.addMember(m_mediaQueryMatcher, "mediaQueryMatcher");
5848 #if ENABLE(TOUCH_EVENTS)
5825 info.addMember(m_touchEventTargets, "touchEventTargets"); 5849 info.addMember(m_touchEventTargets, "touchEventTargets");
5850 #endif
5826 info.addMember(m_scriptedAnimationController, "scriptedAnimationController") ; 5851 info.addMember(m_scriptedAnimationController, "scriptedAnimationController") ;
5827 info.addMember(m_pendingTasksTimer, "pendingTasksTimer"); 5852 info.addMember(m_pendingTasksTimer, "pendingTasksTimer");
5828 info.addMember(m_textAutosizer, "textAutosizer"); 5853 info.addMember(m_textAutosizer, "textAutosizer");
5829 info.addMember(m_namedFlows, "namedFlows"); 5854 info.addMember(m_namedFlows, "namedFlows");
5830 info.addMember(m_domSecurityPolicy, "domSecurityPolicy"); 5855 info.addMember(m_domSecurityPolicy, "domSecurityPolicy");
5831 info.addMember(m_sharedObjectPoolClearTimer, "sharedObjectPoolClearTimer"); 5856 info.addMember(m_sharedObjectPoolClearTimer, "sharedObjectPoolClearTimer");
5832 info.addMember(m_sharedObjectPool, "sharedObjectPool"); 5857 info.addMember(m_sharedObjectPool, "sharedObjectPool");
5833 info.addMember(m_localeCache, "localeCache"); 5858 info.addMember(m_localeCache, "localeCache");
5834 info.addMember(m_templateDocument, "templateDocument"); 5859 info.addMember(m_templateDocument, "templateDocument");
5835 info.addMember(m_templateDocumentHost, "templateDocumentHost"); 5860 info.addMember(m_templateDocumentHost, "templateDocumentHost");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5890 return; 5915 return;
5891 5916
5892 Vector<RefPtr<Element> > associatedFormControls; 5917 Vector<RefPtr<Element> > associatedFormControls;
5893 copyToVector(m_associatedFormControls, associatedFormControls); 5918 copyToVector(m_associatedFormControls, associatedFormControls);
5894 5919
5895 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); 5920 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls);
5896 m_associatedFormControls.clear(); 5921 m_associatedFormControls.clear();
5897 } 5922 }
5898 5923
5899 } // namespace WebCore 5924 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698