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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 #include "core/css/resolver/MatchResult.h" | 62 #include "core/css/resolver/MatchResult.h" |
| 63 #include "core/css/resolver/MediaQueryResult.h" | 63 #include "core/css/resolver/MediaQueryResult.h" |
| 64 #include "core/css/resolver/SharedStyleFinder.h" | 64 #include "core/css/resolver/SharedStyleFinder.h" |
| 65 #include "core/css/resolver/StyleAdjuster.h" | 65 #include "core/css/resolver/StyleAdjuster.h" |
| 66 #include "core/css/resolver/StyleResolverParentScope.h" | 66 #include "core/css/resolver/StyleResolverParentScope.h" |
| 67 #include "core/css/resolver/StyleResolverState.h" | 67 #include "core/css/resolver/StyleResolverState.h" |
| 68 #include "core/css/resolver/StyleResolverStats.h" | 68 #include "core/css/resolver/StyleResolverStats.h" |
| 69 #include "core/css/resolver/ViewportStyleResolver.h" | 69 #include "core/css/resolver/ViewportStyleResolver.h" |
| 70 #include "core/dom/CSSSelectorWatch.h" | 70 #include "core/dom/CSSSelectorWatch.h" |
| 71 #include "core/dom/FirstLetterPseudoElement.h" | 71 #include "core/dom/FirstLetterPseudoElement.h" |
| 72 #include "core/dom/MarkerPseudoElement.h" | |
| 72 #include "core/dom/NodeRenderStyle.h" | 73 #include "core/dom/NodeRenderStyle.h" |
| 73 #include "core/dom/StyleEngine.h" | 74 #include "core/dom/StyleEngine.h" |
| 74 #include "core/dom/Text.h" | 75 #include "core/dom/Text.h" |
| 75 #include "core/dom/shadow/ElementShadow.h" | 76 #include "core/dom/shadow/ElementShadow.h" |
| 76 #include "core/dom/shadow/ShadowRoot.h" | 77 #include "core/dom/shadow/ShadowRoot.h" |
| 77 #include "core/frame/FrameView.h" | 78 #include "core/frame/FrameView.h" |
| 78 #include "core/frame/LocalFrame.h" | 79 #include "core/frame/LocalFrame.h" |
| 79 #include "core/html/HTMLIFrameElement.h" | 80 #include "core/html/HTMLIFrameElement.h" |
| 80 #include "core/inspector/InspectorInstrumentation.h" | 81 #include "core/inspector/InspectorInstrumentation.h" |
| 81 #include "core/rendering/RenderView.h" | 82 #include "core/rendering/RenderView.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 | 713 |
| 713 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) | 714 PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap shot(StyleResolverState& state, CSSPropertyID property, CSSValue& value) |
| 714 { | 715 { |
| 715 StyleBuilder::applyProperty(property, state, &value); | 716 StyleBuilder::applyProperty(property, state, &value); |
| 716 state.fontBuilder().createFont(state.document().styleEngine()->fontSelector( ), state.style(), state.parentStyle()); | 717 state.fontBuilder().createFont(state.document().styleEngine()->fontSelector( ), state.style(), state.parentStyle()); |
| 717 return CSSAnimatableValueFactory::create(property, *state.style()); | 718 return CSSAnimatableValueFactory::create(property, *state.style()); |
| 718 } | 719 } |
| 719 | 720 |
| 720 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) | 721 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) |
| 721 { | 722 { |
| 723 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER) | |
| 724 return MarkerPseudoElement::create(parent); | |
| 722 if (pseudoId == FIRST_LETTER) | 725 if (pseudoId == FIRST_LETTER) |
| 723 return FirstLetterPseudoElement::create(parent); | 726 return FirstLetterPseudoElement::create(parent); |
| 724 return PseudoElement::create(parent, pseudoId); | 727 return PseudoElement::create(parent, pseudoId); |
| 725 } | 728 } |
| 726 | 729 |
| 727 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) | 730 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) |
| 728 { | 731 { |
| 729 RenderObject* parentRenderer = parent.renderer(); | 732 RenderObject* parentRenderer = parent.renderer(); |
| 730 if (!parentRenderer) | 733 if (!parentRenderer) |
| 731 return nullptr; | 734 return nullptr; |
| 732 | 735 |
| 733 // The first letter pseudo element has to look up the tree and see if any | 736 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && (Runti meEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId != MARKER) && !p arentRenderer->style()->hasPseudoStyle(pseudoId)) |
|
Julien - ping for review
2014/12/05 19:44:03
Maybe we should start about thinking of doing some
dsinclair
2015/01/23 20:46:36
Done.
| |
| 734 // of the ancestors are first letter. | |
| 735 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !paren tRenderer->style()->hasPseudoStyle(pseudoId)) | |
| 736 return nullptr; | 737 return nullptr; |
| 737 | 738 |
| 738 if (pseudoId == BACKDROP && !parent.isInTopLayer()) | 739 if (pseudoId == BACKDROP && !parent.isInTopLayer()) |
| 739 return nullptr; | 740 return nullptr; |
| 740 | 741 |
| 742 // FIXME: This should also probably take inline-list-item into account when | |
| 743 // we add support. | |
| 744 if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER && parentRenderer->style()->display() != LIST_ITEM) | |
| 745 return nullptr; | |
| 746 | |
| 741 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextRenderer(parent))) | 747 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextRenderer(parent))) |
| 742 return nullptr; | 748 return nullptr; |
| 743 | 749 |
| 744 if (!parentRenderer->canHaveGeneratedChildren()) | 750 if (!parentRenderer->canHaveGeneratedChildren()) |
| 745 return nullptr; | 751 return nullptr; |
| 746 | 752 |
| 747 RenderStyle* parentStyle = parentRenderer->style(); | 753 RenderStyle* parentStyle = parentRenderer->style(); |
| 748 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) { | 754 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) { |
| 749 if (!pseudoElementRendererIsNeeded(cachedStyle)) | 755 if (!pseudoElementRendererIsNeeded(cachedStyle)) |
| 750 return nullptr; | 756 return nullptr; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 // user agent rules, don't waste time walking those rules. | 806 // user agent rules, don't waste time walking those rules. |
| 801 | 807 |
| 802 if (!baseRenderStyle) { | 808 if (!baseRenderStyle) { |
| 803 // Check UA, user and author rules. | 809 // Check UA, user and author rules. |
| 804 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); | 810 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); |
| 805 collector.setPseudoStyleRequest(pseudoStyleRequest); | 811 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 806 | 812 |
| 807 matchUARules(collector); | 813 matchUARules(collector); |
| 808 matchAuthorRules(state.element(), collector, false); | 814 matchAuthorRules(state.element(), collector, false); |
| 809 | 815 |
| 810 if (collector.matchedResult().matchedProperties.isEmpty()) | 816 if (!collector.matchedResult().matchedProperties.isEmpty()) { |
| 817 applyMatchedProperties(state, collector.matchedResult()); | |
| 818 } else if (pseudoStyleRequest.pseudoId == MARKER && parentStyle->display () == LIST_ITEM) { | |
| 819 // FIXME: this goes in the adjuster. | |
| 820 // state.style()->setDisplay(INLINE); | |
| 821 } else { | |
| 811 return false; | 822 return false; |
| 823 } | |
|
Julien - ping for review
2014/12/05 19:44:03
This code is just super weirdly structured.
dsinclair
2015/01/23 20:46:36
Code is a work in progress, I though I needed to d
| |
| 812 | 824 |
| 813 applyMatchedProperties(state, collector.matchedResult()); | |
| 814 applyCallbackSelectors(state); | 825 applyCallbackSelectors(state); |
| 815 | 826 |
| 816 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 827 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
| 817 | 828 |
| 818 // Cache our original display. | 829 // Cache our original display. |
| 819 state.style()->setOriginalDisplay(state.style()->display()); | 830 state.style()->setOriginalDisplay(state.style()->display()); |
| 820 | 831 |
| 821 // FIXME: Passing 0 as the Element* introduces a lot of complexity | 832 // FIXME: Passing 0 as the Element* introduces a lot of complexity |
| 822 // in the adjustRenderStyle code. | 833 // in the adjustRenderStyle code. |
| 823 adjustRenderStyle(state, 0); | 834 adjustRenderStyle(state, 0); |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1606 visitor->trace(m_uncommonAttributeRuleSet); | 1617 visitor->trace(m_uncommonAttributeRuleSet); |
| 1607 visitor->trace(m_watchedSelectorsRules); | 1618 visitor->trace(m_watchedSelectorsRules); |
| 1608 visitor->trace(m_treeBoundaryCrossingRules); | 1619 visitor->trace(m_treeBoundaryCrossingRules); |
| 1609 visitor->trace(m_styleSharingLists); | 1620 visitor->trace(m_styleSharingLists); |
| 1610 visitor->trace(m_pendingStyleSheets); | 1621 visitor->trace(m_pendingStyleSheets); |
| 1611 visitor->trace(m_document); | 1622 visitor->trace(m_document); |
| 1612 #endif | 1623 #endif |
| 1613 } | 1624 } |
| 1614 | 1625 |
| 1615 } // namespace blink | 1626 } // namespace blink |
| OLD | NEW |