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

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

Issue 11644048: Revert 138209 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years 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
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/dom/Node.cpp » ('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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 , m_isAnimatingFullScreen(false) 491 , m_isAnimatingFullScreen(false)
492 #endif 492 #endif
493 , m_loadEventDelayCount(0) 493 , m_loadEventDelayCount(0)
494 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 494 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
495 , m_referrerPolicy(ReferrerPolicyDefault) 495 , m_referrerPolicy(ReferrerPolicyDefault)
496 , m_directionSetOnDocumentElement(false) 496 , m_directionSetOnDocumentElement(false)
497 , m_writingModeSetOnDocumentElement(false) 497 , m_writingModeSetOnDocumentElement(false)
498 , m_writeRecursionIsTooDeep(false) 498 , m_writeRecursionIsTooDeep(false)
499 , m_writeRecursionDepth(0) 499 , m_writeRecursionDepth(0)
500 , m_wheelEventHandlerCount(0) 500 , m_wheelEventHandlerCount(0)
501 #if ENABLE(TOUCH_EVENTS)
502 , m_touchEventHandlerCount(0)
503 #endif
504 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired) 501 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
505 , m_scheduledTasksAreSuspended(false) 502 , m_scheduledTasksAreSuspended(false)
506 , m_visualUpdatesAllowed(true) 503 , m_visualUpdatesAllowed(true)
507 , m_visualUpdatesSuppressionTimer(this, &Document::visualUpdatesSuppressionT imerFired) 504 , m_visualUpdatesSuppressionTimer(this, &Document::visualUpdatesSuppressionT imerFired)
508 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red) 505 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red)
509 #ifndef NDEBUG 506 #ifndef NDEBUG
510 , m_didDispatchViewportPropertiesChanged(false) 507 , m_didDispatchViewportPropertiesChanged(false)
511 #endif 508 #endif
512 { 509 {
513 m_document = this; 510 m_document = this;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 Document::~Document() 603 Document::~Document()
607 { 604 {
608 ASSERT(!renderer()); 605 ASSERT(!renderer());
609 ASSERT(!m_inPageCache); 606 ASSERT(!m_inPageCache);
610 ASSERT(!m_savedRenderer); 607 ASSERT(!m_savedRenderer);
611 ASSERT(m_ranges.isEmpty()); 608 ASSERT(m_ranges.isEmpty());
612 ASSERT(!m_styleRecalcTimer.isActive()); 609 ASSERT(!m_styleRecalcTimer.isActive());
613 ASSERT(!m_parentTreeScope); 610 ASSERT(!m_parentTreeScope);
614 ASSERT(!m_guardRefCount); 611 ASSERT(!m_guardRefCount);
615 612
613 #if ENABLE(TOUCH_EVENT_TRACKING)
614 if (Document* ownerDocument = this->ownerDocument())
615 ownerDocument->didRemoveEventTargetNode(this);
616 #endif
616 // FIXME: Should we reset m_domWindow when we detach from the Frame? 617 // FIXME: Should we reset m_domWindow when we detach from the Frame?
617 if (m_domWindow) 618 if (m_domWindow)
618 m_domWindow->resetUnlessSuspendedForPageCache(); 619 m_domWindow->resetUnlessSuspendedForPageCache();
619 620
620 m_scriptRunner.clear(); 621 m_scriptRunner.clear();
621 622
622 histogramMutationEventUsage(m_listenerTypes); 623 histogramMutationEventUsage(m_listenerTypes);
623 624
624 removeAllEventListeners(); 625 removeAllEventListeners();
625 626
(...skipping 4966 matching lines...) Expand 10 before | Expand all | Expand 10 after
5592 { 5593 {
5593 ASSERT(m_wheelEventHandlerCount > 0); 5594 ASSERT(m_wheelEventHandlerCount > 0);
5594 --m_wheelEventHandlerCount; 5595 --m_wheelEventHandlerCount;
5595 Frame* mainFrame = page() ? page()->mainFrame() : 0; 5596 Frame* mainFrame = page() ? page()->mainFrame() : 0;
5596 if (mainFrame) 5597 if (mainFrame)
5597 mainFrame->notifyChromeClientWheelEventHandlerCountChanged(); 5598 mainFrame->notifyChromeClientWheelEventHandlerCountChanged();
5598 5599
5599 wheelEventHandlerCountChanged(this); 5600 wheelEventHandlerCountChanged(this);
5600 } 5601 }
5601 5602
5602 void Document::didAddTouchEventHandler() 5603 void Document::didAddTouchEventHandler(Node* handler)
5603 { 5604 {
5604 #if ENABLE(TOUCH_EVENTS) 5605 #if ENABLE(TOUCH_EVENTS)
5605 ++m_touchEventHandlerCount; 5606 if (!m_touchEventTargets.get())
5606 if (m_touchEventHandlerCount > 1) 5607 m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
5608 m_touchEventTargets->add(handler);
5609 if (Document* parent = parentDocument()) {
5610 parent->didAddTouchEventHandler(this);
5607 return; 5611 return;
5608 if (Page* page = this->page()) 5612 }
5609 page->chrome()->client()->needTouchEvents(true); 5613 if (Page* page = this->page()) {
5614 #if ENABLE(TOUCH_EVENT_TRACKING)
5615 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor())
5616 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5617 #endif
5618 if (m_touchEventTargets->size() == 1)
5619 page->chrome()->client()->needTouchEvents(true);
5620 }
5621 #else
5622 UNUSED_PARAM(handler);
5610 #endif 5623 #endif
5611 } 5624 }
5612 5625
5613 void Document::didRemoveTouchEventHandler() 5626 void Document::didRemoveTouchEventHandler(Node* handler)
5614 { 5627 {
5615 #if ENABLE(TOUCH_EVENTS) 5628 #if ENABLE(TOUCH_EVENTS)
5616 ASSERT(m_touchEventHandlerCount); 5629 if (!m_touchEventTargets.get())
5617 --m_touchEventHandlerCount;
5618 if (m_touchEventHandlerCount)
5619 return; 5630 return;
5631 ASSERT(m_touchEventTargets->contains(handler));
5632 m_touchEventTargets->remove(handler);
5633 if (Document* parent = parentDocument()) {
5634 parent->didRemoveTouchEventHandler(this);
5635 return;
5636 }
5620 5637
5621 Page* page = this->page(); 5638 Page* page = this->page();
5622 if (!page) 5639 if (!page)
5623 return; 5640 return;
5641 #if ENABLE(TOUCH_EVENT_TRACKING)
5642 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( ))
5643 scrollingCoordinator->touchEventTargetRectsDidChange(this);
5644 #endif
5645 if (m_touchEventTargets->size())
5646 return;
5624 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) { 5647 for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->t raverseNext()) {
5625 if (frame->document() && frame->document()->touchEventHandlerCount()) 5648 if (frame->document() && frame->document()->hasTouchEventHandlers())
5626 return; 5649 return;
5627 } 5650 }
5628 page->chrome()->client()->needTouchEvents(false); 5651 page->chrome()->client()->needTouchEvents(false);
5652 #else
5653 UNUSED_PARAM(handler);
5629 #endif 5654 #endif
5630 } 5655 }
5631 5656
5657 #if ENABLE(TOUCH_EVENT_TRACKING)
5658 void Document::didRemoveEventTargetNode(Node* handler)
5659 {
5660 if (m_touchEventTargets.get())
5661 m_touchEventTargets->removeAll(handler);
5662 }
5663 #endif
5664
5632 HTMLIFrameElement* Document::seamlessParentIFrame() const 5665 HTMLIFrameElement* Document::seamlessParentIFrame() const
5633 { 5666 {
5634 if (!shouldDisplaySeamlesslyWithParent()) 5667 if (!shouldDisplaySeamlesslyWithParent())
5635 return 0; 5668 return 0;
5636 5669
5637 HTMLFrameOwnerElement* ownerElement = this->ownerElement(); 5670 HTMLFrameOwnerElement* ownerElement = this->ownerElement();
5638 ASSERT(ownerElement->hasTagName(iframeTag)); 5671 ASSERT(ownerElement->hasTagName(iframeTag));
5639 return static_cast<HTMLIFrameElement*>(ownerElement); 5672 return static_cast<HTMLIFrameElement*>(ownerElement);
5640 } 5673 }
5641 5674
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
5938 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL() ); 5971 m_templateContentsOwnerDocument = HTMLDocument::create(0, blankURL() );
5939 else 5972 else
5940 m_templateContentsOwnerDocument = Document::create(0, blankURL()); 5973 m_templateContentsOwnerDocument = Document::create(0, blankURL());
5941 } 5974 }
5942 5975
5943 return m_templateContentsOwnerDocument.get(); 5976 return m_templateContentsOwnerDocument.get();
5944 } 5977 }
5945 #endif 5978 #endif
5946 5979
5947 } // namespace WebCore 5980 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698