Chromium Code Reviews

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

Issue 214383008: Rework MediaQueryMatcher to batch up listener notification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 622 matching lines...)
633 SelectorQueryCache& Document::selectorQueryCache() 633 SelectorQueryCache& Document::selectorQueryCache()
634 { 634 {
635 if (!m_selectorQueryCache) 635 if (!m_selectorQueryCache)
636 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); 636 m_selectorQueryCache = adoptPtr(new SelectorQueryCache());
637 return *m_selectorQueryCache; 637 return *m_selectorQueryCache;
638 } 638 }
639 639
640 MediaQueryMatcher& Document::mediaQueryMatcher() 640 MediaQueryMatcher& Document::mediaQueryMatcher()
641 { 641 {
642 if (!m_mediaQueryMatcher) 642 if (!m_mediaQueryMatcher)
643 m_mediaQueryMatcher = MediaQueryMatcher::create(this); 643 m_mediaQueryMatcher = MediaQueryMatcher::create(*this);
644 return *m_mediaQueryMatcher; 644 return *m_mediaQueryMatcher;
645 } 645 }
646 646
647 void Document::mediaQueryAffectingValueChanged() 647 void Document::mediaQueryAffectingValueChanged()
648 { 648 {
649 styleEngine()->clearMediaQueryRuleSetStyleSheets(); 649 styleEngine()->clearMediaQueryRuleSetStyleSheets();
650 } 650 }
651 651
652 void Document::setCompatibilityMode(CompatibilityMode mode) 652 void Document::setCompatibilityMode(CompatibilityMode mode)
653 { 653 {
(...skipping 1504 matching lines...)
2158 parentDoc->didClearTouchEventHandlers(this); 2158 parentDoc->didClearTouchEventHandlers(this);
2159 2159
2160 // This is required, as our LocalFrame might delete itself as soon as it det aches 2160 // This is required, as our LocalFrame might delete itself as soon as it det aches
2161 // us. However, this violates Node::detach() semantics, as it's never 2161 // us. However, this violates Node::detach() semantics, as it's never
2162 // possible to re-attach. Eventually Document::detach() should be renamed, 2162 // possible to re-attach. Eventually Document::detach() should be renamed,
2163 // or this setting of the frame to 0 could be made explicit in each of the 2163 // or this setting of the frame to 0 could be made explicit in each of the
2164 // callers of Document::detach(). 2164 // callers of Document::detach().
2165 m_frame = 0; 2165 m_frame = 0;
2166 2166
2167 if (m_mediaQueryMatcher) 2167 if (m_mediaQueryMatcher)
2168 m_mediaQueryMatcher->documentDestroyed(); 2168 m_mediaQueryMatcher->documentDetached();
2169 2169
2170 lifecycleNotifier().notifyDocumentWasDetached(); 2170 lifecycleNotifier().notifyDocumentWasDetached();
2171 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); 2171 m_lifecycle.advanceTo(DocumentLifecycle::Stopped);
2172 } 2172 }
2173 2173
2174 void Document::prepareForDestruction() 2174 void Document::prepareForDestruction()
2175 { 2175 {
2176 m_markers->prepareForDestruction(); 2176 m_markers->prepareForDestruction();
2177 disconnectDescendantFrames(); 2177 disconnectDescendantFrames();
2178 2178
(...skipping 1139 matching lines...)
3318 { 3318 {
3319 if (!m_evaluateMediaQueriesOnStyleRecalc) 3319 if (!m_evaluateMediaQueriesOnStyleRecalc)
3320 return; 3320 return;
3321 evaluateMediaQueryList(); 3321 evaluateMediaQueryList();
3322 m_evaluateMediaQueriesOnStyleRecalc = false; 3322 m_evaluateMediaQueriesOnStyleRecalc = false;
3323 } 3323 }
3324 3324
3325 void Document::evaluateMediaQueryList() 3325 void Document::evaluateMediaQueryList()
3326 { 3326 {
3327 if (m_mediaQueryMatcher) 3327 if (m_mediaQueryMatcher)
3328 m_mediaQueryMatcher->styleResolverChanged(); 3328 m_mediaQueryMatcher->mediaChanged();
kenneth.r.christiansen 2014/04/03 21:54:15 handleMediaChanged? actually I consider media to m
rune 2014/06/10 06:17:07 I was just looking at this in a different context.
3329 } 3329 }
3330 3330
3331 void Document::notifyResizeForViewportUnits() 3331 void Document::notifyResizeForViewportUnits()
3332 { 3332 {
3333 if (!hasViewportUnits()) 3333 if (!hasViewportUnits())
3334 return; 3334 return;
3335 ensureStyleResolver().notifyResizeForViewportUnits(); 3335 ensureStyleResolver().notifyResizeForViewportUnits();
3336 setNeedsStyleRecalcForViewportUnits(); 3336 setNeedsStyleRecalcForViewportUnits();
3337 } 3337 }
3338 3338
(...skipping 2183 matching lines...)
5522 } 5522 }
5523 5523
5524 void Document::invalidateNodeListCaches(const QualifiedName* attrName) 5524 void Document::invalidateNodeListCaches(const QualifiedName* attrName)
5525 { 5525 {
5526 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( ); 5526 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end( );
5527 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it) 5527 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument. begin(); it != end; ++it)
5528 (*it)->invalidateCache(attrName); 5528 (*it)->invalidateCache(attrName);
5529 } 5529 }
5530 5530
5531 } // namespace WebCore 5531 } // namespace WebCore
OLDNEW
« Source/core/css/MediaQueryMatcher.cpp ('K') | « Source/core/css/MediaQueryMatcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine