| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "core/css/resolver/MediaQueryResult.h" | 63 #include "core/css/resolver/MediaQueryResult.h" |
| 64 #include "core/css/resolver/ScopedStyleResolver.h" | 64 #include "core/css/resolver/ScopedStyleResolver.h" |
| 65 #include "core/css/resolver/SharedStyleFinder.h" | 65 #include "core/css/resolver/SharedStyleFinder.h" |
| 66 #include "core/css/resolver/StyleAdjuster.h" | 66 #include "core/css/resolver/StyleAdjuster.h" |
| 67 #include "core/css/resolver/StyleResolverParentScope.h" | 67 #include "core/css/resolver/StyleResolverParentScope.h" |
| 68 #include "core/css/resolver/StyleResolverState.h" | 68 #include "core/css/resolver/StyleResolverState.h" |
| 69 #include "core/css/resolver/StyleResolverStats.h" | 69 #include "core/css/resolver/StyleResolverStats.h" |
| 70 #include "core/css/resolver/ViewportStyleResolver.h" | 70 #include "core/css/resolver/ViewportStyleResolver.h" |
| 71 #include "core/dom/CSSSelectorWatch.h" | 71 #include "core/dom/CSSSelectorWatch.h" |
| 72 #include "core/dom/FirstLetterPseudoElement.h" | 72 #include "core/dom/FirstLetterPseudoElement.h" |
| 73 #include "core/dom/MarkerPseudoElement.h" |
| 73 #include "core/dom/NodeComputedStyle.h" | 74 #include "core/dom/NodeComputedStyle.h" |
| 74 #include "core/dom/StyleEngine.h" | 75 #include "core/dom/StyleEngine.h" |
| 75 #include "core/dom/Text.h" | 76 #include "core/dom/Text.h" |
| 76 #include "core/dom/shadow/ElementShadow.h" | 77 #include "core/dom/shadow/ElementShadow.h" |
| 77 #include "core/dom/shadow/ShadowRoot.h" | 78 #include "core/dom/shadow/ShadowRoot.h" |
| 78 #include "core/frame/FrameView.h" | 79 #include "core/frame/FrameView.h" |
| 79 #include "core/frame/LocalFrame.h" | 80 #include "core/frame/LocalFrame.h" |
| 80 #include "core/frame/Settings.h" | 81 #include "core/frame/Settings.h" |
| 81 #include "core/html/HTMLIFrameElement.h" | 82 #include "core/html/HTMLIFrameElement.h" |
| 82 #include "core/inspector/InspectorInstrumentation.h" | 83 #include "core/inspector/InspectorInstrumentation.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 { | 707 { |
| 707 if (value) { | 708 if (value) { |
| 708 StyleBuilder::applyProperty(property, state, value); | 709 StyleBuilder::applyProperty(property, state, value); |
| 709 state.fontBuilder().createFont(state.document().styleEngine().fontSelect
or(), state.mutableStyleRef()); | 710 state.fontBuilder().createFont(state.document().styleEngine().fontSelect
or(), state.mutableStyleRef()); |
| 710 } | 711 } |
| 711 return CSSAnimatableValueFactory::create(property, *state.style()); | 712 return CSSAnimatableValueFactory::create(property, *state.style()); |
| 712 } | 713 } |
| 713 | 714 |
| 714 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element
* parent, PseudoId pseudoId) | 715 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element
* parent, PseudoId pseudoId) |
| 715 { | 716 { |
| 717 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId ==
MARKER) |
| 718 return MarkerPseudoElement::create(parent); |
| 716 if (pseudoId == FIRST_LETTER) | 719 if (pseudoId == FIRST_LETTER) |
| 717 return FirstLetterPseudoElement::create(parent); | 720 return FirstLetterPseudoElement::create(parent); |
| 718 return PseudoElement::create(parent, pseudoId); | 721 return PseudoElement::create(parent, pseudoId); |
| 719 } | 722 } |
| 720 | 723 |
| 724 bool StyleResolver::pseudoElementRequired(PseudoId pseudoId, LayoutObject& paren
tRenderer) |
| 725 { |
| 726 if (pseudoId == FIRST_LETTER) |
| 727 return true; |
| 728 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId ==
MARKER) |
| 729 return true; |
| 730 if (parentRenderer.style()->hasPseudoStyle(pseudoId)) |
| 731 return true; |
| 732 return pseudoId >= FIRST_INTERNAL_PSEUDOID; |
| 733 } |
| 734 |
| 721 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded
(Element& parent, PseudoId pseudoId) | 735 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded
(Element& parent, PseudoId pseudoId) |
| 722 { | 736 { |
| 723 LayoutObject* parentRenderer = parent.layoutObject(); | 737 LayoutObject* parentRenderer = parent.layoutObject(); |
| 724 if (!parentRenderer) | 738 if (!parentRenderer) |
| 725 return nullptr; | 739 return nullptr; |
| 726 | 740 |
| 727 // The first letter pseudo element has to look up the tree and see if any | 741 if (!pseudoElementRequired(pseudoId, *parentRenderer)) |
| 728 // of the ancestors are first letter. | |
| 729 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !paren
tRenderer->style()->hasPseudoStyle(pseudoId)) | |
| 730 return nullptr; | 742 return nullptr; |
| 731 | 743 |
| 732 if (pseudoId == BACKDROP && !parent.isInTopLayer()) | 744 if (pseudoId == BACKDROP && !parent.isInTopLayer()) |
| 733 return nullptr; | 745 return nullptr; |
| 734 | 746 |
| 747 // FIXME: This should also probably take inline-list-item into account when |
| 748 // we add support. |
| 749 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId ==
MARKER && parentRenderer->style()->display() != LIST_ITEM) |
| 750 return nullptr; |
| 751 |
| 735 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo
Element::firstLetterTextRenderer(parent))) | 752 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo
Element::firstLetterTextRenderer(parent))) |
| 736 return nullptr; | 753 return nullptr; |
| 737 | 754 |
| 738 if (!canHaveGeneratedChildren(*parentRenderer)) | 755 if (!canHaveGeneratedChildren(*parentRenderer)) |
| 739 return nullptr; | 756 return nullptr; |
| 740 | 757 |
| 741 ComputedStyle* parentStyle = parentRenderer->mutableStyle(); | 758 ComputedStyle* parentStyle = parentRenderer->mutableStyle(); |
| 742 if (ComputedStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)
) { | 759 if (ComputedStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)
) { |
| 743 if (!pseudoElementRendererIsNeeded(cachedStyle)) | 760 if (!pseudoElementRendererIsNeeded(cachedStyle)) |
| 744 return nullptr; | 761 return nullptr; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 // user agent rules, don't waste time walking those rules. | 811 // user agent rules, don't waste time walking those rules. |
| 795 | 812 |
| 796 if (!baseComputedStyle) { | 813 if (!baseComputedStyle) { |
| 797 // Check UA, user and author rules. | 814 // Check UA, user and author rules. |
| 798 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 815 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 799 collector.setPseudoStyleRequest(pseudoStyleRequest); | 816 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 800 | 817 |
| 801 matchUARules(collector); | 818 matchUARules(collector); |
| 802 matchAuthorRules(state.element(), collector, false); | 819 matchAuthorRules(state.element(), collector, false); |
| 803 | 820 |
| 804 if (collector.matchedResult().matchedProperties.isEmpty()) | 821 if (!collector.matchedResult().matchedProperties.isEmpty()) |
| 822 applyMatchedProperties(state, collector.matchedResult()); |
| 823 else if (pseudoStyleRequest.pseudoId != MARKER || parentStyle->display()
!= LIST_ITEM) |
| 805 return false; | 824 return false; |
| 806 | 825 |
| 807 applyMatchedProperties(state, collector.matchedResult()); | |
| 808 applyCallbackSelectors(state); | 826 applyCallbackSelectors(state); |
| 809 | 827 |
| 810 // Cache our original display. | 828 // Cache our original display. |
| 811 state.style()->setOriginalDisplay(state.style()->display()); | 829 state.style()->setOriginalDisplay(state.style()->display()); |
| 812 | 830 |
| 813 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 831 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| 814 // in the adjustComputedStyle code. | 832 // in the adjustComputedStyle code. |
| 815 adjustComputedStyle(state, 0); | 833 adjustComputedStyle(state, 0); |
| 816 | 834 |
| 817 if (elementAnimations) | 835 if (elementAnimations) |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 visitor->trace(m_watchedSelectorsRules); | 1526 visitor->trace(m_watchedSelectorsRules); |
| 1509 visitor->trace(m_treeBoundaryCrossingRules); | 1527 visitor->trace(m_treeBoundaryCrossingRules); |
| 1510 visitor->trace(m_styleResourceLoader); | 1528 visitor->trace(m_styleResourceLoader); |
| 1511 visitor->trace(m_styleSharingLists); | 1529 visitor->trace(m_styleSharingLists); |
| 1512 visitor->trace(m_pendingStyleSheets); | 1530 visitor->trace(m_pendingStyleSheets); |
| 1513 visitor->trace(m_document); | 1531 visitor->trace(m_document); |
| 1514 #endif | 1532 #endif |
| 1515 } | 1533 } |
| 1516 | 1534 |
| 1517 } // namespace blink | 1535 } // namespace blink |
| OLD | NEW |