OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 state.style()->setResolvedNonInheritedVariable( | 921 state.style()->setResolvedNonInheritedVariable( |
922 name, declaration.value(), parsedValue); | 922 name, declaration.value(), parsedValue); |
923 return; | 923 return; |
924 } | 924 } |
925 if (isInheritedProperty) | 925 if (isInheritedProperty) |
926 inherit = true; | 926 inherit = true; |
927 else | 927 else |
928 initial = true; | 928 initial = true; |
929 } | 929 } |
930 | 930 |
931 DCHECK(initial ^ inherit); | 931 state.style()->removeVariable(name, isInheritedProperty); |
Timothy Loh
2017/01/17 05:51:05
Can we just keep this? You loosened the check so n
alancutter (OOO until 2018)
2017/01/17 06:08:15
Ah, true. I mainly changed it so that the code bel
| |
932 | |
933 if (initial) { | 932 if (initial) { |
934 if (isInheritedProperty) | |
935 state.style()->removeInheritedVariable(name); | |
936 else | |
937 state.style()->removeNonInheritedVariable(name); | |
938 return; | 933 return; |
939 } | 934 } |
940 | 935 |
941 if (isInheritedProperty) { | 936 DCHECK(inherit); |
942 state.style()->removeInheritedVariable(name); | 937 CSSVariableData* parentValue = |
943 StyleInheritedVariables* parentVariables = | 938 state.parentStyle()->getVariable(name, isInheritedProperty); |
944 state.parentStyle()->inheritedVariables(); | 939 const CSSValue* parentCSSValue = |
945 if (!parentVariables) | 940 registration && parentValue |
946 return; | 941 ? state.parentStyle()->getRegisteredVariable(name, |
947 CSSVariableData* parentValue = parentVariables->getVariable(name); | 942 isInheritedProperty) |
943 : nullptr; | |
944 | |
945 if (!isInheritedProperty) { | |
946 DCHECK(registration); | |
948 if (parentValue) { | 947 if (parentValue) { |
949 if (!registration) | 948 state.style()->setResolvedNonInheritedVariable(name, parentValue, |
950 state.style()->setResolvedUnregisteredVariable(name, parentValue); | 949 parentCSSValue); |
951 else | |
952 state.style()->setResolvedInheritedVariable( | |
953 name, parentValue, parentVariables->registeredVariable(name)); | |
954 } | 950 } |
955 return; | 951 return; |
956 } | 952 } |
957 | 953 |
958 state.style()->removeNonInheritedVariable(name); | 954 if (parentValue) { |
959 StyleNonInheritedVariables* parentVariables = | 955 if (!registration) { |
960 state.parentStyle()->nonInheritedVariables(); | 956 state.style()->setResolvedUnregisteredVariable(name, parentValue); |
961 if (!parentVariables) | 957 } else { |
962 return; | 958 state.style()->setResolvedInheritedVariable(name, parentValue, |
963 CSSVariableData* parentValue = parentVariables->getVariable(name); | 959 parentCSSValue); |
964 if (parentValue) | 960 } |
965 state.style()->setResolvedNonInheritedVariable( | 961 } |
966 name, parentValue, parentVariables->registeredVariable(name)); | |
967 } | 962 } |
968 | 963 |
969 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift( | 964 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift( |
970 StyleResolverState& state) { | 965 StyleResolverState& state) { |
971 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); | 966 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); |
972 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); | 967 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); |
973 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 968 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
974 svgStyle.setBaselineShift(baselineShift); | 969 svgStyle.setBaselineShift(baselineShift); |
975 if (baselineShift == BS_LENGTH) | 970 if (baselineShift == BS_LENGTH) |
976 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); | 971 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 state.style()->setCaretColor( | 1028 state.style()->setCaretColor( |
1034 StyleBuilderConverter::convertStyleAutoColor(state, value)); | 1029 StyleBuilderConverter::convertStyleAutoColor(state, value)); |
1035 } | 1030 } |
1036 if (state.applyPropertyToVisitedLinkStyle()) { | 1031 if (state.applyPropertyToVisitedLinkStyle()) { |
1037 state.style()->setVisitedLinkCaretColor( | 1032 state.style()->setVisitedLinkCaretColor( |
1038 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); | 1033 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); |
1039 } | 1034 } |
1040 } | 1035 } |
1041 | 1036 |
1042 } // namespace blink | 1037 } // namespace blink |
OLD | NEW |