 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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2585 case CSSPropertyX: | 2585 case CSSPropertyX: | 
| 2586 return zoomAdjustedPixelValueForLength(svgStyle.x(), style); | 2586 return zoomAdjustedPixelValueForLength(svgStyle.x(), style); | 
| 2587 case CSSPropertyY: | 2587 case CSSPropertyY: | 
| 2588 return zoomAdjustedPixelValueForLength(svgStyle.y(), style); | 2588 return zoomAdjustedPixelValueForLength(svgStyle.y(), style); | 
| 2589 case CSSPropertyR: | 2589 case CSSPropertyR: | 
| 2590 return zoomAdjustedPixelValueForLength(svgStyle.r(), style); | 2590 return zoomAdjustedPixelValueForLength(svgStyle.r(), style); | 
| 2591 case CSSPropertyRx: | 2591 case CSSPropertyRx: | 
| 2592 return zoomAdjustedPixelValueForLength(svgStyle.rx(), style); | 2592 return zoomAdjustedPixelValueForLength(svgStyle.rx(), style); | 
| 2593 case CSSPropertyRy: | 2593 case CSSPropertyRy: | 
| 2594 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); | 2594 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); | 
| 2595 case CSSPropertyTranslate: { | |
| 2596 if (!style.hasTranslateProperty()) { | |
| 2597 return cssValuePool().createIdentifierValue(CSSValueNone); | |
| 
Eric Willigers
2015/06/05 01:58:22
0px
 | |
| 2598 } | |
| 2599 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2600 if (layoutObject && layoutObject->isBox()) { | |
| 2601 LayoutRect box = toLayoutBox(layoutObject)->borderBoxRect(); | |
| 2602 list->append(zoomAdjustedPixelValue(floatValueForLength(style.transl ate()->x(), box.width().toFloat()), style)); | |
| 2595 | 2603 | 
| 2604 if (style.translate()->type() != TransformOperation::TranslateX) { | |
| 2605 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr anslate()->y(), box.height().toFloat()), style)); | |
| 2606 } | |
| 2607 | |
| 2608 } else { | |
| 2609 // No box to resolve the percentage values | |
| 2610 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(), style)); | |
| 2611 | |
| 2612 if (style.translate()->type() != TransformOperation::TranslateX) { | |
| 2613 list->append(zoomAdjustedPixelValueForLength(style.translate()-> y(), style)); | |
| 2614 } | |
| 2615 } | |
| 2616 | |
| 2617 if (style.translate()->type() == TransformOperation::Translate3D) { | |
| 2618 list->append(zoomAdjustedPixelValue(style.translate()->z(), style)); | |
| 2619 } | |
| 2620 | |
| 2621 return list.release(); | |
| 2622 } | |
| 2623 case CSSPropertyRotate: { | |
| 2624 if (!style.hasRotateProperty()) | |
| 2625 return cssValuePool().createIdentifierValue(CSSValueNone); | |
| 
Eric Willigers
2015/06/05 01:58:22
0deg
 | |
| 2626 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2627 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim itiveValue::CSS_DEG)); | |
| 2628 if (style.rotate()->is3DOperation()) { | |
| 2629 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2630 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2631 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim itiveValue::CSS_NUMBER)); | |
| 2632 } | |
| 2633 return list.release(); | |
| 2634 } | |
| 2635 case CSSPropertyScale: { | |
| 2636 if (!style.hasScaleProperty()) | |
| 2637 return cssValuePool().createIdentifierValue(CSSValueNone); | |
| 
Eric Willigers
2015/06/05 01:58:22
1
 | |
| 2638 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
| 2639 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive Value::CSS_NUMBER)); | |
| 2640 if (style.scale()->type() == TransformOperation::ScaleX) | |
| 2641 return list.release(); | |
| 2642 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive Value::CSS_NUMBER)); | |
| 2643 if (style.scale()->type() == TransformOperation::Scale3D) | |
| 2644 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi tiveValue::CSS_NUMBER)); | |
| 2645 return list.release(); | |
| 2646 } | |
| 2596 case CSSPropertyAll: | 2647 case CSSPropertyAll: | 
| 2597 return nullptr; | 2648 return nullptr; | 
| 2598 default: | 2649 default: | 
| 2599 break; | 2650 break; | 
| 2600 } | 2651 } | 
| 2601 ASSERT_NOT_REACHED(); | 2652 ASSERT_NOT_REACHED(); | 
| 2602 return nullptr; | 2653 return nullptr; | 
| 2603 } | 2654 } | 
| 2604 | 2655 | 
| 2605 } | 2656 } | 
| OLD | NEW |