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

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

Issue 212483003: CSS Transforms: Implement transform-origin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/resolver/AnimatedStyleBuilder.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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 575
576 ASSERT(valueList->length() <= 2); 576 ASSERT(valueList->length() <= 2);
577 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1)); 577 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
578 if (eachLineValue) { 578 if (eachLineValue) {
579 ASSERT(eachLineValue->getValueID() == CSSValueEachLine); 579 ASSERT(eachLineValue->getValueID() == CSSValueEachLine);
580 state.style()->setTextIndentLine(TextIndentEachLine); 580 state.style()->setTextIndentLine(TextIndentEachLine);
581 } else 581 } else
582 state.style()->setTextIndentLine(TextIndentFirstLine); 582 state.style()->setTextIndentLine(TextIndentFirstLine);
583 } 583 }
584 584
585 void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolver State& state)
586 {
587 applyInitialCSSPropertyWebkitTransformOriginX(state);
588 applyInitialCSSPropertyWebkitTransformOriginY(state);
589 applyInitialCSSPropertyWebkitTransformOriginZ(state);
590 }
591
592 void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolver State& state)
593 {
594 applyInheritCSSPropertyWebkitTransformOriginX(state);
595 applyInheritCSSPropertyWebkitTransformOriginY(state);
596 applyInheritCSSPropertyWebkitTransformOriginZ(state);
597 }
598
599 void StyleBuilderFunctions::applyValueCSSPropertyTransformOrigin(StyleResolverSt ate& state, CSSValue* value)
600 {
601 CSSValueList* list = toCSSValueList(value);
602 ASSERT(list->length() == 3);
603 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
604 if (primitiveValue->isValueID()) {
605 switch (primitiveValue->getValueID()) {
606 case CSSValueLeft:
607 state.style()->setTransformOriginX(Length(0, Percent));
608 break;
609 case CSSValueRight:
610 state.style()->setTransformOriginX(Length(100, Percent));
611 break;
612 case CSSValueCenter:
613 state.style()->setTransformOriginX(Length(50, Percent));
614 break;
615 default:
616 ASSERT_NOT_REACHED();
617 }
618 } else {
619 state.style()->setTransformOriginX(StyleBuilderConverter::convertLength( state, primitiveValue));
620 }
621
622 primitiveValue = toCSSPrimitiveValue(list->item(1));
623 if (primitiveValue->isValueID()) {
624 switch (primitiveValue->getValueID()) {
625 case CSSValueTop:
626 state.style()->setTransformOriginY(Length(0, Percent));
627 break;
628 case CSSValueBottom:
629 state.style()->setTransformOriginY(Length(100, Percent));
630 break;
631 case CSSValueCenter:
632 state.style()->setTransformOriginY(Length(50, Percent));
633 break;
634 default:
635 ASSERT_NOT_REACHED();
636 }
637 } else {
638 state.style()->setTransformOriginY(StyleBuilderConverter::convertLength( state, primitiveValue));
639 }
640
641 primitiveValue = toCSSPrimitiveValue(list->item(2));
642 state.style()->setTransformOriginZ(StyleBuilderConverter::convertComputedLen gth<float>(state, primitiveValue));
643 }
644
585 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value) 645 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value)
586 { 646 {
587 if (!value->isPrimitiveValue()) 647 if (!value->isPrimitiveValue())
588 return; 648 return;
589 649
590 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 650 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
591 651
592 if (primitiveValue->getValueID()) 652 if (primitiveValue->getValueID())
593 return state.style()->setVerticalAlign(*primitiveValue); 653 return state.style()->setVerticalAlign(*primitiveValue);
594 654
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 state.style()->setAlignItems(*pairValue->first()); 1797 state.style()->setAlignItems(*pairValue->first());
1738 state.style()->setAlignItemsOverflowAlignment(*pairValue->second()); 1798 state.style()->setAlignItemsOverflowAlignment(*pairValue->second());
1739 } else { 1799 } else {
1740 state.style()->setAlignItems(*primitiveValue); 1800 state.style()->setAlignItems(*primitiveValue);
1741 } 1801 }
1742 return; 1802 return;
1743 } 1803 }
1744 1804
1745 // FIXME: crbug.com/154772 Unimplemented css-transforms properties 1805 // FIXME: crbug.com/154772 Unimplemented css-transforms properties
1746 case CSSPropertyPerspectiveOrigin: 1806 case CSSPropertyPerspectiveOrigin:
1747 case CSSPropertyTransformOrigin:
1748 return; 1807 return;
1749 // These properties are aliased and we already applied the property on the p refixed version. 1808 // These properties are aliased and we already applied the property on the p refixed version.
1750 case CSSPropertyAnimationDelay: 1809 case CSSPropertyAnimationDelay:
1751 case CSSPropertyAnimationDirection: 1810 case CSSPropertyAnimationDirection:
1752 case CSSPropertyAnimationDuration: 1811 case CSSPropertyAnimationDuration:
1753 case CSSPropertyAnimationFillMode: 1812 case CSSPropertyAnimationFillMode:
1754 case CSSPropertyAnimationIterationCount: 1813 case CSSPropertyAnimationIterationCount:
1755 case CSSPropertyAnimationName: 1814 case CSSPropertyAnimationName:
1756 case CSSPropertyAnimationPlayState: 1815 case CSSPropertyAnimationPlayState:
1757 case CSSPropertyAnimationTimingFunction: 1816 case CSSPropertyAnimationTimingFunction:
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 case CSSPropertyTextUnderlinePosition: 2019 case CSSPropertyTextUnderlinePosition:
1961 case CSSPropertyWebkitTextEmphasisColor: 2020 case CSSPropertyWebkitTextEmphasisColor:
1962 case CSSPropertyWebkitTextEmphasisPosition: 2021 case CSSPropertyWebkitTextEmphasisPosition:
1963 case CSSPropertyWebkitTextEmphasisStyle: 2022 case CSSPropertyWebkitTextEmphasisStyle:
1964 case CSSPropertyWebkitTextFillColor: 2023 case CSSPropertyWebkitTextFillColor:
1965 case CSSPropertyWebkitTextSecurity: 2024 case CSSPropertyWebkitTextSecurity:
1966 case CSSPropertyWebkitTextStrokeColor: 2025 case CSSPropertyWebkitTextStrokeColor:
1967 case CSSPropertyWebkitTransformOriginX: 2026 case CSSPropertyWebkitTransformOriginX:
1968 case CSSPropertyWebkitTransformOriginY: 2027 case CSSPropertyWebkitTransformOriginY:
1969 case CSSPropertyWebkitTransformOriginZ: 2028 case CSSPropertyWebkitTransformOriginZ:
2029 case CSSPropertyTransformOrigin:
1970 case CSSPropertyTransformStyle: 2030 case CSSPropertyTransformStyle:
1971 case CSSPropertyWebkitTransformStyle: 2031 case CSSPropertyWebkitTransformStyle:
1972 case CSSPropertyWebkitTransitionDelay: 2032 case CSSPropertyWebkitTransitionDelay:
1973 case CSSPropertyWebkitTransitionDuration: 2033 case CSSPropertyWebkitTransitionDuration:
1974 case CSSPropertyWebkitTransitionProperty: 2034 case CSSPropertyWebkitTransitionProperty:
1975 case CSSPropertyWebkitTransitionTimingFunction: 2035 case CSSPropertyWebkitTransitionTimingFunction:
1976 case CSSPropertyWebkitUserDrag: 2036 case CSSPropertyWebkitUserDrag:
1977 case CSSPropertyWebkitUserModify: 2037 case CSSPropertyWebkitUserModify:
1978 case CSSPropertyWebkitUserSelect: 2038 case CSSPropertyWebkitUserSelect:
1979 case CSSPropertyWebkitClipPath: 2039 case CSSPropertyWebkitClipPath:
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 break; 2243 break;
2184 } 2244 }
2185 case CSSPropertyEnableBackground: 2245 case CSSPropertyEnableBackground:
2186 // Silently ignoring this property for now 2246 // Silently ignoring this property for now
2187 // http://bugs.webkit.org/show_bug.cgi?id=6022 2247 // http://bugs.webkit.org/show_bug.cgi?id=6022
2188 break; 2248 break;
2189 } 2249 }
2190 } 2250 }
2191 2251
2192 } // namespace WebCore 2252 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/AnimatedStyleBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698