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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return false; | 134 return false; |
135 if (!sharingCandidateCanShareHostStyles(candidate)) | 135 if (!sharingCandidateCanShareHostStyles(candidate)) |
136 return false; | 136 return false; |
137 if (!candidate.treeScope().hasSameStyles(element().treeScope())) | 137 if (!candidate.treeScope().hasSameStyles(element().treeScope())) |
138 return false; | 138 return false; |
139 return true; | 139 return true; |
140 } | 140 } |
141 | 141 |
142 bool SharedStyleFinder::documentContainsValidCandidate() const | 142 bool SharedStyleFinder::documentContainsValidCandidate() const |
143 { | 143 { |
144 for (Element* element = document().documentElement(); element; element = Ele
mentTraversal::next(*element)) { | 144 for (Element* element = ElementTraversal::firstChild(document()); element; e
lement = ElementTraversal::next(*element)) { |
145 if (element->supportsStyleSharing() && canShareStyleWithElement(*element
)) | 145 if (element->supportsStyleSharing() && canShareStyleWithElement(*element
)) |
146 return true; | 146 return true; |
147 } | 147 } |
148 return false; | 148 return false; |
149 } | 149 } |
150 | 150 |
151 inline Element* SharedStyleFinder::findElementForStyleSharing() const | 151 inline Element* SharedStyleFinder::findElementForStyleSharing() const |
152 { | 152 { |
153 StyleSharingList& styleSharingList = m_styleResolver.styleSharingList(); | 153 StyleSharingList& styleSharingList = m_styleResolver.styleSharingList(); |
154 for (StyleSharingList::iterator it = styleSharingList.begin(); it != styleSh
aringList.end(); ++it) { | 154 for (StyleSharingList::iterator it = styleSharingList.begin(); it != styleSh
aringList.end(); ++it) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleMissed); | 189 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleMissed); |
190 return 0; | 190 return 0; |
191 } | 191 } |
192 | 192 |
193 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleFound); | 193 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleFound); |
194 | 194 |
195 return shareElement->renderStyle(); | 195 return shareElement->renderStyle(); |
196 } | 196 } |
197 | 197 |
198 } | 198 } |
OLD | NEW |