| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 void StyleResolver::matchHostRules(Element* element, ScopedStyleResolver* resolv
er, ElementRuleCollector& collector, bool includeEmptyRules) | 372 void StyleResolver::matchHostRules(Element* element, ScopedStyleResolver* resolv
er, ElementRuleCollector& collector, bool includeEmptyRules) |
| 373 { | 373 { |
| 374 if (element != &resolver->scopingNode()) | 374 if (element != &resolver->scopingNode()) |
| 375 return; | 375 return; |
| 376 resolver->matchHostRules(collector, includeEmptyRules); | 376 resolver->matchHostRules(collector, includeEmptyRules); |
| 377 } | 377 } |
| 378 | 378 |
| 379 static inline bool applyAuthorStylesOf(const Element* element) | 379 static inline bool applyAuthorStylesOf(const Element* element) |
| 380 { | 380 { |
| 381 return element->treeScope().applyAuthorStyles() || (element->shadow() && ele
ment->shadow()->applyAuthorStyles()); | 381 return element->treeScope()->applyAuthorStyles() || (element->shadow() && el
ement->shadow()->applyAuthorStyles()); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void StyleResolver::matchScopedAuthorRulesForShadowHost(Element* element, Elemen
tRuleCollector& collector, bool includeEmptyRules, Vector<ScopedStyleResolver*,
8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree) | 384 void StyleResolver::matchScopedAuthorRulesForShadowHost(Element* element, Elemen
tRuleCollector& collector, bool includeEmptyRules, Vector<ScopedStyleResolver*,
8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree) |
| 385 { | 385 { |
| 386 collector.clearMatchedRules(); | 386 collector.clearMatchedRules(); |
| 387 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; | 387 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; |
| 388 | 388 |
| 389 CascadeScope cascadeScope = 0; | 389 CascadeScope cascadeScope = 0; |
| 390 CascadeOrder cascadeOrder = 0; | 390 CascadeOrder cascadeOrder = 0; |
| 391 bool applyAuthorStyles = applyAuthorStylesOf(element); | 391 bool applyAuthorStyles = applyAuthorStylesOf(element); |
| 392 | 392 |
| 393 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) | 393 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) |
| 394 resolversInShadowTree.at(j)->collectMatchingAuthorRules(collector, inclu
deEmptyRules, applyAuthorStyles, cascadeScope, cascadeOrder++); | 394 resolversInShadowTree.at(j)->collectMatchingAuthorRules(collector, inclu
deEmptyRules, applyAuthorStyles, cascadeScope, cascadeOrder++); |
| 395 | 395 |
| 396 if (resolvers.isEmpty() || &resolvers.first()->treeScope() != &element->tree
Scope()) | 396 if (resolvers.isEmpty() || resolvers.first()->treeScope() != element->treeSc
ope()) |
| 397 ++cascadeScope; | 397 ++cascadeScope; |
| 398 cascadeOrder += resolvers.size(); | 398 cascadeOrder += resolvers.size(); |
| 399 for (unsigned i = 0; i < resolvers.size(); ++i) | 399 for (unsigned i = 0; i < resolvers.size(); ++i) |
| 400 resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules
, applyAuthorStyles, cascadeScope++, --cascadeOrder); | 400 resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules
, applyAuthorStyles, cascadeScope++, --cascadeOrder); |
| 401 | 401 |
| 402 collector.sortAndTransferMatchedRules(); | 402 collector.sortAndTransferMatchedRules(); |
| 403 | 403 |
| 404 if (!resolvers.isEmpty()) | 404 if (!resolvers.isEmpty()) |
| 405 matchHostRules(element, resolvers.first(), collector, includeEmptyRules)
; | 405 matchHostRules(element, resolvers.first(), collector, includeEmptyRules)
; |
| 406 } | 406 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 427 | 427 |
| 428 bool applyAuthorStyles = applyAuthorStylesOf(element); | 428 bool applyAuthorStyles = applyAuthorStylesOf(element); |
| 429 CascadeScope cascadeScope = 0; | 429 CascadeScope cascadeScope = 0; |
| 430 CascadeOrder cascadeOrder = resolvers.size(); | 430 CascadeOrder cascadeOrder = resolvers.size(); |
| 431 collector.clearMatchedRules(); | 431 collector.clearMatchedRules(); |
| 432 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; | 432 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().
matchedProperties.size() - 1; |
| 433 | 433 |
| 434 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) { | 434 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) { |
| 435 ScopedStyleResolver* resolver = resolvers.at(i); | 435 ScopedStyleResolver* resolver = resolvers.at(i); |
| 436 // FIXME: Need to clarify how to treat style scoped. | 436 // FIXME: Need to clarify how to treat style scoped. |
| 437 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, &resolver->treeScope() == &element->treeScope() &&
resolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder); | 437 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply
AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r
esolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder); |
| 438 } | 438 } |
| 439 | 439 |
| 440 collector.sortAndTransferMatchedRules(); | 440 collector.sortAndTransferMatchedRules(); |
| 441 | 441 |
| 442 matchHostRules(element, resolvers.first(), collector, includeEmptyRules); | 442 matchHostRules(element, resolvers.first(), collector, includeEmptyRules); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
lector, bool includeEmptyRules) | 445 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
lector, bool includeEmptyRules) |
| 446 { | 446 { |
| 447 matchScopedAuthorRules(element, collector, includeEmptyRules); | 447 matchScopedAuthorRules(element, collector, includeEmptyRules); |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); | 1566 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); |
| 1567 | 1567 |
| 1568 fprintf(stderr, "Total:\n"); | 1568 fprintf(stderr, "Total:\n"); |
| 1569 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1569 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1570 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); | 1570 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); |
| 1571 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); | 1571 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); |
| 1572 } | 1572 } |
| 1573 #endif | 1573 #endif |
| 1574 | 1574 |
| 1575 } // namespace WebCore | 1575 } // namespace WebCore |
| OLD | NEW |