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

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

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 svgStyle.setBaselineShift(BS_SUB); 826 svgStyle.setBaselineShift(BS_SUB);
827 return; 827 return;
828 case CSSValueSuper: 828 case CSSValueSuper:
829 svgStyle.setBaselineShift(BS_SUPER); 829 svgStyle.setBaselineShift(BS_SUPER);
830 return; 830 return;
831 default: 831 default:
832 ASSERT_NOT_REACHED(); 832 ASSERT_NOT_REACHED();
833 } 833 }
834 } 834 }
835 835
836 void StyleBuilderFunctions::applyInitialCSSPropertyTranslate(StyleResolverState& state)
837 {
838 state.style()->setTranslate(Length(0, Fixed), Length(0, Fixed), 0);
839 }
840
841 void StyleBuilderFunctions::applyInheritCSSPropertyTranslate(StyleResolverState& state)
842 {
843 if (state.parentStyle()->hasTranslateProperty()) {
Timothy Loh 2015/06/05 00:55:59 doesn't this work without the check?
soonm 2015/06/10 04:09:32 Done.
844 state.style()->setTranslate(state.parentStyle()->translate());
845 }
Eric Willigers 2015/06/05 01:58:23 otherwise should we clear the translate property?
soonm 2015/06/10 04:09:32 The translate property is initialize to nullptr. I
846 }
847
848 void StyleBuilderFunctions::applyValueCSSPropertyTranslate(StyleResolverState& s tate, CSSValue* value)
849 {
850 CSSValueList* list = toCSSValueList(value);
851 ASSERT(list->length() >= 1 && list->length() <= 3);
852 Length tx = toCSSPrimitiveValue(list->item(0))->convertToLength(state.cssToL engthConversionData());
853 Length ty = Length(0, Fixed);
Timothy Loh 2015/06/05 00:55:59 Length ty(0, Fixed)
soonm 2015/06/10 04:09:32 Done. Transferred to StyleBuilderConverter
854 double tz = 0;
855 if (list->length() >= 2)
856 ty = toCSSPrimitiveValue(list->item(1))->convertToLength(state.cssToLeng thConversionData());
857 if (list->length() == 3)
858 tz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
859 state.style()->setTranslate(tx, ty, tz);
860 }
861
862 void StyleBuilderFunctions::applyInitialCSSPropertyRotate(StyleResolverState& st ate)
863 {
864 state.style()->setRotate(0, 0, 0, 1);
865 }
866
867 void StyleBuilderFunctions::applyInheritCSSPropertyRotate(StyleResolverState& st ate)
868 {
869 if (state.parentStyle()->hasRotateProperty()) {
870 state.style()->setRotate(state.parentStyle()->rotate());
871 }
872 }
873
874 void StyleBuilderFunctions::applyValueCSSPropertyRotate(StyleResolverState& stat e, CSSValue* value)
875 {
876 CSSValueList* list = toCSSValueList(value);
877 ASSERT(list->length() == 1 || list->length() == 4);
878 double angle = toCSSPrimitiveValue(list->item(0))->computeDegrees();
879 double x = 0;
880 double y = 0;
881 double z = 1;
882 if (list->length() == 4) {
883 x = toCSSPrimitiveValue(list->item(1))->getDoubleValue();
884 y = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
885 z = toCSSPrimitiveValue(list->item(3))->getDoubleValue();
886 }
887 state.style()->setRotate(angle, x, y, z);
888 }
889
890
891 void StyleBuilderFunctions::applyInitialCSSPropertyScale(StyleResolverState& sta te)
892 {
893 state.style()->setScale(1, 1, 1);
894 }
895
896 void StyleBuilderFunctions::applyInheritCSSPropertyScale(StyleResolverState& sta te)
897 {
898 if (state.parentStyle()->hasScaleProperty()) {
899 state.style()->setScale(state.parentStyle()->scale());
900 }
901 }
902 void StyleBuilderFunctions::applyValueCSSPropertyScale(StyleResolverState& state , CSSValue* value)
903 {
904 CSSValueList* list = toCSSValueList(value);
905 ASSERT(list->length() >= 1 && list->length() <= 3);
906 double sx = toCSSPrimitiveValue(list->item(0))->getDoubleValue();
907 double sy = 1;
908 double sz = 1;
909 if (list->length() >= 2 && list->length() <= 3)
910 sy = toCSSPrimitiveValue(list->item(1))->getDoubleValue();
911 if (list->length() == 3)
912 sz = toCSSPrimitiveValue(list->item(2))->getDoubleValue();
913 state.style()->setScale(sx, sy, sz);
914 }
915
836 } // namespace blink 916 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698