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

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

Issue 98663004: Add support for unprefixed CSS Transforms (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/StyleAdjuster.cpp ('k') | Source/core/frame/UseCounter.cpp » ('j') | 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
645 void StyleBuilderFunctions::applyInitialCSSPropertyPerspectiveOrigin(StyleResolv erState& state)
646 {
647 applyInitialCSSPropertyWebkitPerspectiveOriginX(state);
648 applyInitialCSSPropertyWebkitPerspectiveOriginY(state);
649 }
650
651 void StyleBuilderFunctions::applyInheritCSSPropertyPerspectiveOrigin(StyleResolv erState& state)
652 {
653 applyInheritCSSPropertyWebkitPerspectiveOriginX(state);
654 applyInheritCSSPropertyWebkitPerspectiveOriginY(state);
655 }
656
657 void StyleBuilderFunctions::applyValueCSSPropertyPerspectiveOrigin(StyleResolver State& state, CSSValue* value)
658 {
659 CSSValueList* list = toCSSValueList(value);
660 ASSERT(list->length() == 2);
661 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
662 if (primitiveValue->isValueID()) {
663 switch (primitiveValue->getValueID()) {
664 case CSSValueLeft:
665 state.style()->setPerspectiveOriginX(Length(0, Percent));
666 break;
667 case CSSValueRight:
668 state.style()->setPerspectiveOriginX(Length(100, Percent));
669 break;
670 case CSSValueCenter:
671 state.style()->setPerspectiveOriginX(Length(50, Percent));
672 break;
673 default:
674 ASSERT_NOT_REACHED();
675 }
676 } else {
677 state.style()->setPerspectiveOriginX(StyleBuilderConverter::convertLengt h(state, primitiveValue));
678 }
679
680 primitiveValue = toCSSPrimitiveValue(list->item(1));
681 if (primitiveValue->isValueID()) {
682 switch (primitiveValue->getValueID()) {
683 case CSSValueTop:
684 state.style()->setPerspectiveOriginY(Length(0, Percent));
685 break;
686 case CSSValueBottom:
687 state.style()->setPerspectiveOriginY(Length(100, Percent));
688 break;
689 case CSSValueCenter:
690 state.style()->setPerspectiveOriginY(Length(50, Percent));
691 break;
692 default:
693 ASSERT_NOT_REACHED();
694 }
695 } else {
696 state.style()->setPerspectiveOriginY(StyleBuilderConverter::convertLengt h(state, primitiveValue));
697 }
698 }
699
585 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value) 700 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value)
586 { 701 {
587 if (!value->isPrimitiveValue()) 702 if (!value->isPrimitiveValue())
588 return; 703 return;
589 704
590 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 705 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
591 706
592 if (primitiveValue->getValueID()) 707 if (primitiveValue->getValueID())
593 return state.style()->setVerticalAlign(*primitiveValue); 708 return state.style()->setVerticalAlign(*primitiveValue);
594 709
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS )->computeLength<float>(state.cssToLengthConversionData()); 1530 width = CSSPrimitiveValue::create(result, CSSPrimitiveValue::CSS_EMS )->computeLength<float>(state.cssToLengthConversionData());
1416 break; 1531 break;
1417 } 1532 }
1418 default: 1533 default:
1419 width = primitiveValue->computeLength<float>(state.cssToLengthConver sionData()); 1534 width = primitiveValue->computeLength<float>(state.cssToLengthConver sionData());
1420 break; 1535 break;
1421 } 1536 }
1422 state.style()->setTextStrokeWidth(width); 1537 state.style()->setTextStrokeWidth(width);
1423 return; 1538 return;
1424 } 1539 }
1540 case CSSPropertyTransform:
1425 case CSSPropertyWebkitTransform: { 1541 case CSSPropertyWebkitTransform: {
1426 HANDLE_INHERIT_AND_INITIAL(transform, Transform); 1542 HANDLE_INHERIT_AND_INITIAL(transform, Transform);
1427 TransformOperations operations; 1543 TransformOperations operations;
1428 TransformBuilder::createTransformOperations(value, state.cssToLengthConv ersionData(), operations); 1544 TransformBuilder::createTransformOperations(value, state.cssToLengthConv ersionData(), operations);
1429 state.style()->setTransform(operations); 1545 state.style()->setTransform(operations);
1430 return; 1546 return;
1431 } 1547 }
1548 case CSSPropertyPerspective:
1432 case CSSPropertyWebkitPerspective: { 1549 case CSSPropertyWebkitPerspective: {
1433 HANDLE_INHERIT_AND_INITIAL(perspective, Perspective) 1550 HANDLE_INHERIT_AND_INITIAL(perspective, Perspective)
1434 1551
1435 if (!primitiveValue) 1552 if (!primitiveValue)
1436 return; 1553 return;
1437 1554
1438 if (primitiveValue->getValueID() == CSSValueNone) { 1555 if (primitiveValue->getValueID() == CSSValueNone) {
1439 state.style()->setPerspective(0); 1556 state.style()->setPerspective(0);
1440 return; 1557 return;
1441 } 1558 }
1442 1559
1443 float perspectiveValue; 1560 float perspectiveValue;
1444 if (primitiveValue->isLength()) { 1561 if (primitiveValue->isLength()) {
1445 perspectiveValue = primitiveValue->computeLength<float>(state.cssToL engthConversionData()); 1562 perspectiveValue = primitiveValue->computeLength<float>(state.cssToL engthConversionData());
1446 } else if (primitiveValue->isNumber()) { 1563 } else if (id == CSSPropertyWebkitPerspective && primitiveValue->isNumbe r()) {
1447 // For backward compatibility, treat valueless numbers as px. 1564 // Prefixed version treates unitless numbers as px.
1448 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoub leValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthCon versionData()); 1565 perspectiveValue = CSSPrimitiveValue::create(primitiveValue->getDoub leValue(), CSSPrimitiveValue::CSS_PX)->computeLength<float>(state.cssToLengthCon versionData());
1449 } else { 1566 } else {
1450 return; 1567 return;
1451 } 1568 }
1452 1569
1453 if (perspectiveValue >= 0.0f) 1570 if (perspectiveValue >= 0.0f)
1454 state.style()->setPerspective(perspectiveValue); 1571 state.style()->setPerspective(perspectiveValue);
1455 return; 1572 return;
1456 } 1573 }
1457 case CSSPropertyWebkitTapHighlightColor: { 1574 case CSSPropertyWebkitTapHighlightColor: {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 case CSSPropertyWebkitAnimationDelay: 1990 case CSSPropertyWebkitAnimationDelay:
1874 case CSSPropertyWebkitAnimationDirection: 1991 case CSSPropertyWebkitAnimationDirection:
1875 case CSSPropertyWebkitAnimationDuration: 1992 case CSSPropertyWebkitAnimationDuration:
1876 case CSSPropertyWebkitAnimationFillMode: 1993 case CSSPropertyWebkitAnimationFillMode:
1877 case CSSPropertyWebkitAnimationIterationCount: 1994 case CSSPropertyWebkitAnimationIterationCount:
1878 case CSSPropertyWebkitAnimationName: 1995 case CSSPropertyWebkitAnimationName:
1879 case CSSPropertyWebkitAnimationPlayState: 1996 case CSSPropertyWebkitAnimationPlayState:
1880 case CSSPropertyWebkitAnimationTimingFunction: 1997 case CSSPropertyWebkitAnimationTimingFunction:
1881 case CSSPropertyWebkitAppearance: 1998 case CSSPropertyWebkitAppearance:
1882 case CSSPropertyWebkitAspectRatio: 1999 case CSSPropertyWebkitAspectRatio:
2000 case CSSPropertyBackfaceVisibility:
1883 case CSSPropertyWebkitBackfaceVisibility: 2001 case CSSPropertyWebkitBackfaceVisibility:
1884 case CSSPropertyWebkitBackgroundClip: 2002 case CSSPropertyWebkitBackgroundClip:
1885 case CSSPropertyWebkitBackgroundComposite: 2003 case CSSPropertyWebkitBackgroundComposite:
1886 case CSSPropertyWebkitBackgroundOrigin: 2004 case CSSPropertyWebkitBackgroundOrigin:
1887 case CSSPropertyWebkitBackgroundSize: 2005 case CSSPropertyWebkitBackgroundSize:
1888 case CSSPropertyWebkitBorderFit: 2006 case CSSPropertyWebkitBorderFit:
1889 case CSSPropertyWebkitBorderHorizontalSpacing: 2007 case CSSPropertyWebkitBorderHorizontalSpacing:
1890 case CSSPropertyWebkitBorderImage: 2008 case CSSPropertyWebkitBorderImage:
1891 case CSSPropertyWebkitBorderVerticalSpacing: 2009 case CSSPropertyWebkitBorderVerticalSpacing:
1892 case CSSPropertyWebkitBoxAlign: 2010 case CSSPropertyWebkitBoxAlign:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 case CSSPropertyWebkitMaskBoxImageWidth: 2056 case CSSPropertyWebkitMaskBoxImageWidth:
1939 case CSSPropertyWebkitMaskClip: 2057 case CSSPropertyWebkitMaskClip:
1940 case CSSPropertyWebkitMaskComposite: 2058 case CSSPropertyWebkitMaskComposite:
1941 case CSSPropertyWebkitMaskImage: 2059 case CSSPropertyWebkitMaskImage:
1942 case CSSPropertyWebkitMaskOrigin: 2060 case CSSPropertyWebkitMaskOrigin:
1943 case CSSPropertyWebkitMaskPositionX: 2061 case CSSPropertyWebkitMaskPositionX:
1944 case CSSPropertyWebkitMaskPositionY: 2062 case CSSPropertyWebkitMaskPositionY:
1945 case CSSPropertyWebkitMaskRepeatX: 2063 case CSSPropertyWebkitMaskRepeatX:
1946 case CSSPropertyWebkitMaskRepeatY: 2064 case CSSPropertyWebkitMaskRepeatY:
1947 case CSSPropertyWebkitMaskSize: 2065 case CSSPropertyWebkitMaskSize:
2066 case CSSPropertyPerspectiveOrigin:
1948 case CSSPropertyWebkitPerspectiveOrigin: 2067 case CSSPropertyWebkitPerspectiveOrigin:
1949 case CSSPropertyWebkitPerspectiveOriginX: 2068 case CSSPropertyWebkitPerspectiveOriginX:
1950 case CSSPropertyWebkitPerspectiveOriginY: 2069 case CSSPropertyWebkitPerspectiveOriginY:
1951 case CSSPropertyWebkitPrintColorAdjust: 2070 case CSSPropertyWebkitPrintColorAdjust:
1952 case CSSPropertyWebkitRtlOrdering: 2071 case CSSPropertyWebkitRtlOrdering:
1953 case CSSPropertyWebkitRubyPosition: 2072 case CSSPropertyWebkitRubyPosition:
1954 case CSSPropertyWebkitTextCombine: 2073 case CSSPropertyWebkitTextCombine:
1955 case CSSPropertyTextUnderlinePosition: 2074 case CSSPropertyTextUnderlinePosition:
1956 case CSSPropertyWebkitTextEmphasisColor: 2075 case CSSPropertyWebkitTextEmphasisColor:
1957 case CSSPropertyWebkitTextEmphasisPosition: 2076 case CSSPropertyWebkitTextEmphasisPosition:
1958 case CSSPropertyWebkitTextEmphasisStyle: 2077 case CSSPropertyWebkitTextEmphasisStyle:
1959 case CSSPropertyWebkitTextFillColor: 2078 case CSSPropertyWebkitTextFillColor:
1960 case CSSPropertyWebkitTextSecurity: 2079 case CSSPropertyWebkitTextSecurity:
1961 case CSSPropertyWebkitTextStrokeColor: 2080 case CSSPropertyWebkitTextStrokeColor:
1962 case CSSPropertyWebkitTransformOriginX: 2081 case CSSPropertyWebkitTransformOriginX:
1963 case CSSPropertyWebkitTransformOriginY: 2082 case CSSPropertyWebkitTransformOriginY:
1964 case CSSPropertyWebkitTransformOriginZ: 2083 case CSSPropertyWebkitTransformOriginZ:
2084 case CSSPropertyTransformOrigin:
2085 case CSSPropertyTransformStyle:
1965 case CSSPropertyWebkitTransformStyle: 2086 case CSSPropertyWebkitTransformStyle:
1966 case CSSPropertyWebkitTransitionDelay: 2087 case CSSPropertyWebkitTransitionDelay:
1967 case CSSPropertyWebkitTransitionDuration: 2088 case CSSPropertyWebkitTransitionDuration:
1968 case CSSPropertyWebkitTransitionProperty: 2089 case CSSPropertyWebkitTransitionProperty:
1969 case CSSPropertyWebkitTransitionTimingFunction: 2090 case CSSPropertyWebkitTransitionTimingFunction:
1970 case CSSPropertyWebkitUserDrag: 2091 case CSSPropertyWebkitUserDrag:
1971 case CSSPropertyWebkitUserModify: 2092 case CSSPropertyWebkitUserModify:
1972 case CSSPropertyWebkitUserSelect: 2093 case CSSPropertyWebkitUserSelect:
1973 case CSSPropertyWebkitClipPath: 2094 case CSSPropertyWebkitClipPath:
1974 case CSSPropertyWebkitWrapFlow: 2095 case CSSPropertyWebkitWrapFlow:
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 break; 2298 break;
2178 } 2299 }
2179 case CSSPropertyEnableBackground: 2300 case CSSPropertyEnableBackground:
2180 // Silently ignoring this property for now 2301 // Silently ignoring this property for now
2181 // http://bugs.webkit.org/show_bug.cgi?id=6022 2302 // http://bugs.webkit.org/show_bug.cgi?id=6022
2182 break; 2303 break;
2183 } 2304 }
2184 } 2305 }
2185 2306
2186 } // namespace WebCore 2307 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698