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 28 matching lines...) Expand all Loading... |
39 #include "core/dom/FullscreenElementStack.h" | 39 #include "core/dom/FullscreenElementStack.h" |
40 #include "core/dom/Node.h" | 40 #include "core/dom/Node.h" |
41 #include "core/dom/NodeRenderStyle.h" | 41 #include "core/dom/NodeRenderStyle.h" |
42 #include "core/dom/QualifiedName.h" | 42 #include "core/dom/QualifiedName.h" |
43 #include "core/dom/SpaceSplitString.h" | 43 #include "core/dom/SpaceSplitString.h" |
44 #include "core/dom/shadow/ElementShadow.h" | 44 #include "core/dom/shadow/ElementShadow.h" |
45 #include "core/dom/shadow/InsertionPoint.h" | 45 #include "core/dom/shadow/InsertionPoint.h" |
46 #include "core/html/HTMLElement.h" | 46 #include "core/html/HTMLElement.h" |
47 #include "core/html/HTMLInputElement.h" | 47 #include "core/html/HTMLInputElement.h" |
48 #include "core/html/HTMLOptGroupElement.h" | 48 #include "core/html/HTMLOptGroupElement.h" |
| 49 #include "core/html/HTMLOptionElement.h" |
49 #include "core/rendering/style/RenderStyle.h" | 50 #include "core/rendering/style/RenderStyle.h" |
50 #include "core/svg/SVGElement.h" | 51 #include "core/svg/SVGElement.h" |
51 #include "wtf/HashSet.h" | 52 #include "wtf/HashSet.h" |
52 #include "wtf/text/AtomicString.h" | 53 #include "wtf/text/AtomicString.h" |
53 | 54 |
54 namespace WebCore { | 55 namespace WebCore { |
55 | 56 |
56 using namespace HTMLNames; | 57 using namespace HTMLNames; |
57 | 58 |
58 bool SharedStyleFinder::canShareStyleWithControl(Element& candidate) const | 59 bool SharedStyleFinder::canShareStyleWithControl(Element& candidate) const |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 116 |
116 bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(Ele
ment& candidate) const | 117 bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(Ele
ment& candidate) const |
117 { | 118 { |
118 if (element().elementData() == candidate.elementData()) | 119 if (element().elementData() == candidate.elementData()) |
119 return true; | 120 return true; |
120 if (element().fastGetAttribute(XMLNames::langAttr) != candidate.fastGetAttri
bute(XMLNames::langAttr)) | 121 if (element().fastGetAttribute(XMLNames::langAttr) != candidate.fastGetAttri
bute(XMLNames::langAttr)) |
121 return false; | 122 return false; |
122 if (element().fastGetAttribute(langAttr) != candidate.fastGetAttribute(langA
ttr)) | 123 if (element().fastGetAttribute(langAttr) != candidate.fastGetAttribute(langA
ttr)) |
123 return false; | 124 return false; |
124 | 125 |
125 // These two checks must be here since RuleSet has a specail case to allow s
tyle sharing between elements | 126 // These two checks must be here since RuleSet has a special case to allow s
tyle sharing between elements |
126 // with type and readonly attributes whereas other attribute selectors preve
nt sharing. | 127 // with type and readonly attributes whereas other attribute selectors preve
nt sharing. |
127 if (typeAttributeValue(element()) != typeAttributeValue(candidate)) | 128 if (typeAttributeValue(element()) != typeAttributeValue(candidate)) |
128 return false; | 129 return false; |
129 if (element().fastGetAttribute(readonlyAttr) != candidate.fastGetAttribute(r
eadonlyAttr)) | 130 if (element().fastGetAttribute(readonlyAttr) != candidate.fastGetAttribute(r
eadonlyAttr)) |
130 return false; | 131 return false; |
131 | 132 |
132 if (!m_elementAffectedByClassRules) { | 133 if (!m_elementAffectedByClassRules) { |
133 if (candidate.hasClass() && classNamesAffectedByRules(candidate.classNam
es())) | 134 if (candidate.hasClass() && classNamesAffectedByRules(candidate.classNam
es())) |
134 return false; | 135 return false; |
135 } else if (candidate.hasClass()) { | 136 } else if (candidate.hasClass()) { |
(...skipping 12 matching lines...) Expand all Loading... |
148 return false; | 149 return false; |
149 | 150 |
150 // FIXME: Consider removing this, it's unlikely we'll have so many progress
elements | 151 // FIXME: Consider removing this, it's unlikely we'll have so many progress
elements |
151 // that sharing the style makes sense. Instead we should just not support st
yle sharing | 152 // that sharing the style makes sense. Instead we should just not support st
yle sharing |
152 // for them. | 153 // for them. |
153 if (isHTMLProgressElement(element())) { | 154 if (isHTMLProgressElement(element())) { |
154 if (element().shouldAppearIndeterminate() != candidate.shouldAppearIndet
erminate()) | 155 if (element().shouldAppearIndeterminate() != candidate.shouldAppearIndet
erminate()) |
155 return false; | 156 return false; |
156 } | 157 } |
157 | 158 |
| 159 if (isHTMLOptGroupElement(element()) || isHTMLOptionElement(element())) { |
| 160 if (element().isDisabledFormControl() != candidate.isDisabledFormControl
()) |
| 161 return false; |
| 162 if (isHTMLOptionElement(element()) && toHTMLOptionElement(element()).sel
ected() != toHTMLOptionElement(candidate).selected()) |
| 163 return false; |
| 164 } |
| 165 |
158 return true; | 166 return true; |
159 } | 167 } |
160 | 168 |
161 bool SharedStyleFinder::sharingCandidateShadowHasSharedStyleSheetContents(Elemen
t& candidate) const | 169 bool SharedStyleFinder::sharingCandidateShadowHasSharedStyleSheetContents(Elemen
t& candidate) const |
162 { | 170 { |
163 if (!element().shadow() || !element().shadow()->containsActiveStyles()) | 171 if (!element().shadow() || !element().shadow()->containsActiveStyles()) |
164 return false; | 172 return false; |
165 | 173 |
166 return element().shadow()->hasSameStyles(candidate.shadow()); | 174 return element().shadow()->hasSameStyles(candidate.shadow()); |
167 } | 175 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. | 341 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. |
334 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { | 342 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { |
335 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); | 343 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare
nt); |
336 return 0; | 344 return 0; |
337 } | 345 } |
338 | 346 |
339 return shareElement->renderStyle(); | 347 return shareElement->renderStyle(); |
340 } | 348 } |
341 | 349 |
342 } | 350 } |
OLD | NEW |