 Chromium Code Reviews
 Chromium Code Reviews Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1158603003:
  CSS Independent Transform Properties  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 
| 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 
| 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 
| 7 * Copyright (C) 2015 Google Inc. All rights reserved. | 7 * Copyright (C) 2015 Google Inc. All rights reserved. | 
| 8 * | 8 * | 
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or | 
| 10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public | 
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la youtObject, const ComputedStyle& style) | 948 static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la youtObject, const ComputedStyle& style) | 
| 949 { | 949 { | 
| 950 if (!layoutObject || !layoutObject->hasTransformRelatedProperty() || !style. hasTransform()) | 950 if (!layoutObject || !layoutObject->hasTransformRelatedProperty() || !style. hasTransform()) | 
| 951 return cssValuePool().createIdentifierValue(CSSValueNone); | 951 return cssValuePool().createIdentifierValue(CSSValueNone); | 
| 952 | 952 | 
| 953 IntRect box; | 953 IntRect box; | 
| 954 if (layoutObject->isBox()) | 954 if (layoutObject->isBox()) | 
| 955 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 955 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 
| 956 | 956 | 
| 957 TransformationMatrix transform; | 957 TransformationMatrix transform; | 
| 958 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath); | 958 style.applyTransform(transform, LayoutSize(box.size()), ComputedStyle::Exclu deTransformOrigin, ComputedStyle::ExcludeMotionPath, ComputedStyle::ExcludeTrans formProperty); | 
| 959 | 959 | 
| 960 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924) | 960 // FIXME: Need to print out individual functions (https://bugs.webkit.org/sh ow_bug.cgi?id=23924) | 
| 961 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; | 961 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; | 
| 962 list->append(valueForMatrixTransform(transform, style)); | 962 list->append(valueForMatrixTransform(transform, style)); | 
| 963 | 963 | 
| 964 return list.release(); | 964 return list.release(); | 
| 965 } | 965 } | 
| 966 | 966 | 
| 967 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST ransitionData::TransitionProperty& property) | 967 static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST ransitionData::TransitionProperty& property) | 
| 968 { | 968 { | 
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2631 case CSSPropertyScrollSnapType: | 2631 case CSSPropertyScrollSnapType: | 
| 2632 return cssValuePool().createValue(style.scrollSnapType()); | 2632 return cssValuePool().createValue(style.scrollSnapType()); | 
| 2633 case CSSPropertyScrollSnapPointsX: | 2633 case CSSPropertyScrollSnapPointsX: | 
| 2634 return valueForScrollSnapPoints(style.scrollSnapPointsX(), style); | 2634 return valueForScrollSnapPoints(style.scrollSnapPointsX(), style); | 
| 2635 case CSSPropertyScrollSnapPointsY: | 2635 case CSSPropertyScrollSnapPointsY: | 
| 2636 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); | 2636 return valueForScrollSnapPoints(style.scrollSnapPointsY(), style); | 
| 2637 case CSSPropertyScrollSnapCoordinate: | 2637 case CSSPropertyScrollSnapCoordinate: | 
| 2638 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ; | 2638 return valueForScrollSnapCoordinate(style.scrollSnapCoordinate(), style) ; | 
| 2639 case CSSPropertyScrollSnapDestination: | 2639 case CSSPropertyScrollSnapDestination: | 
| 2640 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e); | 2640 return valueForScrollSnapDestination(style.scrollSnapDestination(), styl e); | 
| 2641 case CSSPropertyTranslate: { | |
| 2642 if (!style.hasTranslateProperty()) | |
| 2643 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); | |
| 
Timothy Loh
2015/06/12 05:38:34
+alancutter
Do these get fed back into the StyleB
 
alancutter (OOO until 2018)
2015/06/12 07:56:31
No, animations won't be using the getComputedStyle
 | |
| 2641 | 2644 | 
| 2645 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2646 if (layoutObject && layoutObject->isBox()) { | |
| 2647 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); | |
| 2648 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl ate()->x(), box.width().toFloat()), style)); | |
| 2649 | |
| 2650 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | |
| 2651 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr anslate()->y(), box.height().toFloat()), style)); | |
| 2652 | |
| 2653 } else { | |
| 2654 // No box to resolve the percentage values | |
| 2655 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(), style)); | |
| 2656 | |
| 2657 if (!style.translate()->y().isZero() || style.translate()->z() != 0) | |
| 2658 list->append(zoomAdjustedPixelValueForLength(style.translate()-> y(), style)); | |
| 2659 } | |
| 2660 | |
| 2661 if (style.translate()->z() != 0) | |
| 2662 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); | |
| 2663 | |
| 2664 return list.release(); | |
| 2665 } | |
| 2666 case CSSPropertyRotate: { | |
| 2667 if (!style.hasRotateProperty()) | |
| 2668 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_DEG); | |
| 2669 | |
| 2670 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2671 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim itiveValue::CSS_DEG)); | |
| 2672 if (style.rotate()->x() != 0 || style.rotate()->y() != 0 || style.rotate ()->z() != 1) { | |
| 2673 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2674 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2675 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2676 } | |
| 2677 return list.release(); | |
| 2678 } | |
| 2679 case CSSPropertyScale: { | |
| 2680 if (!style.hasScaleProperty()) | |
| 2681 return cssValuePool().createValue(1, CSSPrimitiveValue::CSS_NUMBER); | |
| 2682 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2683 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive Value::CSS_NUMBER)); | |
| 2684 if (style.scale()->y() == 1 && style.scale()->z() == 1) | |
| 2685 return list.release(); | |
| 2686 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive Value::CSS_NUMBER)); | |
| 2687 if (style.scale()->z() != 1) | |
| 2688 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi tiveValue::CSS_NUMBER)); | |
| 2689 return list.release(); | |
| 2690 } | |
| 2642 case CSSPropertyAll: | 2691 case CSSPropertyAll: | 
| 2643 return nullptr; | 2692 return nullptr; | 
| 2644 default: | 2693 default: | 
| 2645 break; | 2694 break; | 
| 2646 } | 2695 } | 
| 2647 ASSERT_NOT_REACHED(); | 2696 ASSERT_NOT_REACHED(); | 
| 2648 return nullptr; | 2697 return nullptr; | 
| 2649 } | 2698 } | 
| 2650 | 2699 | 
| 2651 } | 2700 } | 
| OLD | NEW |