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

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: Almost forgot: drop unused ctor. (+ rebase). 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 state.style()->setTextIndentType(textIndentTypeValue); 545 state.style()->setTextIndentType(textIndentTypeValue);
546 } 546 }
547 547
548 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s tate, CSSValue* value) 548 void StyleBuilderFunctions::applyValueCSSPropertyTransform(StyleResolverState& s tate, CSSValue* value)
549 { 549 {
550 TransformOperations operations; 550 TransformOperations operations;
551 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi onData(), operations); 551 TransformBuilder::createTransformOperations(value, state.cssToLengthConversi onData(), operations);
552 state.style()->setTransform(operations); 552 state.style()->setTransform(operations);
553 } 553 }
554 554
555 void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolver State& state)
556 {
557 applyInitialCSSPropertyWebkitTransformOriginX(state);
558 applyInitialCSSPropertyWebkitTransformOriginY(state);
559 applyInitialCSSPropertyWebkitTransformOriginZ(state);
560 }
561
562 void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolver State& state)
563 {
564 applyInheritCSSPropertyWebkitTransformOriginX(state);
565 applyInheritCSSPropertyWebkitTransformOriginY(state);
566 applyInheritCSSPropertyWebkitTransformOriginZ(state);
567 }
568
569 void StyleBuilderFunctions::applyValueCSSPropertyTransformOrigin(StyleResolverSt ate& state, CSSValue* value)
570 {
571 CSSValueList* list = toCSSValueList(value);
572 ASSERT(list->length() == 3);
573 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0));
574 if (primitiveValue->isValueID()) {
575 switch (primitiveValue->getValueID()) {
576 case CSSValueLeft:
577 state.style()->setTransformOriginX(Length(0, Percent));
578 break;
579 case CSSValueRight:
580 state.style()->setTransformOriginX(Length(100, Percent));
581 break;
582 case CSSValueCenter:
583 state.style()->setTransformOriginX(Length(50, Percent));
584 break;
585 default:
586 ASSERT_NOT_REACHED();
587 }
588 } else {
589 state.style()->setTransformOriginX(StyleBuilderConverter::convertLength( state, primitiveValue));
590 }
591
592 primitiveValue = toCSSPrimitiveValue(list->item(1));
593 if (primitiveValue->isValueID()) {
594 switch (primitiveValue->getValueID()) {
595 case CSSValueTop:
596 state.style()->setTransformOriginY(Length(0, Percent));
597 break;
598 case CSSValueBottom:
599 state.style()->setTransformOriginY(Length(100, Percent));
600 break;
601 case CSSValueCenter:
602 state.style()->setTransformOriginY(Length(50, Percent));
603 break;
604 default:
605 ASSERT_NOT_REACHED();
606 }
607 } else {
608 state.style()->setTransformOriginY(StyleBuilderConverter::convertLength( state, primitiveValue));
609 }
610
611 primitiveValue = toCSSPrimitiveValue(list->item(2));
612 state.style()->setTransformOriginZ(StyleBuilderConverter::convertComputedLen gth<float>(state, primitiveValue));
613 }
614
615 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt ate& state) 555 void StyleBuilderFunctions::applyInheritCSSPropertyVerticalAlign(StyleResolverSt ate& state)
616 { 556 {
617 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign(); 557 EVerticalAlign verticalAlign = state.parentStyle()->verticalAlign();
618 state.style()->setVerticalAlign(verticalAlign); 558 state.style()->setVerticalAlign(verticalAlign);
619 if (verticalAlign == LENGTH) 559 if (verticalAlign == LENGTH)
620 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign Length()); 560 state.style()->setVerticalAlignLength(state.parentStyle()->verticalAlign Length());
621 } 561 }
622 562
623 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value) 563 void StyleBuilderFunctions::applyValueCSSPropertyVerticalAlign(StyleResolverStat e& state, CSSValue* value)
624 { 564 {
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 return; 968 return;
1029 case CSSValueSuper: 969 case CSSValueSuper:
1030 svgStyle.setBaselineShift(BS_SUPER); 970 svgStyle.setBaselineShift(BS_SUPER);
1031 return; 971 return;
1032 default: 972 default:
1033 ASSERT_NOT_REACHED(); 973 ASSERT_NOT_REACHED();
1034 } 974 }
1035 } 975 }
1036 976
1037 } // namespace blink 977 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698