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

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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: modify Document::styleResolver Created 7 years, 1 month 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
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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 clearChildNeedsStyleRecalc(); 1744 clearChildNeedsStyleRecalc();
1745 unscheduleStyleRecalc(); 1745 unscheduleStyleRecalc();
1746 1746
1747 // FIXME: SVG <use> element can schedule a recalc in the middle of an al ready running one. 1747 // FIXME: SVG <use> element can schedule a recalc in the middle of an al ready running one.
1748 // See StyleEngine::updateActiveStyleSheets. 1748 // See StyleEngine::updateActiveStyleSheets.
1749 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc()) 1749 if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
1750 setNeedsStyleRecalc(); 1750 setNeedsStyleRecalc();
1751 1751
1752 if (m_styleResolver) { 1752 if (m_styleResolver) {
1753 // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc. 1753 // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
1754 m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet( )); 1754 m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ensureRuleFeatu reSet());
1755 m_styleResolver->clearStyleSharingList(); 1755 m_styleResolver->clearStyleSharingList();
1756 } 1756 }
1757 } 1757 }
1758 1758
1759 InspectorInstrumentation::didRecalculateStyle(cookie); 1759 InspectorInstrumentation::didRecalculateStyle(cookie);
1760 1760
1761 // As a result of the style recalculation, the currently hovered element mig ht have been 1761 // As a result of the style recalculation, the currently hovered element mig ht have been
1762 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event 1762 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event
1763 // to check if any other elements ended up under the mouse pointer due to re -layout. 1763 // to check if any other elements ended up under the mouse pointer due to re -layout.
1764 if (hoverNode() && !hoverNode()->renderer() && frame()) 1764 if (hoverNode() && !hoverNode()->renderer() && frame())
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 void Document::setIsViewSource(bool isViewSource) 1953 void Document::setIsViewSource(bool isViewSource)
1954 { 1954 {
1955 m_isViewSource = isViewSource; 1955 m_isViewSource = isViewSource;
1956 if (!m_isViewSource) 1956 if (!m_isViewSource)
1957 return; 1957 return;
1958 1958
1959 setSecurityOrigin(SecurityOrigin::createUnique()); 1959 setSecurityOrigin(SecurityOrigin::createUnique());
1960 didUpdateSecurityOrigin(); 1960 didUpdateSecurityOrigin();
1961 } 1961 }
1962 1962
1963 StyleResolver* Document::styleResolver()
esprehn 2013/11/15 10:36:32 We might need to make this inline later, but this
tasak 2013/11/18 08:30:53 I made this inline.
1964 {
1965 if (!m_styleResolver) {
1966 createStyleResolver();
1967 } else {
1968 if (m_styleResolver->hasPendingAuthorStyleSheets())
esprehn 2013/11/15 10:36:32 else if
tasak 2013/11/18 08:30:53 Done.
1969 m_styleResolver->appendPendingAuthorStyleSheets();
1970 }
1971 return m_styleResolver.get();
1972 }
1973
1963 void Document::createStyleResolver() 1974 void Document::createStyleResolver()
1964 { 1975 {
1965 // It is a programming error to attempt to resolve style on a Document 1976 // It is a programming error to attempt to resolve style on a Document
1966 // which is not in a frame. Code which hits this should have checked 1977 // which is not in a frame. Code which hits this should have checked
1967 // Document::isActive() before calling into code which could get here. 1978 // Document::isActive() before calling into code which could get here.
1968 ASSERT(frame()); 1979 ASSERT(frame());
1969 1980
1970 m_styleResolver = adoptPtr(new StyleResolver(*this)); 1981 m_styleResolver = adoptPtr(new StyleResolver(*this));
1971 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); 1982 m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ensureRuleFeatureSet( ));
1972 } 1983 }
1973 1984
1974 void Document::clearStyleResolver() 1985 void Document::clearStyleResolver()
1975 { 1986 {
1976 m_styleResolver.clear(); 1987 m_styleResolver.clear();
1977 } 1988 }
1978 1989
1979 void Document::attach(const AttachContext& context) 1990 void Document::attach(const AttachContext& context)
1980 { 1991 {
1981 ASSERT(m_lifecyle.state() == DocumentLifecycle::Inactive); 1992 ASSERT(m_lifecyle.state() == DocumentLifecycle::Inactive);
(...skipping 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after
5216 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5227 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5217 { 5228 {
5218 if (!isActive()) 5229 if (!isActive())
5219 return; 5230 return;
5220 5231
5221 styleEngine()->modifiedStyleSheet(sheet); 5232 styleEngine()->modifiedStyleSheet(sheet);
5222 styleResolverChanged(when, updateMode); 5233 styleResolverChanged(when, updateMode);
5223 } 5234 }
5224 5235
5225 } // namespace WebCore 5236 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698