| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/XMLNames.h" | 32 #include "core/XMLNames.h" |
| 33 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/css/resolver/StyleResolverStats.h" | 34 #include "core/css/resolver/StyleResolverStats.h" |
| 35 #include "core/dom/ContainerNode.h" | 35 #include "core/dom/ContainerNode.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ElementTraversal.h" | 37 #include "core/dom/ElementTraversal.h" |
| 38 #include "core/dom/Node.h" | 38 #include "core/dom/Node.h" |
| 39 #include "core/dom/NodeComputedStyle.h" | 39 #include "core/dom/NodeComputedStyle.h" |
| 40 #include "core/dom/QualifiedName.h" | 40 #include "core/dom/QualifiedName.h" |
| 41 #include "core/dom/SpaceSplitString.h" | 41 #include "core/dom/SpaceSplitString.h" |
| 42 #include "core/dom/StyleEngine.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 43 #include "core/dom/shadow/ElementShadow.h" |
| 43 #include "core/dom/shadow/InsertionPoint.h" | 44 #include "core/dom/shadow/InsertionPoint.h" |
| 44 #include "core/html/HTMLElement.h" | 45 #include "core/html/HTMLElement.h" |
| 45 #include "core/html/HTMLInputElement.h" | 46 #include "core/html/HTMLInputElement.h" |
| 46 #include "core/html/HTMLOptGroupElement.h" | 47 #include "core/html/HTMLOptGroupElement.h" |
| 47 #include "core/html/HTMLOptionElement.h" | 48 #include "core/html/HTMLOptionElement.h" |
| 48 #include "core/style/ComputedStyle.h" | 49 #include "core/style/ComputedStyle.h" |
| 49 #include "core/svg/SVGElement.h" | 50 #include "core/svg/SVGElement.h" |
| 50 #include "platform/TraceEvent.h" | 51 #include "platform/TraceEvent.h" |
| 51 #include "wtf/HashSet.h" | 52 #include "wtf/HashSet.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 bool SharedStyleFinder::matchesRuleSet(RuleSet* ruleSet) | 317 bool SharedStyleFinder::matchesRuleSet(RuleSet* ruleSet) |
| 317 { | 318 { |
| 318 if (!ruleSet) | 319 if (!ruleSet) |
| 319 return false; | 320 return false; |
| 320 ElementRuleCollector collector(m_context, m_styleResolver->selectorFilter())
; | 321 ElementRuleCollector collector(m_context, m_styleResolver->selectorFilter())
; |
| 321 return collector.hasAnyMatchingRules(ruleSet); | 322 return collector.hasAnyMatchingRules(ruleSet); |
| 322 } | 323 } |
| 323 | 324 |
| 324 ComputedStyle* SharedStyleFinder::findSharedStyle() | 325 ComputedStyle* SharedStyleFinder::findSharedStyle() |
| 325 { | 326 { |
| 326 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleLookups, 1); | 327 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleLookups,
1); |
| 327 | 328 |
| 328 if (!element().supportsStyleSharing()) | 329 if (!element().supportsStyleSharing()) |
| 329 return nullptr; | 330 return nullptr; |
| 330 | 331 |
| 331 // Cache whether context.element() is affected by any known class selectors. | 332 // Cache whether context.element() is affected by any known class selectors. |
| 332 m_elementAffectedByClassRules = element().hasClass() && classNamesAffectedBy
Rules(element().classNames()); | 333 m_elementAffectedByClassRules = element().hasClass() && classNamesAffectedBy
Rules(element().classNames()); |
| 333 | 334 |
| 334 Element* shareElement = findElementForStyleSharing(); | 335 Element* shareElement = findElementForStyleSharing(); |
| 335 | 336 |
| 336 if (!shareElement) { | 337 if (!shareElement) { |
| 337 if (m_styleResolver->stats() && m_styleResolver->stats()->allCountersEna
bled() && documentContainsValidCandidate()) | 338 if (document().styleEngine().stats() && document().styleEngine().stats()
->allCountersEnabled() && documentContainsValidCandidate()) |
| 338 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleMissed, 1
); | 339 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleM
issed, 1); |
| 339 return nullptr; | 340 return nullptr; |
| 340 } | 341 } |
| 341 | 342 |
| 342 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleFound, 1); | 343 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleFound, 1)
; |
| 343 | 344 |
| 344 if (matchesRuleSet(m_siblingRuleSet)) { | 345 if (matchesRuleSet(m_siblingRuleSet)) { |
| 345 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleRejectedBySib
lingRules, 1); | 346 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleRejec
tedBySiblingRules, 1); |
| 346 return nullptr; | 347 return nullptr; |
| 347 } | 348 } |
| 348 | 349 |
| 349 if (matchesRuleSet(m_uncommonAttributeRuleSet)) { | 350 if (matchesRuleSet(m_uncommonAttributeRuleSet)) { |
| 350 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleRejectedByUnc
ommonAttributeRules, 1); | 351 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleRejec
tedByUncommonAttributeRules, 1); |
| 351 return nullptr; | 352 return nullptr; |
| 352 } | 353 } |
| 353 | 354 |
| 354 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. | 355 // Tracking child index requires unique style for each node. This may get se
t by the sibling rule match above. |
| 355 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { | 356 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { |
| 356 INCREMENT_STYLE_STATS_COUNTER(*m_styleResolver, sharedStyleRejectedByPar
ent, 1); | 357 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), sharedStyleRejec
tedByParent, 1); |
| 357 return nullptr; | 358 return nullptr; |
| 358 } | 359 } |
| 359 | 360 |
| 360 return shareElement->mutableComputedStyle(); | 361 return shareElement->mutableComputedStyle(); |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace blink | 364 } // namespace blink |
| OLD | NEW |