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

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

Issue 33013004: Have Document::mediaQueryMatcher() / Document::selectorQueryCache() return references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
« no previous file with comments | « Source/core/dom/Document.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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 m_scriptedAnimationController->clearDocumentPointer(); 618 m_scriptedAnimationController->clearDocumentPointer();
619 m_scriptedAnimationController.clear(); 619 m_scriptedAnimationController.clear();
620 620
621 if (svgExtensions()) 621 if (svgExtensions())
622 accessSVGExtensions()->pauseAnimations(); 622 accessSVGExtensions()->pauseAnimations();
623 623
624 m_lifecyle.advanceTo(DocumentLifecycle::Disposed); 624 m_lifecyle.advanceTo(DocumentLifecycle::Disposed);
625 lifecycleNotifier()->notifyDocumentWasDisposed(); 625 lifecycleNotifier()->notifyDocumentWasDisposed();
626 } 626 }
627 627
628 SelectorQueryCache* Document::selectorQueryCache() 628 SelectorQueryCache& Document::selectorQueryCache()
629 { 629 {
630 if (!m_selectorQueryCache) 630 if (!m_selectorQueryCache)
631 m_selectorQueryCache = adoptPtr(new SelectorQueryCache()); 631 m_selectorQueryCache = adoptPtr(new SelectorQueryCache());
632 return m_selectorQueryCache.get(); 632 return *m_selectorQueryCache;
633 } 633 }
634 634
635 MediaQueryMatcher* Document::mediaQueryMatcher() 635 MediaQueryMatcher& Document::mediaQueryMatcher()
636 { 636 {
637 if (!m_mediaQueryMatcher) 637 if (!m_mediaQueryMatcher)
638 m_mediaQueryMatcher = MediaQueryMatcher::create(this); 638 m_mediaQueryMatcher = MediaQueryMatcher::create(this);
639 return m_mediaQueryMatcher.get(); 639 return *m_mediaQueryMatcher;
640 } 640 }
641 641
642 void Document::setCompatibilityMode(CompatibilityMode mode) 642 void Document::setCompatibilityMode(CompatibilityMode mode)
643 { 643 {
644 if (m_compatibilityModeLocked || mode == m_compatibilityMode) 644 if (m_compatibilityModeLocked || mode == m_compatibilityMode)
645 return; 645 return;
646 bool wasInQuirksMode = inQuirksMode(); 646 bool wasInQuirksMode = inQuirksMode();
647 m_compatibilityMode = mode; 647 m_compatibilityMode = mode;
648 selectorQueryCache()->invalidate(); 648 selectorQueryCache().invalidate();
649 if (inQuirksMode() != wasInQuirksMode) { 649 if (inQuirksMode() != wasInQuirksMode) {
650 // All user stylesheets have to reparse using the different mode. 650 // All user stylesheets have to reparse using the different mode.
651 m_styleEngine->clearPageUserSheet(); 651 m_styleEngine->clearPageUserSheet();
652 m_styleEngine->invalidateInjectedStyleSheetCache(); 652 m_styleEngine->invalidateInjectedStyleSheetCache();
653 } 653 }
654 } 654 }
655 655
656 String Document::compatMode() const 656 String Document::compatMode() const
657 { 657 {
658 return inQuirksMode() ? "BackCompat" : "CSS1Compat"; 658 return inQuirksMode() ? "BackCompat" : "CSS1Compat";
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 m_baseURL = m_baseElementURL; 2631 m_baseURL = m_baseElementURL;
2632 else if (!m_baseURLOverride.isEmpty()) 2632 else if (!m_baseURLOverride.isEmpty())
2633 m_baseURL = m_baseURLOverride; 2633 m_baseURL = m_baseURLOverride;
2634 else { 2634 else {
2635 // The documentURI attribute is read-only from JavaScript, but writable from Objective C, so we need to retain 2635 // The documentURI attribute is read-only from JavaScript, but writable from Objective C, so we need to retain
2636 // this fallback behavior. We use a null base URL, since the documentURI attribute is an arbitrary string 2636 // this fallback behavior. We use a null base URL, since the documentURI attribute is an arbitrary string
2637 // and DOM 3 Core does not specify how it should be resolved. 2637 // and DOM 3 Core does not specify how it should be resolved.
2638 // FIXME: Now that we don't support Objective-C this can probably be rem oved. 2638 // FIXME: Now that we don't support Objective-C this can probably be rem oved.
2639 m_baseURL = KURL(ParsedURLString, documentURI()); 2639 m_baseURL = KURL(ParsedURLString, documentURI());
2640 } 2640 }
2641 selectorQueryCache()->invalidate(); 2641 selectorQueryCache().invalidate();
2642 2642
2643 if (!m_baseURL.isValid()) 2643 if (!m_baseURL.isValid())
2644 m_baseURL = KURL(); 2644 m_baseURL = KURL();
2645 2645
2646 if (m_elemSheet) { 2646 if (m_elemSheet) {
2647 // Element sheet is silly. It never contains anything. 2647 // Element sheet is silly. It never contains anything.
2648 ASSERT(!m_elemSheet->contents()->ruleCount()); 2648 ASSERT(!m_elemSheet->contents()->ruleCount());
2649 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2649 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2650 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2650 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2651 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2651 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after
5350 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5350 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5351 { 5351 {
5352 if (!isActive()) 5352 if (!isActive())
5353 return; 5353 return;
5354 5354
5355 styleEngine()->modifiedStyleSheet(sheet); 5355 styleEngine()->modifiedStyleSheet(sheet);
5356 styleResolverChanged(when, updateMode); 5356 styleResolverChanged(when, updateMode);
5357 } 5357 }
5358 5358
5359 } // namespace WebCore 5359 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698