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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 if (candidate.isOutOfRange() != element().isOutOfRange()) | 92 if (candidate.isOutOfRange() != element().isOutOfRange()) |
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 for (unsigned i = 0; i < classNames.size(); ++i) { | 101 unsigned count = classNames.size(); |
102 if (m_features.classesInRules.contains(classNames[i].impl())) | 102 for (unsigned i = 0; i < count; ++i) { |
| 103 if (m_features.classesInRules.contains(classNames[i])) |
103 return true; | 104 return true; |
104 } | 105 } |
105 return false; | 106 return false; |
106 } | 107 } |
107 | 108 |
108 static inline const AtomicString& typeAttributeValue(const Element& element) | 109 static inline const AtomicString& typeAttributeValue(const Element& element) |
109 { | 110 { |
110 // 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. |
111 return element.isSVGElement() ? element.getAttribute(typeAttr) : element.fas
tGetAttribute(typeAttr); | 112 return element.isSVGElement() ? element.getAttribute(typeAttr) : element.fas
tGetAttribute(typeAttr); |
112 } | 113 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (candidate.focused() != element().focused()) | 188 if (candidate.focused() != element().focused()) |
188 return false; | 189 return false; |
189 if (candidate.shadowPseudoId() != element().shadowPseudoId()) | 190 if (candidate.shadowPseudoId() != element().shadowPseudoId()) |
190 return false; | 191 return false; |
191 if (candidate == document().cssTarget()) | 192 if (candidate == document().cssTarget()) |
192 return false; | 193 return false; |
193 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate)) | 194 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate)) |
194 return false; | 195 return false; |
195 if (candidate.additionalPresentationAttributeStyle() != element().additional
PresentationAttributeStyle()) | 196 if (candidate.additionalPresentationAttributeStyle() != element().additional
PresentationAttributeStyle()) |
196 return false; | 197 return false; |
197 if (candidate.hasID() && m_features.idsInRules.contains(candidate.idForStyle
Resolution().impl())) | 198 if (candidate.hasID() && m_features.idsInRules.contains(candidate.idForStyle
Resolution())) |
198 return false; | 199 return false; |
199 if (candidate.hasScopedHTMLStyleChild()) | 200 if (candidate.hasScopedHTMLStyleChild()) |
200 return false; | 201 return false; |
201 if (candidate.shadow() && candidate.shadow()->containsActiveStyles()) | 202 if (candidate.shadow() && candidate.shadow()->containsActiveStyles()) |
202 return 0; | 203 return 0; |
203 | 204 |
204 bool isControl = candidate.isFormControlElement(); | 205 bool isControl = candidate.isFormControlElement(); |
205 | 206 |
206 if (isControl != element().isFormControlElement()) | 207 if (isControl != element().isFormControlElement()) |
207 return false; | 208 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
221 | 222 |
222 if (element().parentElement() != parent) { | 223 if (element().parentElement() != parent) { |
223 if (!parent->isStyledElement()) | 224 if (!parent->isStyledElement()) |
224 return false; | 225 return false; |
225 if (parent->hasScopedHTMLStyleChild()) | 226 if (parent->hasScopedHTMLStyleChild()) |
226 return false; | 227 return false; |
227 if (parent->inlineStyle()) | 228 if (parent->inlineStyle()) |
228 return false; | 229 return false; |
229 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro
perties()) | 230 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro
perties()) |
230 return false; | 231 return false; |
231 if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyle
Resolution().impl())) | 232 if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyle
Resolution())) |
232 return false; | 233 return false; |
233 if (!parent->childrenSupportStyleSharing()) | 234 if (!parent->childrenSupportStyleSharing()) |
234 return false; | 235 return false; |
235 } | 236 } |
236 | 237 |
237 return true; | 238 return true; |
238 } | 239 } |
239 | 240 |
240 bool SharedStyleFinder::documentContainsValidCandidate() const | 241 bool SharedStyleFinder::documentContainsValidCandidate() const |
241 { | 242 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // 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. |
306 if (!element().parentElement()->childrenSupportStyleSharing()) { | 307 if (!element().parentElement()->childrenSupportStyleSharing()) { |
307 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); | 308 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); |
308 return 0; | 309 return 0; |
309 } | 310 } |
310 | 311 |
311 return shareElement->renderStyle(); | 312 return shareElement->renderStyle(); |
312 } | 313 } |
313 | 314 |
314 } | 315 } |
OLD | NEW |