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

Side by Side Diff: Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1158603003: CSS Independent Transform Properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Correct equality operators and remove dependencies on size() in parser 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) 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
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
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);
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()->type() != TransformOperation::TranslateX) {
2651 list->append(zoomAdjustedPixelValue(floatValueForLength(style.tr anslate()->y(), box.height().toFloat()), style));
2652 }
2653
2654 } else {
2655 // No box to resolve the percentage values
2656 list->append(zoomAdjustedPixelValueForLength(style.translate()->x(), style));
2657
2658 if (style.translate()->type() != TransformOperation::TranslateX) {
2659 list->append(zoomAdjustedPixelValueForLength(style.translate()-> y(), style));
2660 }
2661 }
2662
2663 if (style.translate()->type() == TransformOperation::Translate3D) {
2664 list->append(zoomAdjustedPixelValue(style.translate()->z(), style));
2665 }
2666
2667 return list.release();
2668 }
2669 case CSSPropertyRotate: {
2670 if (!style.hasRotateProperty())
2671 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_DEG);
2672
2673 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2674 list->append(cssValuePool().createValue(style.rotate()->angle(), CSSPrim itiveValue::CSS_DEG));
2675 if (style.rotate()->is3DOperation()) {
2676 list->append(cssValuePool().createValue(style.rotate()->x(), CSSPrim itiveValue::CSS_NUMBER));
2677 list->append(cssValuePool().createValue(style.rotate()->y(), CSSPrim itiveValue::CSS_NUMBER));
2678 list->append(cssValuePool().createValue(style.rotate()->z(), CSSPrim itiveValue::CSS_NUMBER));
2679 }
2680 return list.release();
2681 }
2682 case CSSPropertyScale: {
2683 if (!style.hasScaleProperty())
2684 return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER);
2685 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2686 list->append(cssValuePool().createValue(style.scale()->x(), CSSPrimitive Value::CSS_NUMBER));
2687 if (style.scale()->type() == TransformOperation::ScaleX)
2688 return list.release();
2689 list->append(cssValuePool().createValue(style.scale()->y(), CSSPrimitive Value::CSS_NUMBER));
2690 if (style.scale()->type() == TransformOperation::Scale3D)
2691 list->append(cssValuePool().createValue(style.scale()->z(), CSSPrimi tiveValue::CSS_NUMBER));
2692 return list.release();
2693 }
2642 case CSSPropertyAll: 2694 case CSSPropertyAll:
2643 return nullptr; 2695 return nullptr;
2644 default: 2696 default:
2645 break; 2697 break;
2646 } 2698 }
2647 ASSERT_NOT_REACHED(); 2699 ASSERT_NOT_REACHED();
2648 return nullptr; 2700 return nullptr;
2649 } 2701 }
2650 2702
2651 } 2703 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698