| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 ContainerNode* parentNode = element->parentNode(); | 524 ContainerNode* parentNode = element->parentNode(); |
| 525 return parentNode && parentNode->isShadowRoot(); | 525 return parentNode && parentNode->isShadowRoot(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 static inline void resetDirectionAndWritingModeOnDocument(Document* document) | 528 static inline void resetDirectionAndWritingModeOnDocument(Document* document) |
| 529 { | 529 { |
| 530 document->setDirectionSetOnDocumentElement(false); | 530 document->setDirectionSetOnDocumentElement(false); |
| 531 document->setWritingModeSetOnDocumentElement(false); | 531 document->setWritingModeSetOnDocumentElement(false); |
| 532 } | 532 } |
| 533 | 533 |
| 534 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt
trValues, RuleFeatureSet& features) |
| 535 { |
| 536 for (size_t i = 0; i < contentAttrValues.size(); ++i) |
| 537 features.attrsInRules.add(contentAttrValues[i].impl()); |
| 538 } |
| 534 | 539 |
| 535 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, | 540 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
tyle* defaultParent, StyleSharingBehavior sharingBehavior, |
| 536 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) | 541 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling) |
| 537 { | 542 { |
| 538 ASSERT(document()->frame()); | 543 ASSERT(document()->frame()); |
| 539 ASSERT(documentSettings()); | 544 ASSERT(documentSettings()); |
| 540 | 545 |
| 541 // Once an element has a renderer, we don't try to destroy it, since otherwi
se the renderer | 546 // Once an element has a renderer, we don't try to destroy it, since otherwi
se the renderer |
| 542 // will vanish if a style recalc happens during loading. | 547 // will vanish if a style recalc happens during loading. |
| 543 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles
heetsLoaded() && !element->renderer()) { | 548 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles
heetsLoaded() && !element->renderer()) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 { | 605 { |
| 601 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 606 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 602 collector.setRegionForStyling(regionForStyling); | 607 collector.setRegionForStyling(regionForStyling); |
| 603 | 608 |
| 604 if (matchingBehavior == MatchOnlyUserAgentRules) | 609 if (matchingBehavior == MatchOnlyUserAgentRules) |
| 605 matchUARules(collector); | 610 matchUARules(collector); |
| 606 else | 611 else |
| 607 matchAllRules(state, collector, m_matchAuthorAndUserStyles, matching
Behavior != MatchAllRulesExcludingSMIL); | 612 matchAllRules(state, collector, m_matchAuthorAndUserStyles, matching
Behavior != MatchAllRulesExcludingSMIL); |
| 608 | 613 |
| 609 applyMatchedProperties(state, collector.matchedResult()); | 614 applyMatchedProperties(state, collector.matchedResult()); |
| 615 |
| 616 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 610 } | 617 } |
| 611 { | 618 { |
| 612 StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()
); | 619 StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()
); |
| 613 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element); | 620 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element); |
| 614 } | 621 } |
| 615 document()->didAccessStyleResolver(); | 622 document()->didAccessStyleResolver(); |
| 616 | 623 |
| 617 // FIXME: Shouldn't this be on RenderBody::styleDidChange? | 624 // FIXME: Shouldn't this be on RenderBody::styleDidChange? |
| 618 if (element->hasTagName(bodyTag)) | 625 if (element->hasTagName(bodyTag)) |
| 619 document()->textLinkColors().setTextColor(state.style()->visitedDependen
tColor(CSSPropertyColor)); | 626 document()->textLinkColors().setTextColor(state.style()->visitedDependen
tColor(CSSPropertyColor)); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 matchUserRules(collector, false); | 802 matchUserRules(collector, false); |
| 796 matchAuthorRules(state.element(), collector, false); | 803 matchAuthorRules(state.element(), collector, false); |
| 797 } | 804 } |
| 798 | 805 |
| 799 if (collector.matchedResult().matchedProperties.isEmpty()) | 806 if (collector.matchedResult().matchedProperties.isEmpty()) |
| 800 return 0; | 807 return 0; |
| 801 | 808 |
| 802 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | 809 state.style()->setStyleType(pseudoStyleRequest.pseudoId); |
| 803 | 810 |
| 804 applyMatchedProperties(state, collector.matchedResult()); | 811 applyMatchedProperties(state, collector.matchedResult()); |
| 812 |
| 813 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 805 } | 814 } |
| 806 { | 815 { |
| 807 StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()
); | 816 StyleAdjuster adjuster(state.cachedUAStyle(), m_document->inQuirksMode()
); |
| 808 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 817 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| 809 // in the adjustRenderStyle code. | 818 // in the adjustRenderStyle code. |
| 810 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0); | 819 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0); |
| 811 } | 820 } |
| 812 | 821 |
| 813 // Start loading resources referenced by this style. | 822 // Start loading resources referenced by this style. |
| 814 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); | 823 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 | 855 |
| 847 // If our font got dirtied, go ahead and update it now. | 856 // If our font got dirtied, go ahead and update it now. |
| 848 updateFont(state); | 857 updateFont(state); |
| 849 | 858 |
| 850 // Line-height is set when we are sure we decided on the font-size. | 859 // Line-height is set when we are sure we decided on the font-size. |
| 851 if (state.lineHeightValue()) | 860 if (state.lineHeightValue()) |
| 852 applyProperty(state, CSSPropertyLineHeight, state.lineHeightValue()); | 861 applyProperty(state, CSSPropertyLineHeight, state.lineHeightValue()); |
| 853 | 862 |
| 854 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul
t.matchedProperties.size() - 1, inheritedOnly); | 863 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul
t.matchedProperties.size() - 1, inheritedOnly); |
| 855 | 864 |
| 865 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 866 |
| 856 // Start loading resources referenced by this style. | 867 // Start loading resources referenced by this style. |
| 857 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); | 868 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle
Resources()); |
| 858 | 869 |
| 859 document()->didAccessStyleResolver(); | 870 document()->didAccessStyleResolver(); |
| 860 | 871 |
| 861 // Now return the style. | 872 // Now return the style. |
| 862 return state.takeStyle(); | 873 return state.takeStyle(); |
| 863 } | 874 } |
| 864 | 875 |
| 865 void StyleResolver::collectViewportRules() | 876 void StyleResolver::collectViewportRules() |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); | 1470 m_matchedPropertiesSearches, m_matchedPropertiesHit, m_matchedProperties
SharedInheritedHit, m_matchedPropertiesToCache, m_matchedPropertiesEnteredIntoCa
che); |
| 1460 | 1471 |
| 1461 fprintf(stderr, "Total:\n"); | 1472 fprintf(stderr, "Total:\n"); |
| 1462 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, | 1473 printStyleStats(m_totalSearches, m_totalElementsEligibleForSharing, m_totalS
tylesShared, m_totalSearchFoundSiblingForSharing, m_totalSearchesMissedSharing, |
| 1463 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); | 1474 m_totalMatchedPropertiesSearches, m_totalMatchedPropertiesHit, m_totalMa
tchedPropertiesSharedInheritedHit, m_totalMatchedPropertiesToCache, m_totalMatch
edPropertiesEnteredIntoCache); |
| 1464 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); | 1475 fprintf(stderr, "-----------------------------------------------------------
---------------------\n"); |
| 1465 } | 1476 } |
| 1466 #endif | 1477 #endif |
| 1467 | 1478 |
| 1468 } // namespace WebCore | 1479 } // namespace WebCore |
| OLD | NEW |