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 13 matching lines...) Expand all Loading... |
24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/css/resolver/StyleResolver.h" | 30 #include "core/css/resolver/StyleResolver.h" |
31 | 31 |
32 #include "core/CSSPropertyNames.h" | 32 #include "core/CSSPropertyNames.h" |
33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
34 #include "core/StylePropertyShorthand.h" | |
35 #include "core/animation/ActiveAnimations.h" | 34 #include "core/animation/ActiveAnimations.h" |
36 #include "core/animation/Animation.h" | 35 #include "core/animation/Animation.h" |
37 #include "core/animation/AnimationTimeline.h" | 36 #include "core/animation/AnimationTimeline.h" |
38 #include "core/animation/animatable/AnimatableValue.h" | 37 #include "core/animation/animatable/AnimatableValue.h" |
39 #include "core/animation/css/CSSAnimatableValueFactory.h" | 38 #include "core/animation/css/CSSAnimatableValueFactory.h" |
40 #include "core/animation/css/CSSAnimations.h" | 39 #include "core/animation/css/CSSAnimations.h" |
41 #include "core/animation/interpolation/StyleInterpolation.h" | 40 #include "core/animation/interpolation/StyleInterpolation.h" |
42 #include "core/css/CSSCalculationValue.h" | 41 #include "core/css/CSSCalculationValue.h" |
43 #include "core/css/CSSDefaultStyleSheets.h" | 42 #include "core/css/CSSDefaultStyleSheets.h" |
44 #include "core/css/CSSFontSelector.h" | 43 #include "core/css/CSSFontSelector.h" |
45 #include "core/css/CSSKeyframeRule.h" | 44 #include "core/css/CSSKeyframeRule.h" |
46 #include "core/css/CSSKeyframesRule.h" | 45 #include "core/css/CSSKeyframesRule.h" |
47 #include "core/css/CSSReflectValue.h" | 46 #include "core/css/CSSReflectValue.h" |
48 #include "core/css/CSSRuleList.h" | 47 #include "core/css/CSSRuleList.h" |
49 #include "core/css/CSSSelector.h" | 48 #include "core/css/CSSSelector.h" |
50 #include "core/css/CSSStyleRule.h" | 49 #include "core/css/CSSStyleRule.h" |
51 #include "core/css/CSSValueList.h" | 50 #include "core/css/CSSValueList.h" |
52 #include "core/css/CSSValuePool.h" | 51 #include "core/css/CSSValuePool.h" |
53 #include "core/css/ElementRuleCollector.h" | 52 #include "core/css/ElementRuleCollector.h" |
54 #include "core/css/FontFace.h" | 53 #include "core/css/FontFace.h" |
55 #include "core/css/MediaQueryEvaluator.h" | 54 #include "core/css/MediaQueryEvaluator.h" |
56 #include "core/css/PageRuleCollector.h" | 55 #include "core/css/PageRuleCollector.h" |
57 #include "core/css/StylePropertySet.h" | 56 #include "core/css/StylePropertySet.h" |
58 #include "core/css/StyleRuleImport.h" | 57 #include "core/css/StyleRuleImport.h" |
59 #include "core/css/StyleSheetContents.h" | 58 #include "core/css/StyleSheetContents.h" |
60 #include "core/css/parser/BisonCSSParser.h" | 59 #include "core/css/parser/BisonCSSParser.h" |
61 #include "core/css/resolver/AnimatedStyleBuilder.h" | 60 #include "core/css/resolver/AnimatedStyleBuilder.h" |
| 61 #include "core/css/resolver/CascadedValues.h" |
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/NodeRenderStyle.h" | 71 #include "core/dom/NodeRenderStyle.h" |
(...skipping 18 matching lines...) Expand all Loading... |
90 using namespace WebCore; | 90 using namespace WebCore; |
91 | 91 |
92 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) | 92 void setAnimationUpdateIfNeeded(StyleResolverState& state, Element& element) |
93 { | 93 { |
94 // If any changes to CSS Animations were detected, stash the update away for
application after the | 94 // If any changes to CSS Animations were detected, stash the update away for
application after the |
95 // render object is updated if we're in the appropriate scope. | 95 // render object is updated if we're in the appropriate scope. |
96 if (state.animationUpdate()) | 96 if (state.animationUpdate()) |
97 element.ensureActiveAnimations().cssAnimations().setPendingUpdate(state.
takeAnimationUpdate()); | 97 element.ensureActiveAnimations().cssAnimations().setPendingUpdate(state.
takeAnimationUpdate()); |
98 } | 98 } |
99 | 99 |
| 100 static bool elementTypeHasAppearanceFromUAStyle(const Element& element) |
| 101 { |
| 102 // These elements have -webkit-appearance specified in html.css |
| 103 const AtomicString& localName = element.localName(); |
| 104 return localName == HTMLNames::inputTag |
| 105 || localName == HTMLNames::textareaTag |
| 106 || localName == HTMLNames::buttonTag |
| 107 || localName == HTMLNames::progressTag |
| 108 || localName == HTMLNames::selectTag |
| 109 || localName == HTMLNames::meterTag; |
| 110 } |
| 111 |
100 } // namespace | 112 } // namespace |
101 | 113 |
102 namespace WebCore { | 114 namespace WebCore { |
103 | 115 |
104 using namespace HTMLNames; | 116 using namespace HTMLNames; |
105 | 117 |
106 RenderStyle* StyleResolver::s_styleNotYetAvailable; | 118 RenderStyle* StyleResolver::s_styleNotYetAvailable; |
107 | 119 |
108 static StylePropertySet* leftToRightDeclaration() | 120 static StylePropertySet* leftToRightDeclaration() |
109 { | 121 { |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 | 697 |
686 setAnimationUpdateIfNeeded(state, *element); | 698 setAnimationUpdateIfNeeded(state, *element); |
687 | 699 |
688 if (state.style()->hasViewportUnits()) | 700 if (state.style()->hasViewportUnits()) |
689 document().setHasViewportUnits(); | 701 document().setHasViewportUnits(); |
690 | 702 |
691 // Now return the style. | 703 // Now return the style. |
692 return state.takeStyle(); | 704 return state.takeStyle(); |
693 } | 705 } |
694 | 706 |
| 707 // FIXME: Consider refactoring to create a new class which owns the following |
| 708 // first/last/range properties. |
| 709 // c.f. //src/third_party/WebKit/Source/core/css/CSSPropertyNames.in. |
| 710 |
| 711 template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::HighPr
iorityProperties>() |
| 712 { |
| 713 COMPILE_ASSERT(CSSPropertyColor == firstCSSProperty, CSS_color_is_first_high
_priority_property); |
| 714 return CSSPropertyColor; |
| 715 } |
| 716 |
| 717 template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::HighPri
orityProperties>() |
| 718 { |
| 719 return CSSPropertyZoom; |
| 720 } |
| 721 |
| 722 template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::LowPri
orityProperties>() |
| 723 { |
| 724 COMPILE_ASSERT(CSSPropertyBackground == CSSPropertyZoom + 1, CSS_background_
is_first_low_priority_property); |
| 725 return CSSPropertyBackground; |
| 726 } |
| 727 |
| 728 template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::LowPrio
rityProperties>() |
| 729 { |
| 730 return static_cast<CSSPropertyID>(lastCSSProperty); |
| 731 } |
| 732 |
| 733 template <StyleResolver::StyleApplicationPass pass> |
| 734 bool StyleResolver::isPropertyForPass(CSSPropertyID property) |
| 735 { |
| 736 return firstCSSPropertyId<pass>() <= property && property <= lastCSSProperty
Id<pass>(); |
| 737 } |
| 738 |
695 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* element, const
RenderStyle& elementStyle, RenderStyle* parentStyle, const StyleKeyframe* keyfra
me, const AtomicString& animationName) | 739 PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(Element* element, const
RenderStyle& elementStyle, RenderStyle* parentStyle, const StyleKeyframe* keyfra
me, const AtomicString& animationName) |
696 { | 740 { |
697 ASSERT(document().frame()); | 741 ASSERT(document().frame()); |
698 ASSERT(document().settings()); | 742 ASSERT(document().settings()); |
699 ASSERT(!hasPendingAuthorStyleSheets()); | 743 ASSERT(!hasPendingAuthorStyleSheets()); |
700 | 744 |
701 if (element == document().documentElement()) | 745 if (element == document().documentElement()) |
702 resetDirectionAndWritingModeOnDocument(document()); | 746 resetDirectionAndWritingModeOnDocument(document()); |
703 StyleResolverState state(document(), element, parentStyle); | 747 StyleResolverState state(document(), element, parentStyle); |
704 | 748 |
705 MatchResult result; | 749 MatchResult matchResult; |
706 result.addMatchedProperties(&keyframe->properties()); | 750 matchResult.addMatchedProperties(&keyframe->properties()); |
707 | 751 |
708 ASSERT(!state.style()); | 752 ASSERT(!state.style()); |
709 | 753 |
710 // Create the style | 754 // Create the style |
711 state.setStyle(RenderStyle::clone(&elementStyle)); | 755 state.setStyle(RenderStyle::clone(&elementStyle)); |
712 state.setLineHeightValue(0); | |
713 | 756 |
714 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | 757 state.fontBuilder().initForStyleResolve(state.document(), state.style()); |
715 | 758 |
716 // We don't need to bother with !important. Since there is only ever one | 759 // We don't need to bother with !important. Since there is only ever one |
717 // decl, there's nothing to override. So just add the first properties. | 760 // decl, there's nothing to override. So just add the first properties. |
718 // We also don't need to bother with animation properties since the only | 761 // We also don't need to bother with animation properties since the only |
719 // relevant one is animation-timing-function and we special-case that in | 762 // relevant one is animation-timing-function and we special-case that in |
720 // CSSAnimations.cpp | 763 // CSSAnimations.cpp |
721 bool inheritedOnly = false; | 764 CascadedValues cascadedValues(state, matchResult); |
722 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu
lt.matchedProperties.size() - 1, inheritedOnly); | 765 cascadedValues.addValues(matchResult, false, 0, matchResult.matchedPropertie
s.size() - 1); |
| 766 |
| 767 cascadedValues.applyValues(firstCSSPropertyId<HighPriorityProperties>(), las
tCSSPropertyId<HighPriorityProperties>()); |
723 | 768 |
724 // If our font got dirtied, go ahead and update it now. | 769 // If our font got dirtied, go ahead and update it now. |
725 updateFont(state); | 770 updateFont(state); |
726 | 771 |
727 // Line-height is set when we are sure we decided on the font-size | 772 cascadedValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), last
CSSPropertyId<LowPriorityProperties>()); |
728 if (state.lineHeightValue()) | |
729 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); | |
730 | |
731 // Now do rest of the properties. | |
732 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul
t.matchedProperties.size() - 1, inheritedOnly); | |
733 | 773 |
734 // If our font got dirtied by one of the non-essential font props, | 774 // If our font got dirtied by one of the non-essential font props, |
735 // go ahead and update it a second time. | 775 // go ahead and update it a second time. |
736 updateFont(state); | 776 updateFont(state); |
737 | 777 |
738 loadPendingResources(state); | 778 loadPendingResources(state); |
739 | 779 |
740 didAccess(); | 780 didAccess(); |
741 | 781 |
742 return state.takeStyle(); | 782 return state.takeStyle(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 930 |
891 state.fontBuilder().initForStyleResolve(state.document(), state.style()); | 931 state.fontBuilder().initForStyleResolve(state.document(), state.style()); |
892 | 932 |
893 PageRuleCollector collector(rootElementStyle, pageIndex); | 933 PageRuleCollector collector(rootElementStyle, pageIndex); |
894 | 934 |
895 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); | 935 collector.matchPageRules(CSSDefaultStyleSheets::instance().defaultPrintStyle
()); |
896 | 936 |
897 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) | 937 if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverFor
Document()) |
898 scopedResolver->matchPageRules(collector); | 938 scopedResolver->matchPageRules(collector); |
899 | 939 |
900 state.setLineHeightValue(0); | 940 MatchResult& matchResult = collector.matchedResult(); |
901 bool inheritedOnly = false; | 941 CascadedValues cascadedValues(state, matchResult); |
| 942 cascadedValues.addValues(matchResult, false, 0, matchResult.matchedPropertie
s.size() - 1); |
| 943 cascadedValues.addValues(matchResult, true, 0, matchResult.matchedProperties
.size() - 1); |
902 | 944 |
903 MatchResult& result = collector.matchedResult(); | 945 cascadedValues.applyValues(firstCSSPropertyId<HighPriorityProperties>(), las
tCSSPropertyId<HighPriorityProperties>()); |
904 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu
lt.matchedProperties.size() - 1, inheritedOnly); | |
905 | 946 |
906 // If our font got dirtied, go ahead and update it now. | 947 // If our font got dirtied, go ahead and update it now. |
907 updateFont(state); | 948 updateFont(state); |
908 | 949 |
909 // Line-height is set when we are sure we decided on the font-size. | 950 cascadedValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), last
CSSPropertyId<LowPriorityProperties>()); |
910 if (state.lineHeightValue()) | |
911 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); | |
912 | |
913 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul
t.matchedProperties.size() - 1, inheritedOnly); | |
914 | 951 |
915 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); | 952 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features); |
916 | 953 |
917 loadPendingResources(state); | 954 loadPendingResources(state); |
918 | 955 |
919 didAccess(); | 956 didAccess(); |
920 | 957 |
921 // Now return the style. | 958 // Now return the style. |
922 return state.takeStyle(); | 959 return state.takeStyle(); |
923 } | 960 } |
(...skipping 14 matching lines...) Expand all Loading... |
938 | 975 |
939 viewportStyleResolver()->resolve(); | 976 viewportStyleResolver()->resolve(); |
940 } | 977 } |
941 | 978 |
942 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() | 979 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement() |
943 { | 980 { |
944 StyleResolverState state(document(), 0); | 981 StyleResolverState state(document(), 0); |
945 state.setStyle(RenderStyle::create()); | 982 state.setStyle(RenderStyle::create()); |
946 state.fontBuilder().initForStyleResolve(document(), state.style()); | 983 state.fontBuilder().initForStyleResolve(document(), state.style()); |
947 state.style()->setLineHeight(RenderStyle::initialLineHeight()); | 984 state.style()->setLineHeight(RenderStyle::initialLineHeight()); |
948 state.setLineHeightValue(0); | |
949 state.fontBuilder().setInitial(state.style()->effectiveZoom()); | 985 state.fontBuilder().setInitial(state.style()->effectiveZoom()); |
950 state.style()->font().update(document().styleEngine()->fontSelector()); | 986 state.style()->font().update(document().styleEngine()->fontSelector()); |
951 return state.takeStyle(); | 987 return state.takeStyle(); |
952 } | 988 } |
953 | 989 |
954 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) | 990 PassRefPtr<RenderStyle> StyleResolver::styleForText(Text* textNode) |
955 { | 991 { |
956 ASSERT(textNode); | 992 ASSERT(textNode); |
957 | 993 |
958 NodeRenderingTraversal::ParentDetails parentDetails; | 994 NodeRenderingTraversal::ParentDetails parentDetails; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 if (!(animatingElement && animatingElement->hasActiveAnimations()) | 1059 if (!(animatingElement && animatingElement->hasActiveAnimations()) |
1024 && !state.style()->transitions() && !state.style()->animations()) | 1060 && !state.style()->transitions() && !state.style()->animations()) |
1025 return false; | 1061 return false; |
1026 | 1062 |
1027 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e
lement, *state.style(), state.parentStyle(), this)); | 1063 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e
lement, *state.style(), state.parentStyle(), this)); |
1028 if (!state.animationUpdate()) | 1064 if (!state.animationUpdate()) |
1029 return false; | 1065 return false; |
1030 | 1066 |
1031 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForAnimations = state.animationUpdate()->activeInterpolation
sForAnimations(); | 1067 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForAnimations = state.animationUpdate()->activeInterpolation
sForAnimations(); |
1032 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForTransitions = state.animationUpdate()->activeInterpolatio
nsForTransitions(); | 1068 const WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >&
activeInterpolationsForTransitions = state.animationUpdate()->activeInterpolatio
nsForTransitions(); |
| 1069 |
| 1070 // FIXME: Is it possible to use CascadedValues here or is it too expensive t
o |
| 1071 // convert from Interpolations to CSSValues? |
1033 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orAnimations); | 1072 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orAnimations); |
1034 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orTransitions); | 1073 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF
orTransitions); |
1035 | 1074 |
1036 updateFont(state); | 1075 updateFont(state); |
1037 | 1076 |
1038 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rAnimations); | 1077 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rAnimations); |
1039 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); | 1078 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo
rTransitions); |
1040 | 1079 |
1041 // Start loading resources used by animations. | 1080 // Start loading resources used by animations. |
1042 loadPendingResources(state); | 1081 loadPendingResources(state); |
1043 | 1082 |
1044 ASSERT(!state.fontBuilder().fontDirty()); | 1083 ASSERT(!state.fontBuilder().fontDirty()); |
1045 | 1084 |
1046 return true; | 1085 return true; |
1047 } | 1086 } |
1048 | 1087 |
1049 template <StyleResolver::StyleApplicationPass pass> | 1088 template <StyleResolver::StyleApplicationPass pass> |
1050 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil
lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo
lations) | 1089 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil
lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo
lations) |
1051 { | 1090 { |
1052 for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::c
onst_iterator iter = activeInterpolations.begin(); iter != activeInterpolations.
end(); ++iter) { | 1091 for (WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >::c
onst_iterator iter = activeInterpolations.begin(); iter != activeInterpolations.
end(); ++iter) { |
1053 CSSPropertyID property = iter->key; | 1092 CSSPropertyID property = iter->key; |
1054 if (!isPropertyForPass<pass>(property)) | 1093 if (!isPropertyForPass<pass>(property)) |
1055 continue; | 1094 continue; |
1056 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); | 1095 const StyleInterpolation* interpolation = toStyleInterpolation(iter->val
ue.get()); |
1057 interpolation->apply(state); | 1096 interpolation->apply(state); |
1058 } | 1097 } |
1059 } | 1098 } |
1060 | 1099 |
1061 static inline bool isValidCueStyleProperty(CSSPropertyID id) | |
1062 { | |
1063 switch (id) { | |
1064 case CSSPropertyBackground: | |
1065 case CSSPropertyBackgroundAttachment: | |
1066 case CSSPropertyBackgroundClip: | |
1067 case CSSPropertyBackgroundColor: | |
1068 case CSSPropertyBackgroundImage: | |
1069 case CSSPropertyBackgroundOrigin: | |
1070 case CSSPropertyBackgroundPosition: | |
1071 case CSSPropertyBackgroundPositionX: | |
1072 case CSSPropertyBackgroundPositionY: | |
1073 case CSSPropertyBackgroundRepeat: | |
1074 case CSSPropertyBackgroundRepeatX: | |
1075 case CSSPropertyBackgroundRepeatY: | |
1076 case CSSPropertyBackgroundSize: | |
1077 case CSSPropertyColor: | |
1078 case CSSPropertyFont: | |
1079 case CSSPropertyFontFamily: | |
1080 case CSSPropertyFontSize: | |
1081 case CSSPropertyFontStyle: | |
1082 case CSSPropertyFontVariant: | |
1083 case CSSPropertyFontWeight: | |
1084 case CSSPropertyLineHeight: | |
1085 case CSSPropertyOpacity: | |
1086 case CSSPropertyOutline: | |
1087 case CSSPropertyOutlineColor: | |
1088 case CSSPropertyOutlineOffset: | |
1089 case CSSPropertyOutlineStyle: | |
1090 case CSSPropertyOutlineWidth: | |
1091 case CSSPropertyVisibility: | |
1092 case CSSPropertyWhiteSpace: | |
1093 // FIXME: 'text-decoration' shorthand to be handled when available. | |
1094 // See https://chromiumcodereview.appspot.com/19516002 for details. | |
1095 case CSSPropertyTextDecoration: | |
1096 case CSSPropertyTextShadow: | |
1097 case CSSPropertyBorderStyle: | |
1098 return true; | |
1099 case CSSPropertyTextDecorationLine: | |
1100 case CSSPropertyTextDecorationStyle: | |
1101 case CSSPropertyTextDecorationColor: | |
1102 return RuntimeEnabledFeatures::css3TextDecorationsEnabled(); | |
1103 default: | |
1104 break; | |
1105 } | |
1106 return false; | |
1107 } | |
1108 | |
1109 static inline bool isValidFirstLetterStyleProperty(CSSPropertyID id) | |
1110 { | |
1111 switch (id) { | |
1112 // Valid ::first-letter properties listed in spec: | |
1113 // http://www.w3.org/TR/css3-selectors/#application-in-css | |
1114 case CSSPropertyBackgroundAttachment: | |
1115 case CSSPropertyBackgroundBlendMode: | |
1116 case CSSPropertyBackgroundClip: | |
1117 case CSSPropertyBackgroundColor: | |
1118 case CSSPropertyBackgroundImage: | |
1119 case CSSPropertyBackgroundOrigin: | |
1120 case CSSPropertyBackgroundPosition: | |
1121 case CSSPropertyBackgroundPositionX: | |
1122 case CSSPropertyBackgroundPositionY: | |
1123 case CSSPropertyBackgroundRepeat: | |
1124 case CSSPropertyBackgroundRepeatX: | |
1125 case CSSPropertyBackgroundRepeatY: | |
1126 case CSSPropertyBackgroundSize: | |
1127 case CSSPropertyBorderBottomColor: | |
1128 case CSSPropertyBorderBottomLeftRadius: | |
1129 case CSSPropertyBorderBottomRightRadius: | |
1130 case CSSPropertyBorderBottomStyle: | |
1131 case CSSPropertyBorderBottomWidth: | |
1132 case CSSPropertyBorderImageOutset: | |
1133 case CSSPropertyBorderImageRepeat: | |
1134 case CSSPropertyBorderImageSlice: | |
1135 case CSSPropertyBorderImageSource: | |
1136 case CSSPropertyBorderImageWidth: | |
1137 case CSSPropertyBorderLeftColor: | |
1138 case CSSPropertyBorderLeftStyle: | |
1139 case CSSPropertyBorderLeftWidth: | |
1140 case CSSPropertyBorderRightColor: | |
1141 case CSSPropertyBorderRightStyle: | |
1142 case CSSPropertyBorderRightWidth: | |
1143 case CSSPropertyBorderTopColor: | |
1144 case CSSPropertyBorderTopLeftRadius: | |
1145 case CSSPropertyBorderTopRightRadius: | |
1146 case CSSPropertyBorderTopStyle: | |
1147 case CSSPropertyBorderTopWidth: | |
1148 case CSSPropertyColor: | |
1149 case CSSPropertyFloat: | |
1150 case CSSPropertyFont: | |
1151 case CSSPropertyFontFamily: | |
1152 case CSSPropertyFontKerning: | |
1153 case CSSPropertyFontSize: | |
1154 case CSSPropertyFontStretch: | |
1155 case CSSPropertyFontStyle: | |
1156 case CSSPropertyFontVariant: | |
1157 case CSSPropertyFontVariantLigatures: | |
1158 case CSSPropertyFontWeight: | |
1159 case CSSPropertyLetterSpacing: | |
1160 case CSSPropertyLineHeight: | |
1161 case CSSPropertyMarginBottom: | |
1162 case CSSPropertyMarginLeft: | |
1163 case CSSPropertyMarginRight: | |
1164 case CSSPropertyMarginTop: | |
1165 case CSSPropertyPaddingBottom: | |
1166 case CSSPropertyPaddingLeft: | |
1167 case CSSPropertyPaddingRight: | |
1168 case CSSPropertyPaddingTop: | |
1169 case CSSPropertyTextTransform: | |
1170 case CSSPropertyVerticalAlign: | |
1171 case CSSPropertyWebkitBackgroundClip: | |
1172 case CSSPropertyWebkitBackgroundComposite: | |
1173 case CSSPropertyWebkitBackgroundOrigin: | |
1174 case CSSPropertyWebkitBackgroundSize: | |
1175 case CSSPropertyWebkitBorderAfter: | |
1176 case CSSPropertyWebkitBorderAfterColor: | |
1177 case CSSPropertyWebkitBorderAfterStyle: | |
1178 case CSSPropertyWebkitBorderAfterWidth: | |
1179 case CSSPropertyWebkitBorderBefore: | |
1180 case CSSPropertyWebkitBorderBeforeColor: | |
1181 case CSSPropertyWebkitBorderBeforeStyle: | |
1182 case CSSPropertyWebkitBorderBeforeWidth: | |
1183 case CSSPropertyWebkitBorderEnd: | |
1184 case CSSPropertyWebkitBorderEndColor: | |
1185 case CSSPropertyWebkitBorderEndStyle: | |
1186 case CSSPropertyWebkitBorderEndWidth: | |
1187 case CSSPropertyWebkitBorderFit: | |
1188 case CSSPropertyWebkitBorderHorizontalSpacing: | |
1189 case CSSPropertyWebkitBorderImage: | |
1190 case CSSPropertyWebkitBorderRadius: | |
1191 case CSSPropertyWebkitBorderStart: | |
1192 case CSSPropertyWebkitBorderStartColor: | |
1193 case CSSPropertyWebkitBorderStartStyle: | |
1194 case CSSPropertyWebkitBorderStartWidth: | |
1195 case CSSPropertyWebkitBorderVerticalSpacing: | |
1196 case CSSPropertyWebkitFontSmoothing: | |
1197 case CSSPropertyWebkitMarginAfter: | |
1198 case CSSPropertyWebkitMarginAfterCollapse: | |
1199 case CSSPropertyWebkitMarginBefore: | |
1200 case CSSPropertyWebkitMarginBeforeCollapse: | |
1201 case CSSPropertyWebkitMarginBottomCollapse: | |
1202 case CSSPropertyWebkitMarginCollapse: | |
1203 case CSSPropertyWebkitMarginEnd: | |
1204 case CSSPropertyWebkitMarginStart: | |
1205 case CSSPropertyWebkitMarginTopCollapse: | |
1206 case CSSPropertyWordSpacing: | |
1207 return true; | |
1208 case CSSPropertyTextDecorationColor: | |
1209 case CSSPropertyTextDecorationLine: | |
1210 case CSSPropertyTextDecorationStyle: | |
1211 return RuntimeEnabledFeatures::css3TextDecorationsEnabled(); | |
1212 | |
1213 // text-shadow added in text decoration spec: | |
1214 // http://www.w3.org/TR/css-text-decor-3/#text-shadow-property | |
1215 case CSSPropertyTextShadow: | |
1216 // box-shadox added in CSS3 backgrounds spec: | |
1217 // http://www.w3.org/TR/css3-background/#placement | |
1218 case CSSPropertyBoxShadow: | |
1219 case CSSPropertyWebkitBoxShadow: | |
1220 // Properties that we currently support outside of spec. | |
1221 case CSSPropertyWebkitLineBoxContain: | |
1222 case CSSPropertyVisibility: | |
1223 return true; | |
1224 | |
1225 default: | |
1226 return false; | |
1227 } | |
1228 } | |
1229 | |
1230 // FIXME: Consider refactoring to create a new class which owns the following | |
1231 // first/last/range properties. | |
1232 // This method returns the first CSSPropertyId of high priority properties. | |
1233 // Other properties can depend on high priority properties. For example, | |
1234 // border-color property with currentColor value depends on color property. | |
1235 // All high priority properties are obtained by using | |
1236 // firstCSSPropertyId<HighPriorityProperties> and | |
1237 // lastCSSPropertyId<HighPriorityProperties>. | |
1238 template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::HighPr
iorityProperties>() | |
1239 { | |
1240 COMPILE_ASSERT(CSSPropertyColor == firstCSSProperty, CSS_color_is_first_high
_priority_property); | |
1241 return CSSPropertyColor; | |
1242 } | |
1243 | |
1244 // This method returns the last CSSPropertyId of high priority properties. | |
1245 template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::HighPri
orityProperties>() | |
1246 { | |
1247 COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyColor + 17, CSS_line_heig
ht_is_end_of_high_prioity_property_range); | |
1248 COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyLineHeight - 1, CSS_zoom_is_bef
ore_line_height); | |
1249 return CSSPropertyLineHeight; | |
1250 } | |
1251 | |
1252 // This method returns the first CSSPropertyId of remaining properties, | |
1253 // i.e. low priority properties. No properties depend on low priority | |
1254 // properties. So we don't need to resolve such properties quickly. | |
1255 // All low priority properties are obtained by using | |
1256 // firstCSSPropertyId<LowPriorityProperties> and | |
1257 // lastCSSPropertyId<LowPriorityProperties>. | |
1258 template<> CSSPropertyID StyleResolver::firstCSSPropertyId<StyleResolver::LowPri
orityProperties>() | |
1259 { | |
1260 COMPILE_ASSERT(CSSPropertyBackground == CSSPropertyLineHeight + 1, CSS_backg
round_is_first_low_priority_property); | |
1261 return CSSPropertyBackground; | |
1262 } | |
1263 | |
1264 // This method returns the last CSSPropertyId of low priority properties. | |
1265 template<> CSSPropertyID StyleResolver::lastCSSPropertyId<StyleResolver::LowPrio
rityProperties>() | |
1266 { | |
1267 return static_cast<CSSPropertyID>(lastCSSProperty); | |
1268 } | |
1269 | |
1270 template <StyleResolver::StyleApplicationPass pass> | |
1271 bool StyleResolver::isPropertyForPass(CSSPropertyID property) | |
1272 { | |
1273 return firstCSSPropertyId<pass>() <= property && property <= lastCSSProperty
Id<pass>(); | |
1274 } | |
1275 | |
1276 // This method expands the 'all' shorthand property to longhand properties | |
1277 // and applies the expanded longhand properties. | |
1278 template <StyleResolver::StyleApplicationPass pass> | |
1279 void StyleResolver::applyAllProperty(StyleResolverState& state, CSSValue* allVal
ue) | |
1280 { | |
1281 bool isUnsetValue = !allValue->isInitialValue() && !allValue->isInheritedVal
ue(); | |
1282 unsigned startCSSProperty = firstCSSPropertyId<pass>(); | |
1283 unsigned endCSSProperty = lastCSSPropertyId<pass>(); | |
1284 | |
1285 for (unsigned i = startCSSProperty; i <= endCSSProperty; ++i) { | |
1286 CSSPropertyID propertyId = static_cast<CSSPropertyID>(i); | |
1287 | |
1288 // StyleBuilder does not allow any expanded shorthands. | |
1289 if (isExpandedShorthandForAll(propertyId)) | |
1290 continue; | |
1291 | |
1292 // all shorthand spec says: | |
1293 // The all property is a shorthand that resets all CSS properties | |
1294 // except direction and unicode-bidi. | |
1295 // c.f. http://dev.w3.org/csswg/css-cascade/#all-shorthand | |
1296 // We skip applyProperty when a given property is unicode-bidi or | |
1297 // direction. | |
1298 if (!CSSProperty::isAffectedByAllProperty(propertyId)) | |
1299 continue; | |
1300 | |
1301 CSSValue* value; | |
1302 if (!isUnsetValue) { | |
1303 value = allValue; | |
1304 } else { | |
1305 if (CSSProperty::isInheritedProperty(propertyId)) | |
1306 value = cssValuePool().createInheritedValue().get(); | |
1307 else | |
1308 value = cssValuePool().createExplicitInitialValue().get(); | |
1309 } | |
1310 StyleBuilder::applyProperty(propertyId, state, value); | |
1311 } | |
1312 } | |
1313 | |
1314 template <StyleResolver::StyleApplicationPass pass> | |
1315 void StyleResolver::applyProperties(StyleResolverState& state, const StyleProper
tySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, Proper
tyWhitelistType propertyWhitelistType) | |
1316 { | |
1317 state.setCurrentRule(rule); | |
1318 | |
1319 unsigned propertyCount = properties->propertyCount(); | |
1320 for (unsigned i = 0; i < propertyCount; ++i) { | |
1321 StylePropertySet::PropertyReference current = properties->propertyAt(i); | |
1322 if (isImportant != current.isImportant()) | |
1323 continue; | |
1324 | |
1325 CSSPropertyID property = current.id(); | |
1326 if (property == CSSPropertyAll) { | |
1327 applyAllProperty<pass>(state, current.value()); | |
1328 continue; | |
1329 } | |
1330 | |
1331 if (inheritedOnly && !current.isInherited()) { | |
1332 // If the property value is explicitly inherited, we need to apply f
urther non-inherited properties | |
1333 // as they might override the value inherited here. For this reason
we don't allow declarations with | |
1334 // explicitly inherited properties to be cached. | |
1335 ASSERT(!current.value()->isInheritedValue()); | |
1336 continue; | |
1337 } | |
1338 | |
1339 if (propertyWhitelistType == PropertyWhitelistCue && !isValidCueStylePro
perty(property)) | |
1340 continue; | |
1341 if (propertyWhitelistType == PropertyWhitelistFirstLetter && !isValidFir
stLetterStyleProperty(property)) | |
1342 continue; | |
1343 if (!isPropertyForPass<pass>(property)) | |
1344 continue; | |
1345 if (pass == HighPriorityProperties && property == CSSPropertyLineHeight) | |
1346 state.setLineHeightValue(current.value()); | |
1347 else | |
1348 StyleBuilder::applyProperty(current.id(), state, current.value()); | |
1349 } | |
1350 } | |
1351 | |
1352 template <StyleResolver::StyleApplicationPass pass> | |
1353 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
hResult& matchResult, bool isImportant, int startIndex, int endIndex, bool inher
itedOnly) | |
1354 { | |
1355 if (startIndex == -1) | |
1356 return; | |
1357 | |
1358 if (state.style()->insideLink() != NotInsideLink) { | |
1359 for (int i = startIndex; i <= endIndex; ++i) { | |
1360 const MatchedProperties& matchedProperties = matchResult.matchedProp
erties[i]; | |
1361 unsigned linkMatchType = matchedProperties.m_types.linkMatchType; | |
1362 // FIXME: It would be nicer to pass these as arguments but that requ
ires changes in many places. | |
1363 state.setApplyPropertyToRegularStyle(linkMatchType & SelectorChecker
::MatchLink); | |
1364 state.setApplyPropertyToVisitedLinkStyle(linkMatchType & SelectorChe
cker::MatchVisited); | |
1365 | |
1366 applyProperties<pass>(state, matchedProperties.properties.get(), mat
chResult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitel
istType>(matchedProperties.m_types.whitelistType)); | |
1367 } | |
1368 state.setApplyPropertyToRegularStyle(true); | |
1369 state.setApplyPropertyToVisitedLinkStyle(false); | |
1370 return; | |
1371 } | |
1372 for (int i = startIndex; i <= endIndex; ++i) { | |
1373 const MatchedProperties& matchedProperties = matchResult.matchedProperti
es[i]; | |
1374 applyProperties<pass>(state, matchedProperties.properties.get(), matchRe
sult.matchedRules[i], isImportant, inheritedOnly, static_cast<PropertyWhitelistT
ype>(matchedProperties.m_types.whitelistType)); | |
1375 } | |
1376 } | |
1377 | |
1378 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) | 1100 static unsigned computeMatchedPropertiesHash(const MatchedProperties* properties
, unsigned size) |
1379 { | 1101 { |
1380 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); | 1102 return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size
); |
1381 } | 1103 } |
1382 | 1104 |
1383 void StyleResolver::invalidateMatchedPropertiesCache() | 1105 void StyleResolver::invalidateMatchedPropertiesCache() |
1384 { | 1106 { |
1385 m_matchedPropertiesCache.clear(); | 1107 m_matchedPropertiesCache.clear(); |
1386 } | 1108 } |
1387 | 1109 |
(...skipping 29 matching lines...) Expand all Loading... |
1417 // resulting style will be identical too. We copy the inherited prop
erties over from the cache and are done. | 1139 // resulting style will be identical too. We copy the inherited prop
erties over from the cache and are done. |
1418 state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get(
)); | 1140 state.style()->inheritFrom(cachedMatchedProperties->renderStyle.get(
)); |
1419 | 1141 |
1420 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. | 1142 // Unfortunately the link status is treated like an inherited proper
ty. We need to explicitly restore it. |
1421 state.style()->setInsideLink(linkStatus); | 1143 state.style()->setInsideLink(linkStatus); |
1422 return; | 1144 return; |
1423 } | 1145 } |
1424 applyInheritedOnly = true; | 1146 applyInheritedOnly = true; |
1425 } | 1147 } |
1426 | 1148 |
1427 // Now we have all of the matched rules in the appropriate order. Walk the r
ules and apply | 1149 CascadedValues cascadedValues(state, matchResult); |
1428 // high-priority properties first, i.e., those properties that other propert
ies depend on. | 1150 |
1429 // The order is (1) high-priority not important, (2) high-priority important
, (3) normal not important | 1151 // The MatchResult has rules in UA - User - Author order |
1430 // and (4) normal important. | 1152 cascadedValues.addValues(matchResult, false, 0, matchResult.matchedPropertie
s.size() - 1); |
1431 state.setLineHeightValue(0); | 1153 cascadedValues.addValues(matchResult, true, matchResult.ranges.firstAuthorRu
le, matchResult.ranges.lastAuthorRule); |
1432 applyMatchedProperties<HighPriorityProperties>(state, matchResult, false, 0,
matchResult.matchedProperties.size() - 1, applyInheritedOnly); | 1154 cascadedValues.addValues(matchResult, true, matchResult.ranges.firstUserRule
, matchResult.ranges.lastUserRule); |
1433 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherit
edOnly); | 1155 cascadedValues.addValues(matchResult, true, matchResult.ranges.firstUARule,
matchResult.ranges.lastUARule); |
1434 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOn
ly); | 1156 |
1435 applyMatchedProperties<HighPriorityProperties>(state, matchResult, true, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1157 cascadedValues.applyValues(firstCSSPropertyId<HighPriorityProperties>(), las
tCSSPropertyId<HighPriorityProperties>(), applyInheritedOnly); |
1436 | 1158 |
1437 if (UNLIKELY(isSVGForeignObjectElement(element))) { | 1159 if (UNLIKELY(isSVGForeignObjectElement(element))) { |
1438 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. | 1160 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb
ject content should not be scaled again. |
1439 // | 1161 // |
1440 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the | 1162 // FIXME: The following hijacks the zoom property for foreignObject so t
hat children of foreignObject get the |
1441 // correct font-size in case of zooming. 'zoom' is part of HighPriorityP
roperties, along with other font-related | 1163 // correct font-size in case of zooming. 'zoom' is part of HighPriorityP
roperties, along with other font-related |
1442 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the | 1164 // properties used as input to the FontBuilder, so resetting it here may
cause the FontBuilder to recompute the |
1443 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll | 1165 // font used as inheritable font for foreignObject content. If we want t
o support zoom on foreignObject we'll |
1444 // need to find another way of handling the SVG zoom model. | 1166 // need to find another way of handling the SVG zoom model. |
1445 state.setEffectiveZoom(RenderStyle::initialZoom()); | 1167 state.setEffectiveZoom(RenderStyle::initialZoom()); |
1446 } | 1168 } |
1447 | 1169 |
1448 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effecti
veZoom() != state.style()->effectiveZoom()) { | 1170 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->effecti
veZoom() != state.style()->effectiveZoom()) { |
1449 state.fontBuilder().setFontDirty(true); | 1171 state.fontBuilder().setFontDirty(true); |
1450 applyInheritedOnly = false; | 1172 applyInheritedOnly = false; |
1451 } | 1173 } |
1452 | 1174 |
1453 // If our font got dirtied, go ahead and update it now. | 1175 // If our font got dirtied, go ahead and update it now. |
1454 updateFont(state); | 1176 updateFont(state); |
1455 | 1177 |
1456 // Line-height is set when we are sure we decided on the font-size. | |
1457 if (state.lineHeightValue()) | |
1458 StyleBuilder::applyProperty(CSSPropertyLineHeight, state, state.lineHeig
htValue()); | |
1459 | |
1460 // Many properties depend on the font. If it changes we just apply all prope
rties. | 1178 // Many properties depend on the font. If it changes we just apply all prope
rties. |
1461 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes
cription() != state.style()->fontDescription()) | 1179 if (cachedMatchedProperties && cachedMatchedProperties->renderStyle->fontDes
cription() != state.style()->fontDescription()) |
1462 applyInheritedOnly = false; | 1180 applyInheritedOnly = false; |
1463 | 1181 |
1464 // Now do the normal priority UA properties. | 1182 // This code supports -webkit-appearance, for which we are interested |
1465 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | 1183 // in whether the user has specified border or background properties. |
| 1184 // FIXME: This is a bit of a mess, we should just compare CSSValues and |
| 1185 // store a single bit for this. |
| 1186 if (elementTypeHasAppearanceFromUAStyle(*element)) { |
| 1187 CascadedValues userAgentValues(state, matchResult); |
| 1188 userAgentValues.addValues(matchResult, false, matchResult.ranges.firstUA
Rule, matchResult.ranges.lastUARule); |
| 1189 // We only actually care about border and background properties here |
| 1190 userAgentValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(),
lastCSSPropertyId<LowPriorityProperties>(), applyInheritedOnly); |
| 1191 state.cacheUserAgentBorderAndBackground(); |
| 1192 } |
1466 | 1193 |
1467 // Cache the UA properties to pass them to RenderTheme in adjustRenderStyle. | 1194 cascadedValues.applyValues(firstCSSPropertyId<LowPriorityProperties>(), last
CSSPropertyId<LowPriorityProperties>(), applyInheritedOnly); |
1468 state.cacheUserAgentBorderAndBackground(); | |
1469 | |
1470 // Now do the author and user normal priority properties and all the !import
ant properties. | |
1471 applyMatchedProperties<LowPriorityProperties>(state, matchResult, false, mat
chResult.ranges.lastUARule + 1, matchResult.matchedProperties.size() - 1, applyI
nheritedOnly); | |
1472 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInherite
dOnly); | |
1473 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnl
y); | |
1474 applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matc
hResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly); | |
1475 | 1195 |
1476 loadPendingResources(state); | 1196 loadPendingResources(state); |
1477 | 1197 |
1478 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { | 1198 if (!cachedMatchedProperties && cacheHash && MatchedPropertiesCache::isCache
able(element, state.style(), state.parentStyle())) { |
1479 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); | 1199 INCREMENT_STYLE_STATS_COUNTER(*this, matchedPropertyCacheAdded); |
1480 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); | 1200 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHa
sh, matchResult); |
1481 } | 1201 } |
1482 | 1202 |
1483 ASSERT(!state.fontBuilder().fontDirty()); | 1203 ASSERT(!state.fontBuilder().fontDirty()); |
1484 } | 1204 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 visitor->trace(m_viewportStyleResolver); | 1284 visitor->trace(m_viewportStyleResolver); |
1565 visitor->trace(m_features); | 1285 visitor->trace(m_features); |
1566 visitor->trace(m_siblingRuleSet); | 1286 visitor->trace(m_siblingRuleSet); |
1567 visitor->trace(m_uncommonAttributeRuleSet); | 1287 visitor->trace(m_uncommonAttributeRuleSet); |
1568 visitor->trace(m_watchedSelectorsRules); | 1288 visitor->trace(m_watchedSelectorsRules); |
1569 visitor->trace(m_treeBoundaryCrossingRules); | 1289 visitor->trace(m_treeBoundaryCrossingRules); |
1570 visitor->trace(m_pendingStyleSheets); | 1290 visitor->trace(m_pendingStyleSheets); |
1571 } | 1291 } |
1572 | 1292 |
1573 } // namespace WebCore | 1293 } // namespace WebCore |
OLD | NEW |