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/NodeRenderStyle.h" | 74 #include "core/dom/NodeRenderStyle.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/html/HTMLIFrameElement.h" | 81 #include "core/html/HTMLIFrameElement.h" |
81 #include "core/inspector/InspectorInstrumentation.h" | 82 #include "core/inspector/InspectorInstrumentation.h" |
82 #include "core/rendering/RenderView.h" | 83 #include "core/rendering/RenderView.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
713 | 714 |
714 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) | 715 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) |
715 { | 716 { |
716 StyleBuilder::applyProperty(property, state, &value); | 717 StyleBuilder::applyProperty(property, state, &value); |
717 state.fontBuilder().createFont(state.document().styleEngine()->fontSelector( ), state.style(), state.parentStyle()); | 718 state.fontBuilder().createFont(state.document().styleEngine()->fontSelector( ), state.style(), state.parentStyle()); |
718 return CSSAnimatableValueFactory::create(property, *state.style()); | 719 return CSSAnimatableValueFactory::create(property, *state.style()); |
719 } | 720 } |
720 | 721 |
721 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) | 722 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) |
722 { | 723 { |
724 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER) | |
725 return MarkerPseudoElement::create(parent); | |
723 if (pseudoId == FIRST_LETTER) | 726 if (pseudoId == FIRST_LETTER) |
724 return FirstLetterPseudoElement::create(parent); | 727 return FirstLetterPseudoElement::create(parent); |
725 return PseudoElement::create(parent, pseudoId); | 728 return PseudoElement::create(parent, pseudoId); |
726 } | 729 } |
727 | 730 |
731 bool StyleResolver::pseudoElementRequired(PseudoId pseudoId, RenderObject& paren tRenderer) | |
732 { | |
733 if (pseudoId == FIRST_LETTER) | |
734 return true; | |
735 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER) | |
736 return true; | |
737 if (parentRenderer.style()->hasPseudoStyle(pseudoId)) | |
738 return true; | |
739 return pseudoId >= FIRST_INTERNAL_PSEUDOID; | |
740 } | |
741 | |
728 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) | 742 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) |
729 { | 743 { |
730 RenderObject* parentRenderer = parent.renderer(); | 744 RenderObject* parentRenderer = parent.renderer(); |
731 if (!parentRenderer) | 745 if (!parentRenderer) |
732 return nullptr; | 746 return nullptr; |
733 | 747 |
734 // The first letter pseudo element has to look up the tree and see if any | 748 if (!pseudoElementRequired(pseudoId, *parentRenderer)) |
735 // of the ancestors are first letter. | |
736 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !paren tRenderer->style()->hasPseudoStyle(pseudoId)) | |
737 return nullptr; | 749 return nullptr; |
738 | 750 |
739 if (pseudoId == BACKDROP && !parent.isInTopLayer()) | 751 if (pseudoId == BACKDROP && !parent.isInTopLayer()) |
740 return nullptr; | 752 return nullptr; |
741 | 753 |
754 // FIXME: This should also probably take inline-list-item into account when | |
755 // we add support. | |
756 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER && parentRenderer->style()->display() != LIST_ITEM) | |
Julien - ping for review
2015/02/04 01:56:33
pseudoId == MARKER && parentRenderer->style()->dis
dsinclair
2015/02/04 15:30:59
They're slightly different. This one is == && != a
| |
757 return nullptr; | |
758 | |
742 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextRenderer(parent))) | 759 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextRenderer(parent))) |
743 return nullptr; | 760 return nullptr; |
744 | 761 |
745 if (!parentRenderer->canHaveGeneratedChildren()) | 762 if (!parentRenderer->canHaveGeneratedChildren()) |
746 return nullptr; | 763 return nullptr; |
747 | 764 |
748 RenderStyle* parentStyle = parentRenderer->style(); | 765 RenderStyle* parentStyle = parentRenderer->style(); |
749 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) { | 766 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) { |
750 if (!pseudoElementRendererIsNeeded(cachedStyle)) | 767 if (!pseudoElementRendererIsNeeded(cachedStyle)) |
751 return nullptr; | 768 return nullptr; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
801 // user agent rules, don't waste time walking those rules. | 818 // user agent rules, don't waste time walking those rules. |
802 | 819 |
803 if (!baseRenderStyle) { | 820 if (!baseRenderStyle) { |
804 // Check UA, user and author rules. | 821 // Check UA, user and author rules. |
805 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); | 822 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); |
806 collector.setPseudoStyleRequest(pseudoStyleRequest); | 823 collector.setPseudoStyleRequest(pseudoStyleRequest); |
807 | 824 |
808 matchUARules(collector); | 825 matchUARules(collector); |
809 matchAuthorRules(state.element(), collector, false); | 826 matchAuthorRules(state.element(), collector, false); |
810 | 827 |
811 if (collector.matchedResult().matchedProperties.isEmpty()) | 828 if (!collector.matchedResult().matchedProperties.isEmpty()) |
829 applyMatchedProperties(state, collector.matchedResult()); | |
830 else if (pseudoStyleRequest.pseudoId != MARKER || parentStyle->display() != LIST_ITEM) | |
Julien - ping for review
2015/02/04 01:56:33
This code is pretty confusing now IMHO. Keeping th
dsinclair
2015/02/04 04:41:33
Not sure what you mean, do you mean keeping the ol
| |
812 return false; | 831 return false; |
813 | 832 |
814 applyMatchedProperties(state, collector.matchedResult()); | |
815 applyCallbackSelectors(state); | 833 applyCallbackSelectors(state); |
816 | 834 |
817 // Cache our original display. | 835 // Cache our original display. |
818 state.style()->setOriginalDisplay(state.style()->display()); | 836 state.style()->setOriginalDisplay(state.style()->display()); |
819 | 837 |
820 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 838 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
821 // in the adjustRenderStyle code. | 839 // in the adjustRenderStyle code. |
822 adjustRenderStyle(state, 0); | 840 adjustRenderStyle(state, 0); |
823 | 841 |
824 if (activeAnimations) | 842 if (activeAnimations) |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1573 visitor->trace(m_uncommonAttributeRuleSet); | 1591 visitor->trace(m_uncommonAttributeRuleSet); |
1574 visitor->trace(m_watchedSelectorsRules); | 1592 visitor->trace(m_watchedSelectorsRules); |
1575 visitor->trace(m_treeBoundaryCrossingRules); | 1593 visitor->trace(m_treeBoundaryCrossingRules); |
1576 visitor->trace(m_styleSharingLists); | 1594 visitor->trace(m_styleSharingLists); |
1577 visitor->trace(m_pendingStyleSheets); | 1595 visitor->trace(m_pendingStyleSheets); |
1578 visitor->trace(m_document); | 1596 visitor->trace(m_document); |
1579 #endif | 1597 #endif |
1580 } | 1598 } |
1581 | 1599 |
1582 } // namespace blink | 1600 } // namespace blink |
OLD | NEW |