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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return 0; 291 return 0;
292 return toRenderWidget(renderer)->widget(); 292 return toRenderWidget(renderer)->widget();
293 } 293 }
294 294
295 static bool acceptsEditingFocus(Element* element) 295 static bool acceptsEditingFocus(Element* element)
296 { 296 {
297 ASSERT(element); 297 ASSERT(element);
298 ASSERT(element->rendererIsEditable()); 298 ASSERT(element->rendererIsEditable());
299 299
300 Element* root = element->rootEditableElement(); 300 Element* root = element->rootEditableElement();
301 Frame* frame = element->document()->frame(); 301 Frame* frame = element->document().frame();
302 if (!frame || !root) 302 if (!frame || !root)
303 return false; 303 return false;
304 304
305 return frame->editor().shouldBeginEditing(rangeOfContents(root).get()); 305 return frame->editor().shouldBeginEditing(rangeOfContents(root).get());
306 } 306 }
307 307
308 static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame* targetFrame) 308 static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame* targetFrame)
309 { 309 {
310 // targetFrame can be 0 when we're trying to navigate a top-level frame 310 // targetFrame can be 0 when we're trying to navigate a top-level frame
311 // that has a 0 opener. 311 // that has a 0 opener.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA CTERDATAMODIFIED_LISTENER), 2); 496 HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage .DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARA CTERDATAMODIFIED_LISTENER), 2);
497 } 497 }
498 498
499 static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, cons t WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner) 499 static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, cons t WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
500 { 500 {
501 if (!owner) 501 if (!owner)
502 return true; 502 return true;
503 do { 503 do {
504 if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttr ibute))) 504 if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttr ibute)))
505 return false; 505 return false;
506 } while ((owner = owner->document()->ownerElement())); 506 } while ((owner = owner->document().ownerElement()));
507 return true; 507 return true;
508 } 508 }
509 509
510 Document::~Document() 510 Document::~Document()
511 { 511 {
512 ASSERT(!renderer()); 512 ASSERT(!renderer());
513 ASSERT(m_ranges.isEmpty()); 513 ASSERT(m_ranges.isEmpty());
514 ASSERT(!m_parentTreeScope); 514 ASSERT(!m_parentTreeScope);
515 ASSERT(!hasGuardRefCount()); 515 ASSERT(!hasGuardRefCount());
516 516
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 executeScriptsWaitingForResourcesIfNeeded(); 783 executeScriptsWaitingForResourcesIfNeeded();
784 } 784 }
785 785
786 bool Document::haveImportsLoaded() const 786 bool Document::haveImportsLoaded() const
787 { 787 {
788 return !m_import || !m_import->isBlocked(); 788 return !m_import || !m_import->isBlocked();
789 } 789 }
790 790
791 PassRefPtr<DocumentFragment> Document::createDocumentFragment() 791 PassRefPtr<DocumentFragment> Document::createDocumentFragment()
792 { 792 {
793 return DocumentFragment::create(document()); 793 return DocumentFragment::create(&document());
794 } 794 }
795 795
796 PassRefPtr<Text> Document::createTextNode(const String& data) 796 PassRefPtr<Text> Document::createTextNode(const String& data)
797 { 797 {
798 return Text::create(this, data); 798 return Text::create(this, data);
799 } 799 }
800 800
801 PassRefPtr<Comment> Document::createComment(const String& data) 801 PassRefPtr<Comment> Document::createComment(const String& data)
802 { 802 {
803 return Comment::create(this, data); 803 return Comment::create(this, data);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 1002
1003 // FIXME: Use registered namespaces and look up in a hash to find the right factory. 1003 // FIXME: Use registered namespaces and look up in a hash to find the right factory.
1004 if (qName.namespaceURI() == xhtmlNamespaceURI) 1004 if (qName.namespaceURI() == xhtmlNamespaceURI)
1005 e = HTMLElementFactory::createHTMLElement(qName, this, 0, createdByParse r); 1005 e = HTMLElementFactory::createHTMLElement(qName, this, 0, createdByParse r);
1006 else if (qName.namespaceURI() == SVGNames::svgNamespaceURI) 1006 else if (qName.namespaceURI() == SVGNames::svgNamespaceURI)
1007 e = SVGElementFactory::createSVGElement(qName, this, createdByParser); 1007 e = SVGElementFactory::createSVGElement(qName, this, createdByParser);
1008 1008
1009 if (e) 1009 if (e)
1010 m_sawElementsInKnownNamespaces = true; 1010 m_sawElementsInKnownNamespaces = true;
1011 else 1011 else
1012 e = Element::create(qName, document()); 1012 e = Element::create(qName, &document());
1013 1013
1014 // <image> uses imgTag so we need a special rule. 1014 // <image> uses imgTag so we need a special rule.
1015 ASSERT((qName.matches(imageTag) && e->tagQName().matches(imgTag) && e->tagQN ame().prefix() == qName.prefix()) || qName == e->tagQName()); 1015 ASSERT((qName.matches(imageTag) && e->tagQName().matches(imgTag) && e->tagQN ame().prefix() == qName.prefix()) || qName == e->tagQName());
1016 1016
1017 return e.release(); 1017 return e.release();
1018 } 1018 }
1019 1019
1020 bool Document::regionBasedColumnsEnabled() const 1020 bool Document::regionBasedColumnsEnabled() const
1021 { 1021 {
1022 return settings() && settings()->regionBasedColumnsEnabled(); 1022 return settings() && settings()->regionBasedColumnsEnabled();
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 return 0; 1536 return 0;
1537 } 1537 }
1538 return TreeWalker::create(root, whatToShow, filter); 1538 return TreeWalker::create(root, whatToShow, filter);
1539 } 1539 }
1540 1540
1541 void Document::scheduleStyleRecalc() 1541 void Document::scheduleStyleRecalc()
1542 { 1542 {
1543 if (shouldDisplaySeamlesslyWithParent()) { 1543 if (shouldDisplaySeamlesslyWithParent()) {
1544 // When we're seamless, our parent document manages our style recalcs. 1544 // When we're seamless, our parent document manages our style recalcs.
1545 ownerElement()->setNeedsStyleRecalc(); 1545 ownerElement()->setNeedsStyleRecalc();
1546 ownerElement()->document()->scheduleStyleRecalc(); 1546 ownerElement()->document().scheduleStyleRecalc();
1547 return; 1547 return;
1548 } 1548 }
1549 1549
1550 if (m_styleRecalcTimer.isActive()) 1550 if (m_styleRecalcTimer.isActive())
1551 return; 1551 return;
1552 1552
1553 ASSERT(needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc()); 1553 ASSERT(needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc());
1554 1554
1555 m_styleRecalcTimer.startOneShot(0); 1555 m_styleRecalcTimer.startOneShot(0);
1556 1556
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 ASSERT(isMainThread()); 1733 ASSERT(isMainThread());
1734 1734
1735 FrameView* frameView = view(); 1735 FrameView* frameView = view();
1736 if (frameView && frameView->isInLayout()) { 1736 if (frameView && frameView->isInLayout()) {
1737 // View layout should not be re-entrant. 1737 // View layout should not be re-entrant.
1738 ASSERT_NOT_REACHED(); 1738 ASSERT_NOT_REACHED();
1739 return; 1739 return;
1740 } 1740 }
1741 1741
1742 if (Element* oe = ownerElement()) 1742 if (Element* oe = ownerElement())
1743 oe->document()->updateLayout(); 1743 oe->document().updateLayout();
1744 1744
1745 updateStyleIfNeeded(); 1745 updateStyleIfNeeded();
1746 1746
1747 // Only do a layout if changes have occurred that make it necessary. 1747 // Only do a layout if changes have occurred that make it necessary.
1748 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout())) 1748 if (frameView && renderer() && (frameView->layoutPending() || renderer()->ne edsLayout()))
1749 frameView->layout(); 1749 frameView->layout();
1750 1750
1751 setNeedsFocusedElementCheck(); 1751 setNeedsFocusedElementCheck();
1752 } 1752 }
1753 1753
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 recalcStyle(Force); 1789 recalcStyle(Force);
1790 } 1790 }
1791 1791
1792 updateLayout(); 1792 updateLayout();
1793 1793
1794 m_ignorePendingStylesheets = oldIgnore; 1794 m_ignorePendingStylesheets = oldIgnore;
1795 } 1795 }
1796 1796
1797 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element) 1797 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem ent* element)
1798 { 1798 {
1799 ASSERT_ARG(element, element->document() == this); 1799 ASSERT_ARG(element, &element->document() == this);
1800 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true); 1800 TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
1801 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0); 1801 return styleResolver()->styleForElement(element, element->parentNode() ? ele ment->parentNode()->computedStyle() : 0);
1802 } 1802 }
1803 1803
1804 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) 1804 PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
1805 { 1805 {
1806 return styleResolver()->styleForPage(pageIndex); 1806 return styleResolver()->styleForPage(pageIndex);
1807 } 1807 }
1808 1808
1809 bool Document::isPageBoxVisible(int pageIndex) 1809 bool Document::isPageBoxVisible(int pageIndex)
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 void Document::notifySeamlessChildDocumentsOfStylesheetUpdate() const 3170 void Document::notifySeamlessChildDocumentsOfStylesheetUpdate() const
3171 { 3171 {
3172 // If we're not in a frame yet any potential child documents won't have a St yleResolver to update. 3172 // If we're not in a frame yet any potential child documents won't have a St yleResolver to update.
3173 if (!frame()) 3173 if (!frame())
3174 return; 3174 return;
3175 3175
3176 // Seamless child frames are expected to notify their seamless children recu rsively, so we only do direct children. 3176 // Seamless child frames are expected to notify their seamless children recu rsively, so we only do direct children.
3177 for (Frame* child = frame()->tree()->firstChild(); child; child = child->tre e()->nextSibling()) { 3177 for (Frame* child = frame()->tree()->firstChild(); child; child = child->tre e()->nextSibling()) {
3178 Document* childDocument = child->document(); 3178 Document* childDocument = child->document();
3179 if (childDocument->shouldDisplaySeamlesslyWithParent()) { 3179 if (childDocument->shouldDisplaySeamlesslyWithParent()) {
3180 ASSERT(childDocument->seamlessParentIFrame()->document() == this); 3180 ASSERT(&childDocument->seamlessParentIFrame()->document() == this);
3181 childDocument->seamlessParentUpdatedStylesheets(); 3181 childDocument->seamlessParentUpdatedStylesheets();
3182 } 3182 }
3183 } 3183 }
3184 } 3184 }
3185 3185
3186 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) 3186 void Document::setHoverNode(PassRefPtr<Node> newHoverNode)
3187 { 3187 {
3188 m_hoverNode = newHoverNode; 3188 m_hoverNode = newHoverNode;
3189 } 3189 }
3190 3190
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 { 3263 {
3264 m_annotatedRegions = regions; 3264 m_annotatedRegions = regions;
3265 setAnnotatedRegionsDirty(false); 3265 setAnnotatedRegionsDirty(false);
3266 } 3266 }
3267 3267
3268 bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedElement, Focus Direction direction) 3268 bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedElement, Focus Direction direction)
3269 { 3269 {
3270 RefPtr<Element> newFocusedElement = prpNewFocusedElement; 3270 RefPtr<Element> newFocusedElement = prpNewFocusedElement;
3271 3271
3272 // Make sure newFocusedNode is actually in this document 3272 // Make sure newFocusedNode is actually in this document
3273 if (newFocusedElement && (newFocusedElement->document() != this)) 3273 if (newFocusedElement && (&newFocusedElement->document() != this))
3274 return true; 3274 return true;
3275 3275
3276 if (m_focusedElement == newFocusedElement) 3276 if (m_focusedElement == newFocusedElement)
3277 return true; 3277 return true;
3278 3278
3279 bool focusChangeBlocked = false; 3279 bool focusChangeBlocked = false;
3280 RefPtr<Element> oldFocusedElement = m_focusedElement; 3280 RefPtr<Element> oldFocusedElement = m_focusedElement;
3281 m_focusedElement = 0; 3281 m_focusedElement = 0;
3282 3282
3283 // Remove focus from the existing focus node (if any) 3283 // Remove focus from the existing focus node (if any)
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
4125 if (!m_frame) 4125 if (!m_frame)
4126 return 0; 4126 return 0;
4127 Frame* parent = m_frame->tree()->parent(); 4127 Frame* parent = m_frame->tree()->parent();
4128 if (!parent) 4128 if (!parent)
4129 return 0; 4129 return 0;
4130 return parent->document(); 4130 return parent->document();
4131 } 4131 }
4132 4132
4133 Document* Document::topDocument() const 4133 Document* Document::topDocument() const
4134 { 4134 {
4135 Document* doc = const_cast<Document *>(this); 4135 Document* doc = const_cast<Document*>(this);
4136 Element* element; 4136 Element* element;
4137 while ((element = doc->ownerElement())) 4137 while ((element = doc->ownerElement()))
4138 doc = element->document(); 4138 doc = &element->document();
4139 4139
4140 return doc; 4140 return doc;
4141 } 4141 }
4142 4142
4143 PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionState& e s) 4143 PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionState& e s)
4144 { 4144 {
4145 return createAttributeNS(String(), name, es, true); 4145 return createAttributeNS(String(), name, es, true);
4146 } 4146 }
4147 4147
4148 PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S tring& qualifiedName, ExceptionState& es, bool shouldIgnoreNamespaceChecks) 4148 PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S tring& qualifiedName, ExceptionState& es, bool shouldIgnoreNamespaceChecks)
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 securityOrigin()->grantUniversalAccess(); 4414 securityOrigin()->grantUniversalAccess();
4415 } else if (!settings->allowFileAccessFromFileURLs()) { 4415 } else if (!settings->allowFileAccessFromFileURLs()) {
4416 // Some clients want local URLs to have even tighter restriction s by default, and not be able to access other local files. 4416 // Some clients want local URLs to have even tighter restriction s by default, and not be able to access other local files.
4417 // FIXME 81578: The naming of this is confusing. Files with rest ricted access to other local files 4417 // FIXME 81578: The naming of this is confusing. Files with rest ricted access to other local files
4418 // still can have other privileges that can be remembered, there by not making them unique origins. 4418 // still can have other privileges that can be remembered, there by not making them unique origins.
4419 securityOrigin()->enforceFilePathSeparation(); 4419 securityOrigin()->enforceFilePathSeparation();
4420 } 4420 }
4421 } 4421 }
4422 } 4422 }
4423 4423
4424 Document* parentDocument = ownerElement() ? ownerElement()->document() : 0; 4424 Document* parentDocument = ownerElement() ? &ownerElement()->document() : 0;
4425 if (parentDocument && initializer.shouldTreatURLAsSrcdocDocument()) { 4425 if (parentDocument && initializer.shouldTreatURLAsSrcdocDocument()) {
4426 m_isSrcdocDocument = true; 4426 m_isSrcdocDocument = true;
4427 setBaseURLOverride(parentDocument->baseURL()); 4427 setBaseURLOverride(parentDocument->baseURL());
4428 } 4428 }
4429 4429
4430 // FIXME: What happens if we inherit the security origin? This check may nee d to be later. 4430 // FIXME: What happens if we inherit the security origin? This check may nee d to be later.
4431 // <iframe seamless src="about:blank"> likely won't work as-is. 4431 // <iframe seamless src="about:blank"> likely won't work as-is.
4432 m_mayDisplaySeamlesslyWithParent = isEligibleForSeamless(parentDocument, thi s); 4432 m_mayDisplaySeamlesslyWithParent = isEligibleForSeamless(parentDocument, thi s);
4433 4433
4434 if (!shouldInheritSecurityOriginFromOwner(m_url)) 4434 if (!shouldInheritSecurityOriginFromOwner(m_url))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 return false; 4472 return false;
4473 4473
4474 // HTML says that inline script needs browsing context to create its executi on environment. 4474 // HTML says that inline script needs browsing context to create its executi on environment.
4475 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes 4475 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht ml#event-handler-attributes
4476 // Also, if the listening node came from other document, which happens on co ntext-less event dispatching, 4476 // Also, if the listening node came from other document, which happens on co ntext-less event dispatching,
4477 // we also need to ask the owner document of the node. 4477 // we also need to ask the owner document of the node.
4478 if (!m_frame) 4478 if (!m_frame)
4479 return false; 4479 return false;
4480 if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 4480 if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript))
4481 return false; 4481 return false;
4482 if (node && node->document() != this && !node->document()->allowInlineEventH andlers(node, listener, contextURL, contextLine)) 4482 if (node && &node->document() != this && !node->document().allowInlineEventH andlers(node, listener, contextURL, contextLine))
4483 return false; 4483 return false;
4484 4484
4485 return true; 4485 return true;
4486 } 4486 }
4487 4487
4488 void Document::didUpdateSecurityOrigin() 4488 void Document::didUpdateSecurityOrigin()
4489 { 4489 {
4490 if (!m_frame) 4490 if (!m_frame)
4491 return; 4491 return;
4492 m_frame->script()->updateSecurityOrigin(); 4492 m_frame->script()->updateSecurityOrigin();
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 if (m_topLayerElements.isEmpty()) 4791 if (m_topLayerElements.isEmpty())
4792 return 0; 4792 return 0;
4793 return static_cast<HTMLDialogElement*>(m_topLayerElements.last().get()); 4793 return static_cast<HTMLDialogElement*>(m_topLayerElements.last().get());
4794 } 4794 }
4795 4795
4796 void Document::webkitExitPointerLock() 4796 void Document::webkitExitPointerLock()
4797 { 4797 {
4798 if (!page()) 4798 if (!page())
4799 return; 4799 return;
4800 if (Element* target = page()->pointerLockController().element()) { 4800 if (Element* target = page()->pointerLockController().element()) {
4801 if (target->document() != this) 4801 if (&target->document() != this)
4802 return; 4802 return;
4803 } 4803 }
4804 page()->pointerLockController().requestPointerUnlock(); 4804 page()->pointerLockController().requestPointerUnlock();
4805 } 4805 }
4806 4806
4807 Element* Document::webkitPointerLockElement() const 4807 Element* Document::webkitPointerLockElement() const
4808 { 4808 {
4809 if (!page() || page()->pointerLockController().lockPending()) 4809 if (!page() || page()->pointerLockController().lockPending())
4810 return 0; 4810 return 0;
4811 if (Element* element = page()->pointerLockController().element()) { 4811 if (Element* element = page()->pointerLockController().element()) {
4812 if (element->document() == this) 4812 if (&element->document() == this)
4813 return element; 4813 return element;
4814 } 4814 }
4815 return 0; 4815 return 0;
4816 } 4816 }
4817 4817
4818 void Document::decrementLoadEventDelayCount() 4818 void Document::decrementLoadEventDelayCount()
4819 { 4819 {
4820 ASSERT(m_loadEventDelayCount); 4820 ASSERT(m_loadEventDelayCount);
4821 --m_loadEventDelayCount; 4821 --m_loadEventDelayCount;
4822 4822
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
5083 } 5083 }
5084 5084
5085 return 0; 5085 return 0;
5086 } 5086 }
5087 5087
5088 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in nerElement, const PlatformMouseEvent* event) 5088 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in nerElement, const PlatformMouseEvent* event)
5089 { 5089 {
5090 ASSERT(!request.readOnly()); 5090 ASSERT(!request.readOnly());
5091 5091
5092 Element* innerElementInDocument = innerElement; 5092 Element* innerElementInDocument = innerElement;
5093 while (innerElementInDocument && innerElementInDocument->document() != this) { 5093 while (innerElementInDocument && &innerElementInDocument->document() != this ) {
5094 innerElementInDocument->document()->updateHoverActiveState(request, inne rElementInDocument, event); 5094 innerElementInDocument->document().updateHoverActiveState(request, inner ElementInDocument, event);
5095 innerElementInDocument = innerElementInDocument->document()->ownerElemen t(); 5095 innerElementInDocument = innerElementInDocument->document().ownerElement ();
5096 } 5096 }
5097 5097
5098 Element* oldActiveElement = activeElement(); 5098 Element* oldActiveElement = activeElement();
5099 if (oldActiveElement && !request.active()) { 5099 if (oldActiveElement && !request.active()) {
5100 // We are clearing the :active chain because the mouse has been released . 5100 // We are clearing the :active chain because the mouse has been released .
5101 for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = cur r->parent()) { 5101 for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = cur r->parent()) {
5102 if (curr->node()) { 5102 if (curr->node()) {
5103 ASSERT(!curr->node()->isTextNode()); 5103 ASSERT(!curr->node()->isTextNode());
5104 curr->node()->setActive(false); 5104 curr->node()->setActive(false);
5105 m_userActionElements.setInActiveChain(curr->node(), false); 5105 m_userActionElements.setInActiveChain(curr->node(), false);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 { 5294 {
5295 return DocumentLifecycleNotifier::create(this); 5295 return DocumentLifecycleNotifier::create(this);
5296 } 5296 }
5297 5297
5298 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5298 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5299 { 5299 {
5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5301 } 5301 }
5302 5302
5303 } // namespace WebCore 5303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/CustomElementRegistrationContext.cpp ('k') | Source/core/dom/DocumentEventQueue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698