Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 645043002: Use StyleBuilderConverter for [-webkit-]perspective. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 { 1003 {
1004 if (!value->isPrimitiveValue()) 1004 if (!value->isPrimitiveValue())
1005 return; 1005 return;
1006 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1006 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1007 if (!primitiveValue->getValueID()) 1007 if (!primitiveValue->getValueID())
1008 return; 1008 return;
1009 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSVal ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag); 1009 state.style()->setDraggableRegionMode(primitiveValue->getValueID() == CSSVal ueDrag ? DraggableRegionDrag : DraggableRegionNoDrag);
1010 state.document().setHasAnnotatedRegions(true); 1010 state.document().setHasAnnotatedRegions(true);
1011 } 1011 }
1012 1012
1013 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitPerspective(StyleResolv erState& state)
1014 {
1015 applyInitialCSSPropertyPerspective(state);
1016 }
1017
1018 void StyleBuilderFunctions::applyInheritCSSPropertyWebkitPerspective(StyleResolv erState& state)
1019 {
1020 applyInheritCSSPropertyPerspective(state);
1021 }
1022
1023 void StyleBuilderFunctions::applyValueCSSPropertyWebkitPerspective(StyleResolver State& state, CSSValue* value)
1024 {
1025 if (!value->isPrimitiveValue())
1026 return;
1027 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1028 if (primitiveValue->isNumber()) {
1029 float perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDo ubleValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthC onversionData());
1030 if (perspectiveValue >= 0.0f)
1031 state.style()->setPerspective(perspectiveValue);
1032 } else {
1033 applyValueCSSPropertyPerspective(state, value);
1034 }
1035 }
1036
1037 void StyleBuilderFunctions::applyValueCSSPropertyPerspective(StyleResolverState& state, CSSValue* value)
1038 {
1039 if (!value->isPrimitiveValue())
1040 return;
1041 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1042 if (primitiveValue->getValueID() == CSSValueNone) {
1043 state.style()->setPerspective(0);
1044 return;
1045 }
1046
1047 if (!primitiveValue->isLength())
1048 return;
1049 float perspectiveValue = primitiveValue->computeLength<float>(state.cssToLen gthConversionData());
1050 if (perspectiveValue >= 0.0f)
1051 state.style()->setPerspective(perspectiveValue);
1052 }
1053
1054 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver State& state, CSSValue* value) 1013 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolver State& state, CSSValue* value)
1055 { 1014 {
1056 if (value->isPrimitiveValue()) 1015 if (value->isPrimitiveValue())
1057 state.setWritingMode(*toCSSPrimitiveValue(value)); 1016 state.setWritingMode(*toCSSPrimitiveValue(value));
1058 1017
1059 // FIXME: It is not ok to modify document state while applying style. 1018 // FIXME: It is not ok to modify document state while applying style.
1060 if (state.element() && state.element() == state.document().documentElement() ) 1019 if (state.element() && state.element() == state.document().documentElement() )
1061 state.document().setWritingModeSetOnDocumentElement(true); 1020 state.document().setWritingModeSetOnDocumentElement(true);
1062 } 1021 }
1063 1022
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 return; 1054 return;
1096 case CSSValueSuper: 1055 case CSSValueSuper:
1097 svgStyle.setBaselineShift(BS_SUPER); 1056 svgStyle.setBaselineShift(BS_SUPER);
1098 return; 1057 return;
1099 default: 1058 default:
1100 ASSERT_NOT_REACHED(); 1059 ASSERT_NOT_REACHED();
1101 } 1060 }
1102 } 1061 }
1103 1062
1104 } // namespace blink 1063 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698