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

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

Issue 644953003: Store [-webkit-]transform-origin as a TransformOrigin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Same patch, with correct base this time. Created 6 years, 2 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) 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 state.style()->setTextIndentType(textIndentTypeValue); 544 state.style()->setTextIndentType(textIndentTypeValue);
545 } 545 }
546 546
547 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s tate, CSSValue* value) 547 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s tate, CSSValue* value)
548 { 548 {
549 TransformOperations operations; 549 TransformOperations operations;
550 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi onData(), operations); 550 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi onData(), operations);
551 state.style()->setTransform(operations); 551 state.style()->setTransform(operations);
552 } 552 }
553 553
554 void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolver State& state)
555 {
556 applyInitialCSSPropertyWebkitTransformOriginX(state);
557 applyInitialCSSPropertyWebkitTransformOriginY(state);
558 applyInitialCSSPropertyWebkitTransformOriginZ(state);
559 }
560
561 void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolver State& state)
562 {
563 applyInheritCSSPropertyWebkitTransformOriginX(state);
564 applyInheritCSSPropertyWebkitTransformOriginY(state);
565 applyInheritCSSPropertyWebkitTransformOriginZ(state);
566 }
567
568 void StyleBuilderFunctions::applyValueCSSPropertyTransformOrigin(StyleResolverSt ate& state, CSSValue* value)
569 {
570 CSSValueList* list = toCSSValueList(value);
571 ASSERT(list->length() == 3);
572 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
573 if (primitiveValue->isValueID()) {
574 switch (primitiveValue->getValueID()) {
575 case CSSValueLeft:
576 state.style()->setTransformOriginX(Length(0, Percent));
577 break;
578 case CSSValueRight:
579 state.style()->setTransformOriginX(Length(100, Percent));
580 break;
581 case CSSValueCenter:
582 state.style()->setTransformOriginX(Length(50, Percent));
583 break;
584 default:
585 ASSERT_NOT_REACHED();
586 }
587 } else {
588 state.style()->setTransformOriginX(StyleBuilderConverter::convertLength( state, primitiveValue));
589 }
590
591 primitiveValue = toCSSPrimitiveValue(list->item(1));
592 if (primitiveValue->isValueID()) {
593 switch (primitiveValue->getValueID()) {
594 case CSSValueTop:
595 state.style()->setTransformOriginY(Length(0, Percent));
596 break;
597 case CSSValueBottom:
598 state.style()->setTransformOriginY(Length(100, Percent));
599 break;
600 case CSSValueCenter:
601 state.style()->setTransformOriginY(Length(50, Percent));
602 break;
603 default:
604 ASSERT_NOT_REACHED();
605 }
606 } else {
607 state.style()->setTransformOriginY(StyleBuilderConverter::convertLength( state, primitiveValue));
608 }
609
610 primitiveValue = toCSSPrimitiveValue(list->item(2));
611 state.style()->setTransformOriginZ(StyleBuilderConverter::convertComputedLen gth<float>(state, primitiveValue));
612 }
613
614 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt ate& state) 554 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt ate& state)
615 { 555 {
616 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); 556 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign();
617 state.style()->setVerticalAlign(verticalAlign); 557 state.style()->setVerticalAlign(verticalAlign);
618 if (verticalAlign == LENGTH) 558 if (verticalAlign == LENGTH)
619 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign Length()); 559 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign Length());
620 } 560 }
621 561
622 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value) 562 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value)
623 { 563 {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 return; 939 return;
1000 case CSSValueSuper: 940 case CSSValueSuper:
1001 svgStyle.setBaselineShift(BS_SUPER); 941 svgStyle.setBaselineShift(BS_SUPER);
1002 return; 942 return;
1003 default: 943 default:
1004 ASSERT_NOT_REACHED(); 944 ASSERT_NOT_REACHED();
1005 } 945 }
1006 } 946 }
1007 947
1008 } // namespace blink 948 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698