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

Side by Side Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 1769903002: Move preferred stylesheet logic into StyleEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 if (!enabled) { 707 if (!enabled) {
708 m_styleResolverStats = nullptr; 708 m_styleResolverStats = nullptr;
709 return; 709 return;
710 } 710 }
711 if (!m_styleResolverStats) 711 if (!m_styleResolverStats)
712 m_styleResolverStats = StyleResolverStats::create(); 712 m_styleResolverStats = StyleResolverStats::create();
713 else 713 else
714 m_styleResolverStats->reset(); 714 m_styleResolverStats->reset();
715 } 715 }
716 716
717 void StyleEngine::setPreferredStylesheetSetNameIfNotSet(const String& name)
718 {
719 if (!m_preferredStylesheetSetName.isEmpty())
720 return;
721 m_preferredStylesheetSetName = name;
722 // TODO(rune@opera.com): Setting the selected set here is wrong if the set
723 // has been previously set by through Document.selectedStylesheetSet. Our
724 // current implementation ignores the effect of Document.selectedStylesheetS et
725 // and either only collects persistent style, or additionally preferred
726 // style when present. We are currently not marking the document scope dirty
727 // because preferred style is updated during active stylesheet update which
728 // would make this method re-entrant. Will need to change for async update.
729 m_selectedStylesheetSetName = name;
730 }
731
732 void StyleEngine::setSelectedStylesheetSetName(const String& name)
733 {
734 m_selectedStylesheetSetName = name;
735 // TODO(rune@opera.com): Setting Document.selectedStylesheetSet currently
736 // has no other effect than the ability to read back the set value using
737 // the same api. If it did have an effect, we should have marked the
738 // document scope dirty and triggered an update of the active stylesheets
739 // from here.
740 }
741
742 void StyleEngine::setHttpDefaultStyle(const String& content)
743 {
744 setPreferredStylesheetSetNameIfNotSet(content);
745 markDocumentDirty();
746 resolverChanged(FullStyleUpdate);
747 }
748
717 DEFINE_TRACE(StyleEngine) 749 DEFINE_TRACE(StyleEngine)
718 { 750 {
719 #if ENABLE(OILPAN) 751 #if ENABLE(OILPAN)
720 visitor->trace(m_document); 752 visitor->trace(m_document);
721 visitor->trace(m_injectedAuthorStyleSheets); 753 visitor->trace(m_injectedAuthorStyleSheets);
722 visitor->trace(m_documentStyleSheetCollection); 754 visitor->trace(m_documentStyleSheetCollection);
723 visitor->trace(m_styleSheetCollectionMap); 755 visitor->trace(m_styleSheetCollectionMap);
724 visitor->trace(m_resolver); 756 visitor->trace(m_resolver);
725 visitor->trace(m_styleInvalidator); 757 visitor->trace(m_styleInvalidator);
726 visitor->trace(m_dirtyTreeScopes); 758 visitor->trace(m_dirtyTreeScopes);
727 visitor->trace(m_activeTreeScopes); 759 visitor->trace(m_activeTreeScopes);
728 visitor->trace(m_fontSelector); 760 visitor->trace(m_fontSelector);
729 visitor->trace(m_textToSheetCache); 761 visitor->trace(m_textToSheetCache);
730 visitor->trace(m_sheetToTextCache); 762 visitor->trace(m_sheetToTextCache);
731 #endif 763 #endif
732 CSSFontSelectorClient::trace(visitor); 764 CSSFontSelectorClient::trace(visitor);
733 } 765 }
734 766
735 } // namespace blink 767 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/StyleSheetCandidate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698