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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 18371008: Add a WebDocument::watchCssSelectors(selectors) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Fix most comments; TODO benchmark and use Element::recalcStyle Created 7 years, 5 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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "core/css/StylePropertyShorthand.h" 65 #include "core/css/StylePropertyShorthand.h"
66 #include "core/css/StyleSheetContents.h" 66 #include "core/css/StyleSheetContents.h"
67 #include "core/css/resolver/ElementStyleResources.h" 67 #include "core/css/resolver/ElementStyleResources.h"
68 #include "core/css/resolver/FilterOperationResolver.h" 68 #include "core/css/resolver/FilterOperationResolver.h"
69 #include "core/css/resolver/MatchResult.h" 69 #include "core/css/resolver/MatchResult.h"
70 #include "core/css/resolver/MediaQueryResult.h" 70 #include "core/css/resolver/MediaQueryResult.h"
71 #include "core/css/resolver/SharedStyleFinder.h" 71 #include "core/css/resolver/SharedStyleFinder.h"
72 #include "core/css/resolver/StyleBuilder.h" 72 #include "core/css/resolver/StyleBuilder.h"
73 #include "core/css/resolver/TransformBuilder.h" 73 #include "core/css/resolver/TransformBuilder.h"
74 #include "core/css/resolver/ViewportStyleResolver.h" 74 #include "core/css/resolver/ViewportStyleResolver.h"
75 #include "core/dom/CSSSelectorWatch.h"
75 #include "core/dom/DocumentStyleSheetCollection.h" 76 #include "core/dom/DocumentStyleSheetCollection.h"
76 #include "core/dom/FullscreenController.h" 77 #include "core/dom/FullscreenController.h"
77 #include "core/dom/NodeRenderStyle.h" 78 #include "core/dom/NodeRenderStyle.h"
78 #include "core/dom/NodeRenderingContext.h" 79 #include "core/dom/NodeRenderingContext.h"
79 #include "core/dom/Text.h" 80 #include "core/dom/Text.h"
80 #include "core/dom/WebCoreMemoryInstrumentation.h" 81 #include "core/dom/WebCoreMemoryInstrumentation.h"
81 #include "core/dom/shadow/ShadowRoot.h" 82 #include "core/dom/shadow/ShadowRoot.h"
82 #include "core/html/HTMLHtmlElement.h" 83 #include "core/html/HTMLHtmlElement.h"
83 #include "core/html/HTMLIFrameElement.h" 84 #include "core/html/HTMLIFrameElement.h"
84 #include "core/html/HTMLInputElement.h" 85 #include "core/html/HTMLInputElement.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 if (root) 173 if (root)
173 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules); 174 m_rootDefaultStyle = styleForElement(root, 0, DisallowStyleSharing, Matc hOnlyUserAgentRules);
174 175
175 if (m_rootDefaultStyle && view) 176 if (m_rootDefaultStyle && view)
176 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get())); 177 m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->fra me(), m_rootDefaultStyle.get()));
177 178
178 m_styleTree.clear(); 179 m_styleTree.clear();
179 180
180 DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCol lection(); 181 DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCol lection();
181 m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this); 182 m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(docume nt)->watchedCallbackSelectors(), *m_medium, *this);
182 183
183 #if ENABLE(SVG_FONTS) 184 #if ENABLE(SVG_FONTS)
184 if (document->svgExtensions()) { 185 if (document->svgExtensions()) {
185 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements(); 186 const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document->svgE xtensions()->svgFontFaceElements();
186 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd(); 187 HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.e nd();
187 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it) 188 for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElemen ts.begin(); it != end; ++it)
188 fontSelector()->addFontFaceRule((*it)->fontFaceRule()); 189 fontSelector()->addFontFaceRule((*it)->fontFaceRule());
189 } 190 }
190 #endif 191 #endif
191 192
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 } 1563 }
1563 ASSERT_NOT_REACHED(); 1564 ASSERT_NOT_REACHED();
1564 return false; 1565 return false;
1565 } 1566 }
1566 1567
1567 template <StyleResolver::StyleApplicationPass pass> 1568 template <StyleResolver::StyleApplicationPass pass>
1568 void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRul e* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhi telistType) 1569 void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRul e* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhi telistType)
1569 { 1570 {
1570 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionF orStyling()); 1571 ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionF orStyling());
1571 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProces sRule(document(), rule, this); 1572 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProces sRule(document(), rule, this);
1573 m_state.setRule(rule);
1572 1574
1573 unsigned propertyCount = properties->propertyCount(); 1575 unsigned propertyCount = properties->propertyCount();
1574 for (unsigned i = 0; i < propertyCount; ++i) { 1576 for (unsigned i = 0; i < propertyCount; ++i) {
1575 StylePropertySet::PropertyReference current = properties->propertyAt(i); 1577 StylePropertySet::PropertyReference current = properties->propertyAt(i);
1576 if (isImportant != current.isImportant()) 1578 if (isImportant != current.isImportant())
1577 continue; 1579 continue;
1578 if (inheritedOnly && !current.isInherited()) { 1580 if (inheritedOnly && !current.isInherited()) {
1579 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties 1581 // If the property value is explicitly inherited, we need to apply f urther non-inherited properties
1580 // as they might override the value inherited here. For this reason we don't allow declarations with 1582 // as they might override the value inherited here. For this reason we don't allow declarations with
1581 // explicitly inherited properties to be cached. 1583 // explicitly inherited properties to be cached.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 info.addMember(m_state, "state"); 1956 info.addMember(m_state, "state");
1955 1957
1956 // FIXME: move this to a place where it would be called only once? 1958 // FIXME: move this to a place where it would be called only once?
1957 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 1959 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
1958 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 1960 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
1959 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 1961 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
1960 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 1962 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
1961 } 1963 }
1962 1964
1963 } // namespace WebCore 1965 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698