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: sky/engine/core/css/resolver/SharedStyleFinder.cpp

Issue 837883002: Store features in the ScopedStyleResoolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Simpler even. Created 5 years, 11 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "sky/engine/wtf/HashSet.h" 46 #include "sky/engine/wtf/HashSet.h"
47 #include "sky/engine/wtf/text/AtomicString.h" 47 #include "sky/engine/wtf/text/AtomicString.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 bool SharedStyleFinder::classNamesAffectedByRules(const Element& element) const 51 bool SharedStyleFinder::classNamesAffectedByRules(const Element& element) const
52 { 52 {
53 const SpaceSplitString& classNames = element.classNames(); 53 const SpaceSplitString& classNames = element.classNames();
54 unsigned count = classNames.size(); 54 unsigned count = classNames.size();
55 for (unsigned i = 0; i < count; ++i) { 55 for (unsigned i = 0; i < count; ++i) {
56 if (m_features.hasSelectorForClass(classNames[i])) 56 if (element.affectedByClassSelector(classNames[i]))
57 return true; 57 return true;
58 } 58 }
59 return false; 59 return false;
60 } 60 }
61 61
62 bool SharedStyleFinder::attributesAffectedByRules(const Element& element) const 62 bool SharedStyleFinder::attributesAffectedByRules(const Element& element) const
63 { 63 {
64 for (auto& attribute : element.attributesWithoutUpdate()) { 64 for (auto& attribute : element.attributesWithoutUpdate()) {
65 if (m_features.hasSelectorForAttribute(attribute.localName())) 65 if (element.affectedByAttributeSelector(attribute.localName()))
66 return true; 66 return true;
67 } 67 }
68 return false; 68 return false;
69 } 69 }
70 70
71 bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(Ele ment& candidate) const 71 bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(Ele ment& candidate) const
72 { 72 {
73 if (element().sharesSameElementData(candidate)) 73 if (element().sharesSameElementData(candidate))
74 return true; 74 return true;
75 if (element().getAttribute(HTMLNames::langAttr) != candidate.getAttribute(HT MLNames::langAttr)) 75 if (element().getAttribute(HTMLNames::langAttr) != candidate.getAttribute(HT MLNames::langAttr))
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 if (attributesAffectedByRules(*shareElement)) { 192 if (attributesAffectedByRules(*shareElement)) {
193 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByAttr ibuteRules); 193 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByAttr ibuteRules);
194 return 0; 194 return 0;
195 } 195 }
196 196
197 return shareElement->renderStyle(); 197 return shareElement->renderStyle();
198 } 198 }
199 199
200 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698