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

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

Issue 24773003: Rename Node::attached() to confusingAndOftenMisusedAttached() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/ContainerNodeAlgorithms.h ('k') | Source/core/dom/Element.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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 1542
1543 ASSERT(needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc()); 1543 ASSERT(needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi onRecalc());
1544 1544
1545 m_styleRecalcTimer.startOneShot(0); 1545 m_styleRecalcTimer.startOneShot(0);
1546 1546
1547 InspectorInstrumentation::didScheduleStyleRecalculation(this); 1547 InspectorInstrumentation::didScheduleStyleRecalculation(this);
1548 } 1548 }
1549 1549
1550 void Document::unscheduleStyleRecalc() 1550 void Document::unscheduleStyleRecalc()
1551 { 1551 {
1552 ASSERT(!attached() || (!needsStyleRecalc() && !childNeedsStyleRecalc())); 1552 ASSERT(!confusingAndOftenMisusedAttached() || (!needsStyleRecalc() && !child NeedsStyleRecalc()));
1553 m_styleRecalcTimer.stop(); 1553 m_styleRecalcTimer.stop();
1554 } 1554 }
1555 1555
1556 bool Document::hasPendingStyleRecalc() const 1556 bool Document::hasPendingStyleRecalc() const
1557 { 1557 {
1558 return m_styleRecalcTimer.isActive() && !m_inStyleRecalc; 1558 return m_styleRecalcTimer.isActive() && !m_inStyleRecalc;
1559 } 1559 }
1560 1560
1561 bool Document::hasPendingForcedStyleRecalc() const 1561 bool Document::hasPendingForcedStyleRecalc() const
1562 { 1562 {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); 1975 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
1976 } 1976 }
1977 1977
1978 void Document::clearStyleResolver() 1978 void Document::clearStyleResolver()
1979 { 1979 {
1980 m_styleResolver.clear(); 1980 m_styleResolver.clear();
1981 } 1981 }
1982 1982
1983 void Document::attach(const AttachContext& context) 1983 void Document::attach(const AttachContext& context)
1984 { 1984 {
1985 ASSERT(!attached()); 1985 ASSERT(!confusingAndOftenMisusedAttached());
1986 ASSERT(!m_axObjectCache || this != topDocument()); 1986 ASSERT(!m_axObjectCache || this != topDocument());
1987 1987
1988 // Create the rendering tree 1988 // Create the rendering tree
1989 setRenderer(new RenderView(this)); 1989 setRenderer(new RenderView(this));
1990 renderView()->setIsInWindow(true); 1990 renderView()->setIsInWindow(true);
1991 1991
1992 recalcStyle(Force); 1992 recalcStyle(Force);
1993 1993
1994 ContainerNode::attach(context); 1994 ContainerNode::attach(context);
1995 } 1995 }
1996 1996
1997 void Document::detach(const AttachContext& context) 1997 void Document::detach(const AttachContext& context)
1998 { 1998 {
1999 ASSERT(attached()); 1999 ASSERT(confusingAndOftenMisusedAttached());
2000 2000
2001 if (page()) 2001 if (page())
2002 page()->documentDetached(this); 2002 page()->documentDetached(this);
2003 2003
2004 if (this == topDocument()) 2004 if (this == topDocument())
2005 clearAXObjectCache(); 2005 clearAXObjectCache();
2006 2006
2007 stopActiveDOMObjects(); 2007 stopActiveDOMObjects();
2008 m_eventQueue->close(); 2008 m_eventQueue->close();
2009 2009
(...skipping 10 matching lines...) Expand all
2020 documentWillBecomeInactive(); 2020 documentWillBecomeInactive();
2021 2021
2022 SharedWorkerRepository::documentDetached(this); 2022 SharedWorkerRepository::documentDetached(this);
2023 2023
2024 if (m_frame) { 2024 if (m_frame) {
2025 FrameView* view = m_frame->view(); 2025 FrameView* view = m_frame->view();
2026 if (view) 2026 if (view)
2027 view->detachCustomScrollbars(); 2027 view->detachCustomScrollbars();
2028 } 2028 }
2029 2029
2030 // indicate destruction mode, i.e. attached() but renderer == 0 2030 // indicate destruction mode, i.e. confusingAndOftenMisusedAttached() but re nderer == 0
2031 setRenderer(0); 2031 setRenderer(0);
2032 2032
2033 m_hoverNode = 0; 2033 m_hoverNode = 0;
2034 m_focusedElement = 0; 2034 m_focusedElement = 0;
2035 m_activeElement = 0; 2035 m_activeElement = 0;
2036 2036
2037 ContainerNode::detach(context); 2037 ContainerNode::detach(context);
2038 2038
2039 unscheduleStyleRecalc(); 2039 unscheduleStyleRecalc();
2040 2040
(...skipping 17 matching lines...) Expand all
2058 2058
2059 lifecycleNotifier()->notifyDocumentWasDetached(); 2059 lifecycleNotifier()->notifyDocumentWasDetached();
2060 } 2060 }
2061 2061
2062 void Document::prepareForDestruction() 2062 void Document::prepareForDestruction()
2063 { 2063 {
2064 disconnectDescendantFrames(); 2064 disconnectDescendantFrames();
2065 2065
2066 // The process of disconnecting descendant frames could have already 2066 // The process of disconnecting descendant frames could have already
2067 // detached us. 2067 // detached us.
2068 if (!attached()) 2068 if (!confusingAndOftenMisusedAttached())
2069 return; 2069 return;
2070 2070
2071 if (DOMWindow* window = this->domWindow()) 2071 if (DOMWindow* window = this->domWindow())
2072 window->willDetachDocumentFromFrame(); 2072 window->willDetachDocumentFromFrame();
2073 detach(); 2073 detach();
2074 } 2074 }
2075 2075
2076 void Document::removeAllEventListeners() 2076 void Document::removeAllEventListeners()
2077 { 2077 {
2078 EventTarget::removeAllEventListeners(); 2078 EventTarget::removeAllEventListeners();
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3281 void Document::evaluateMediaQueryList() 3281 void Document::evaluateMediaQueryList()
3282 { 3282 {
3283 if (m_mediaQueryMatcher) 3283 if (m_mediaQueryMatcher)
3284 m_mediaQueryMatcher->styleResolverChanged(); 3284 m_mediaQueryMatcher->styleResolverChanged();
3285 } 3285 }
3286 3286
3287 void Document::styleResolverChanged(StyleResolverUpdateType updateType, StyleRes olverUpdateMode updateMode) 3287 void Document::styleResolverChanged(StyleResolverUpdateType updateType, StyleRes olverUpdateMode updateMode)
3288 { 3288 {
3289 // Don't bother updating, since we haven't loaded all our style info yet 3289 // Don't bother updating, since we haven't loaded all our style info yet
3290 // and haven't calculated the style selector for the first time. 3290 // and haven't calculated the style selector for the first time.
3291 if (!attached() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded() )) { 3291 if (!confusingAndOftenMisusedAttached() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded())) {
3292 m_styleResolver.clear(); 3292 m_styleResolver.clear();
3293 return; 3293 return;
3294 } 3294 }
3295 m_didCalculateStyleResolver = true; 3295 m_didCalculateStyleResolver = true;
3296 3296
3297 bool needsRecalc = m_styleEngine->updateActiveStyleSheets(updateMode); 3297 bool needsRecalc = m_styleEngine->updateActiveStyleSheets(updateMode);
3298 3298
3299 if (didLayoutWithPendingStylesheets() && !m_styleEngine->hasPendingSheets()) { 3299 if (didLayoutWithPendingStylesheets() && !m_styleEngine->hasPendingSheets()) {
3300 // We need to manually repaint because we avoid doing all repaints in la yout or style 3300 // We need to manually repaint because we avoid doing all repaints in la yout or style
3301 // recalc while sheets are still loading to avoid FOUC. 3301 // recalc while sheets are still loading to avoid FOUC.
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after
5449 { 5449 {
5450 return DocumentLifecycleNotifier::create(this); 5450 return DocumentLifecycleNotifier::create(this);
5451 } 5451 }
5452 5452
5453 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5453 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5454 { 5454 {
5455 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5455 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5456 } 5456 }
5457 5457
5458 } // namespace WebCore 5458 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNodeAlgorithms.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698