Chromium Code Reviews| 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 StyleResolverParentScope::ensureParentStackIsPushed(); | 769 StyleResolverParentScope::ensureParentStackIsPushed(); |
| 770 | 770 |
| 771 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { | 771 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { |
| 772 state.setStyle(RenderStyle::create()); | 772 state.setStyle(RenderStyle::create()); |
| 773 state.style()->inheritFrom(state.parentStyle()); | 773 state.style()->inheritFrom(state.parentStyle()); |
| 774 } else { | 774 } else { |
| 775 state.setStyle(defaultStyleForElement()); | 775 state.setStyle(defaultStyleForElement()); |
| 776 state.setParentStyle(RenderStyle::clone(state.style())); | 776 state.setParentStyle(RenderStyle::clone(state.style())); |
| 777 } | 777 } |
| 778 | 778 |
| 779 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | |
| 779 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | 780 state.fontBuilder().initForStyleResolve(state.document(), state.style()); |
| 780 | 781 |
| 781 // Since we don't use pseudo-elements in any of our quirk/print | 782 // Since we don't use pseudo-elements in any of our quirk/print |
| 782 // user agent rules, don't waste time walking those rules. | 783 // user agent rules, don't waste time walking those rules. |
| 783 | 784 |
| 784 { | 785 { |
| 785 // Check UA, user and author rules. | 786 // Check UA, user and author rules. |
| 786 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); | 787 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); |
| 787 collector.setPseudoStyleRequest(pseudoStyleRequest); | 788 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 788 | 789 |
| 789 matchUARules(collector); | 790 matchUARules(collector); |
| 790 matchAuthorRules(state.element(), collector, false); | 791 matchAuthorRules(state.element(), collector, false); |
| 791 | 792 |
| 792 if (collector.matchedResult().matchedProperties.isEmpty()) | 793 if (collector.matchedResult().matchedProperties.isEmpty()) |
| 793 return false; | 794 return false; |
| 794 | 795 |
| 795 state.style()->setStyleType(pseudoStyleRequest.pseudoId); | |
| 796 | |
| 797 applyMatchedProperties(state, collector.matchedResult()); | 796 applyMatchedProperties(state, collector.matchedResult()); |
| 798 applyCallbackSelectors(state); | 797 applyCallbackSelectors(state); |
| 799 | 798 |
| 800 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 799 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 801 } | 800 } |
| 802 | 801 |
| 803 // Cache our original display. | 802 // Cache our original display. |
| 804 state.style()->setOriginalDisplay(state.style()->display()); | 803 state.style()->setOriginalDisplay(state.style()->display()); |
| 805 | 804 |
| 806 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 805 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 821 return true; | 820 return true; |
| 822 } | 821 } |
| 823 | 822 |
| 824 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, c onst PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) | 823 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, c onst PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) |
| 825 { | 824 { |
| 826 ASSERT(parentStyle); | 825 ASSERT(parentStyle); |
| 827 if (!element) | 826 if (!element) |
| 828 return nullptr; | 827 return nullptr; |
| 829 | 828 |
| 830 StyleResolverState state(document(), element, parentStyle); | 829 StyleResolverState state(document(), element, parentStyle); |
| 831 if (!pseudoStyleForElementInternal(*element, pseudoStyleRequest, parentStyle , state)) | 830 if (!pseudoStyleForElementInternal(*element, pseudoStyleRequest, parentStyle , state)) { |
| 832 return nullptr; | 831 if (pseudoStyleRequest.type == PseudoStyleRequest::ForRenderer) |
|
esprehn
2014/09/17 19:04:42
This doesn't make sense, pseudoStyleForElementInte
rune
2014/09/17 20:00:33
http://www.w3.org/TR/CSS2/generate.html#before-aft
| |
| 832 return nullptr; | |
| 833 return state.takeStyle(); | |
| 834 } | |
| 833 | 835 |
| 834 if (PseudoElement* pseudoElement = element->pseudoElement(pseudoStyleRequest .pseudoId)) | 836 if (PseudoElement* pseudoElement = element->pseudoElement(pseudoStyleRequest .pseudoId)) |
| 835 setAnimationUpdateIfNeeded(state, *pseudoElement); | 837 setAnimationUpdateIfNeeded(state, *pseudoElement); |
| 836 | 838 |
| 837 // Now return the style. | 839 // Now return the style. |
| 838 return state.takeStyle(); | 840 return state.takeStyle(); |
| 839 } | 841 } |
| 840 | 842 |
| 841 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) | 843 PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex) |
| 842 { | 844 { |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1592 visitor->trace(m_uncommonAttributeRuleSet); | 1594 visitor->trace(m_uncommonAttributeRuleSet); |
| 1593 visitor->trace(m_watchedSelectorsRules); | 1595 visitor->trace(m_watchedSelectorsRules); |
| 1594 visitor->trace(m_treeBoundaryCrossingRules); | 1596 visitor->trace(m_treeBoundaryCrossingRules); |
| 1595 visitor->trace(m_styleSharingLists); | 1597 visitor->trace(m_styleSharingLists); |
| 1596 visitor->trace(m_pendingStyleSheets); | 1598 visitor->trace(m_pendingStyleSheets); |
| 1597 visitor->trace(m_document); | 1599 visitor->trace(m_document); |
| 1598 #endif | 1600 #endif |
| 1599 } | 1601 } |
| 1600 | 1602 |
| 1601 } // namespace blink | 1603 } // namespace blink |
| OLD | NEW |