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

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

Issue 348893004: Rework MediaQueryMatcher to batch up listener notification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: now with it Created 6 years, 6 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/css/MediaQueryMatcher.cpp ('k') | no next file » | 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 SelectorQueryCache& Document::selectorQueryCache() 667 SelectorQueryCache& Document::selectorQueryCache()
668 { 668 {
669 if (!m_selectorQueryCache) 669 if (!m_selectorQueryCache)
670 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); 670 m_selectorQueryCache = adoptPtr(new SelectorQueryCache());
671 return *m_selectorQueryCache; 671 return *m_selectorQueryCache;
672 } 672 }
673 673
674 MediaQueryMatcher& Document::mediaQueryMatcher() 674 MediaQueryMatcher& Document::mediaQueryMatcher()
675 { 675 {
676 if (!m_mediaQueryMatcher) 676 if (!m_mediaQueryMatcher)
677 m_mediaQueryMatcher = MediaQueryMatcher::create(this); 677 m_mediaQueryMatcher = MediaQueryMatcher::create(*this);
678 return *m_mediaQueryMatcher; 678 return *m_mediaQueryMatcher;
679 } 679 }
680 680
681 void Document::mediaQueryAffectingValueChanged() 681 void Document::mediaQueryAffectingValueChanged()
682 { 682 {
683 m_evaluateMediaQueriesOnStyleRecalc = true; 683 m_evaluateMediaQueriesOnStyleRecalc = true;
684 styleEngine()->clearMediaQueryRuleSetStyleSheets(); 684 styleEngine()->clearMediaQueryRuleSetStyleSheets();
685 } 685 }
686 686
687 void Document::setCompatibilityMode(CompatibilityMode mode) 687 void Document::setCompatibilityMode(CompatibilityMode mode)
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 parentDoc->didClearTouchEventHandlers(this); 2203 parentDoc->didClearTouchEventHandlers(this);
2204 2204
2205 // This is required, as our LocalFrame might delete itself as soon as it det aches 2205 // This is required, as our LocalFrame might delete itself as soon as it det aches
2206 // us. However, this violates Node::detach() semantics, as it's never 2206 // us. However, this violates Node::detach() semantics, as it's never
2207 // possible to re-attach. Eventually Document::detach() should be renamed, 2207 // possible to re-attach. Eventually Document::detach() should be renamed,
2208 // or this setting of the frame to 0 could be made explicit in each of the 2208 // or this setting of the frame to 0 could be made explicit in each of the
2209 // callers of Document::detach(). 2209 // callers of Document::detach().
2210 m_frame = 0; 2210 m_frame = 0;
2211 2211
2212 if (m_mediaQueryMatcher) 2212 if (m_mediaQueryMatcher)
2213 m_mediaQueryMatcher->documentDestroyed(); 2213 m_mediaQueryMatcher->documentDetached();
2214 2214
2215 lifecycleNotifier().notifyDocumentWasDetached(); 2215 lifecycleNotifier().notifyDocumentWasDetached();
2216 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); 2216 m_lifecycle.advanceTo(DocumentLifecycle::Stopped);
2217 #if ENABLE(OILPAN) 2217 #if ENABLE(OILPAN)
2218 // This mirrors the clearing of the document object's touch 2218 // This mirrors the clearing of the document object's touch
2219 // handlers that happens when the LocalDOMWindow is destructed in a 2219 // handlers that happens when the LocalDOMWindow is destructed in a
2220 // non-Oilpan setting (LocalDOMWindow::removeAllEventListeners()), 2220 // non-Oilpan setting (LocalDOMWindow::removeAllEventListeners()),
2221 // except that it is now done during detach instead. 2221 // except that it is now done during detach instead.
2222 didClearTouchEventHandlers(this); 2222 didClearTouchEventHandlers(this);
2223 2223
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 { 3387 {
3388 if (!m_evaluateMediaQueriesOnStyleRecalc) 3388 if (!m_evaluateMediaQueriesOnStyleRecalc)
3389 return; 3389 return;
3390 evaluateMediaQueryList(); 3390 evaluateMediaQueryList();
3391 m_evaluateMediaQueriesOnStyleRecalc = false; 3391 m_evaluateMediaQueriesOnStyleRecalc = false;
3392 } 3392 }
3393 3393
3394 void Document::evaluateMediaQueryList() 3394 void Document::evaluateMediaQueryList()
3395 { 3395 {
3396 if (m_mediaQueryMatcher) 3396 if (m_mediaQueryMatcher)
3397 m_mediaQueryMatcher->styleResolverChanged(); 3397 m_mediaQueryMatcher->mediaFeaturesChanged();
3398 } 3398 }
3399 3399
3400 void Document::notifyResizeForViewportUnits() 3400 void Document::notifyResizeForViewportUnits()
3401 { 3401 {
3402 if (!hasViewportUnits()) 3402 if (!hasViewportUnits())
3403 return; 3403 return;
3404 ensureStyleResolver().notifyResizeForViewportUnits(); 3404 ensureStyleResolver().notifyResizeForViewportUnits();
3405 setNeedsStyleRecalcForViewportUnits(); 3405 setNeedsStyleRecalcForViewportUnits();
3406 } 3406 }
3407 3407
(...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5835 visitor->trace(m_compositorPendingAnimations); 5835 visitor->trace(m_compositorPendingAnimations);
5836 visitor->trace(m_contextDocument); 5836 visitor->trace(m_contextDocument);
5837 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5837 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5838 DocumentSupplementable::trace(visitor); 5838 DocumentSupplementable::trace(visitor);
5839 TreeScope::trace(visitor); 5839 TreeScope::trace(visitor);
5840 ContainerNode::trace(visitor); 5840 ContainerNode::trace(visitor);
5841 ExecutionContext::trace(visitor); 5841 ExecutionContext::trace(visitor);
5842 } 5842 }
5843 5843
5844 } // namespace WebCore 5844 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryMatcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698