OLD | NEW |
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return false; | 93 return false; |
94 } | 94 } |
95 | 95 |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 bool SharedStyleFinder::classNamesAffectedByRules(const SpaceSplitString& classN
ames) const | 99 bool SharedStyleFinder::classNamesAffectedByRules(const SpaceSplitString& classN
ames) const |
100 { | 100 { |
101 unsigned count = classNames.size(); | 101 unsigned count = classNames.size(); |
102 for (unsigned i = 0; i < count; ++i) { | 102 for (unsigned i = 0; i < count; ++i) { |
103 if (m_features.classesInRules.contains(classNames[i])) | 103 if (m_features.hasSelectorForClass(classNames[i])) |
104 return true; | 104 return true; |
105 } | 105 } |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 static inline const AtomicString& typeAttributeValue(const Element& element) | 109 static inline const AtomicString& typeAttributeValue(const Element& element) |
110 { | 110 { |
111 // type is animatable in SVG so we need to go down the slow path here. | 111 // type is animatable in SVG so we need to go down the slow path here. |
112 return element.isSVGElement() ? element.getAttribute(typeAttr) : element.fas
tGetAttribute(typeAttr); | 112 return element.isSVGElement() ? element.getAttribute(typeAttr) : element.fas
tGetAttribute(typeAttr); |
113 } | 113 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (candidate.focused() != element().focused()) | 188 if (candidate.focused() != element().focused()) |
189 return false; | 189 return false; |
190 if (candidate.shadowPseudoId() != element().shadowPseudoId()) | 190 if (candidate.shadowPseudoId() != element().shadowPseudoId()) |
191 return false; | 191 return false; |
192 if (candidate == document().cssTarget()) | 192 if (candidate == document().cssTarget()) |
193 return false; | 193 return false; |
194 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate)) | 194 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate)) |
195 return false; | 195 return false; |
196 if (candidate.additionalPresentationAttributeStyle() != element().additional
PresentationAttributeStyle()) | 196 if (candidate.additionalPresentationAttributeStyle() != element().additional
PresentationAttributeStyle()) |
197 return false; | 197 return false; |
198 if (candidate.hasID() && m_features.idsInRules.contains(candidate.idForStyle
Resolution())) | 198 if (candidate.hasID() && m_features.hasSelectorForId(candidate.idForStyleRes
olution())) |
199 return false; | 199 return false; |
200 if (candidate.hasScopedHTMLStyleChild()) | 200 if (candidate.hasScopedHTMLStyleChild()) |
201 return false; | 201 return false; |
202 if (candidate.shadow() && candidate.shadow()->containsActiveStyles()) | 202 if (candidate.shadow() && candidate.shadow()->containsActiveStyles()) |
203 return 0; | 203 return 0; |
204 | 204 |
205 bool isControl = candidate.isFormControlElement(); | 205 bool isControl = candidate.isFormControlElement(); |
206 | 206 |
207 if (isControl != element().isFormControlElement()) | 207 if (isControl != element().isFormControlElement()) |
208 return false; | 208 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
222 | 222 |
223 if (element().parentElement() != parent) { | 223 if (element().parentElement() != parent) { |
224 if (!parent->isStyledElement()) | 224 if (!parent->isStyledElement()) |
225 return false; | 225 return false; |
226 if (parent->hasScopedHTMLStyleChild()) | 226 if (parent->hasScopedHTMLStyleChild()) |
227 return false; | 227 return false; |
228 if (parent->inlineStyle()) | 228 if (parent->inlineStyle()) |
229 return false; | 229 return false; |
230 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro
perties()) | 230 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro
perties()) |
231 return false; | 231 return false; |
232 if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyle
Resolution())) | 232 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes
olution())) |
233 return false; | 233 return false; |
234 if (!parent->childrenSupportStyleSharing()) | 234 if (!parent->childrenSupportStyleSharing()) |
235 return false; | 235 return false; |
236 } | 236 } |
237 | 237 |
238 return true; | 238 return true; |
239 } | 239 } |
240 | 240 |
241 bool SharedStyleFinder::documentContainsValidCandidate() const | 241 bool SharedStyleFinder::documentContainsValidCandidate() const |
242 { | 242 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. | 306 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. |
307 if (!element().parentElement()->childrenSupportStyleSharing()) { | 307 if (!element().parentElement()->childrenSupportStyleSharing()) { |
308 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); | 308 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); |
309 return 0; | 309 return 0; |
310 } | 310 } |
311 | 311 |
312 return shareElement->renderStyle(); | 312 return shareElement->renderStyle(); |
313 } | 313 } |
314 | 314 |
315 } | 315 } |
OLD | NEW |