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

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

Issue 2247773004: [WIP] CSS Motion Path: offset-anchor and offset-position Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: offsetAnchor Created 4 years, 4 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 572
573 static CSSPrimitiveValue* valueForLineHeight(const ComputedStyle& style) 573 static CSSPrimitiveValue* valueForLineHeight(const ComputedStyle& style)
574 { 574 {
575 Length length = style.lineHeight(); 575 Length length = style.lineHeight();
576 if (length.isNegative()) 576 if (length.isNegative())
577 return CSSPrimitiveValue::createIdentifier(CSSValueNormal); 577 return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
578 578
579 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr iption().computedSize()), style); 579 return zoomAdjustedPixelValue(floatValueForLength(length, style.getFontDescr iption().computedSize()), style);
580 } 580 }
581 581
582 static CSSValue* valueForOffsetPosition(const LengthPoint& position, const Compu tedStyle& style)
583 {
584 DCHECK((position.x() == Auto) == (position.y() == Auto));
585 if (position.x() == Auto) {
586 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
587 }
588 CSSValueList* list = CSSValueList::createSpaceSeparated();
589 list->append(*zoomAdjustedPixelValueForLength(position.x(), style));
590 list->append(*zoomAdjustedPixelValueForLength(position.y(), style));
591 return list;
592 }
593
582 static CSSValueID identifierForFamily(const AtomicString& family) 594 static CSSValueID identifierForFamily(const AtomicString& family)
583 { 595 {
584 if (family == FontFamilyNames::webkit_cursive) 596 if (family == FontFamilyNames::webkit_cursive)
585 return CSSValueCursive; 597 return CSSValueCursive;
586 if (family == FontFamilyNames::webkit_fantasy) 598 if (family == FontFamilyNames::webkit_fantasy)
587 return CSSValueFantasy; 599 return CSSValueFantasy;
588 if (family == FontFamilyNames::webkit_monospace) 600 if (family == FontFamilyNames::webkit_monospace)
589 return CSSValueMonospace; 601 return CSSValueMonospace;
590 if (family == FontFamilyNames::webkit_pictograph) 602 if (family == FontFamilyNames::webkit_pictograph)
591 return CSSValueWebkitPictograph; 603 return CSSValueWebkitPictograph;
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 box = toLayoutBox(layoutObject)->borderBoxRect(); 2527 box = toLayoutBox(layoutObject)->borderBoxRect();
2516 2528
2517 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginX(), box.width()), style)); 2529 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginX(), box.width()), style));
2518 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginY(), box.height()), style)); 2530 list->append(*zoomAdjustedPixelValue(minimumValueForLength(style.per spectiveOriginY(), box.height()), style));
2519 } else { 2531 } else {
2520 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nX(), style)); 2532 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nX(), style));
2521 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nY(), style)); 2533 list->append(*zoomAdjustedPixelValueForLength(style.perspectiveOrigi nY(), style));
2522 } 2534 }
2523 return list; 2535 return list;
2524 } 2536 }
2537 case CSSPropertyOffsetAnchor:
2538 return valueForOffsetPosition(style.offsetAnchor(), style);
2539 case CSSPropertyOffsetPosition:
2540 return valueForOffsetPosition(style.offsetPosition(), style);
2525 case CSSPropertyWebkitRtlOrdering: 2541 case CSSPropertyWebkitRtlOrdering:
2526 return CSSPrimitiveValue::createIdentifier(style.rtlOrdering() ? CSSValu eVisual : CSSValueLogical); 2542 return CSSPrimitiveValue::createIdentifier(style.rtlOrdering() ? CSSValu eVisual : CSSValueLogical);
2527 case CSSPropertyWebkitTapHighlightColor: 2543 case CSSPropertyWebkitTapHighlightColor:
2528 return currentColorOrValidColor(style, style.tapHighlightColor()); 2544 return currentColorOrValidColor(style, style.tapHighlightColor());
2529 case CSSPropertyWebkitUserDrag: 2545 case CSSPropertyWebkitUserDrag:
2530 return CSSPrimitiveValue::create(style.userDrag()); 2546 return CSSPrimitiveValue::create(style.userDrag());
2531 case CSSPropertyUserSelect: 2547 case CSSPropertyUserSelect:
2532 return CSSPrimitiveValue::create(style.userSelect()); 2548 return CSSPrimitiveValue::create(style.userSelect());
2533 case CSSPropertyBorderBottomLeftRadius: 2549 case CSSPropertyBorderBottomLeftRadius:
2534 return &valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style ); 2550 return &valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style );
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 case CSSPropertyPadding: 2721 case CSSPropertyPadding:
2706 return valuesForSidesShorthand(paddingShorthand(), style, layoutObject, styledNode, allowVisitedStyle); 2722 return valuesForSidesShorthand(paddingShorthand(), style, layoutObject, styledNode, allowVisitedStyle);
2707 // Individual properties not part of the spec. 2723 // Individual properties not part of the spec.
2708 case CSSPropertyBackgroundRepeatX: 2724 case CSSPropertyBackgroundRepeatX:
2709 case CSSPropertyBackgroundRepeatY: 2725 case CSSPropertyBackgroundRepeatY:
2710 return nullptr; 2726 return nullptr;
2711 2727
2712 case CSSPropertyMotion: 2728 case CSSPropertyMotion:
2713 return valuesForShorthandProperty(motionShorthand(), style, layoutObject , styledNode, allowVisitedStyle); 2729 return valuesForShorthandProperty(motionShorthand(), style, layoutObject , styledNode, allowVisitedStyle);
2714 2730
2715 case CSSPropertyMotionPath: 2731 case CSSPropertyOffset:
2716 if (const StylePath* styleMotionPath = style.motionPath()) 2732 return valuesForShorthandProperty(offsetShorthand(), style, layoutObject , styledNode, allowVisitedStyle);
2733
2734 case CSSPropertyOffsetPath:
2735 if (const StylePath* styleMotionPath = style.offsetPath())
2717 return styleMotionPath->computedCSSValue(); 2736 return styleMotionPath->computedCSSValue();
2718 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 2737 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
2719 2738
2720 case CSSPropertyMotionOffset: 2739 case CSSPropertyOffsetDistance:
2721 return zoomAdjustedPixelValueForLength(style.motionOffset(), style); 2740 return zoomAdjustedPixelValueForLength(style.offsetDistance(), style);
2722 2741
2723 case CSSPropertyMotionRotation: { 2742 case CSSPropertyOffsetRotation: {
2724 CSSValueList* list = CSSValueList::createSpaceSeparated(); 2743 CSSValueList* list = CSSValueList::createSpaceSeparated();
2725 if (style.motionRotation().type == MotionRotationAuto) 2744 if (style.offsetRotation().type == OffsetRotationAuto)
2726 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto)); 2745 list->append(*CSSPrimitiveValue::createIdentifier(CSSValueAuto));
2727 list->append(*CSSPrimitiveValue::create(style.motionRotation().angle, CS SPrimitiveValue::UnitType::Degrees)); 2746 list->append(*CSSPrimitiveValue::create(style.offsetRotation().angle, CS SPrimitiveValue::UnitType::Degrees));
2728 return list; 2747 return list;
2729 } 2748 }
2730 2749
2731 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). 2750 // Unimplemented CSS 3 properties (including CSS3 shorthand properties).
2732 case CSSPropertyWebkitTextEmphasis: 2751 case CSSPropertyWebkitTextEmphasis:
2733 return nullptr; 2752 return nullptr;
2734 2753
2735 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch. 2754 // Directional properties are resolved by resolveDirectionAwareProperty() be fore the switch.
2736 case CSSPropertyWebkitBorderEnd: 2755 case CSSPropertyWebkitBorderEnd:
2737 case CSSPropertyWebkitBorderEndColor: 2756 case CSSPropertyWebkitBorderEndColor:
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 case CSSPropertyAll: 3021 case CSSPropertyAll:
3003 return nullptr; 3022 return nullptr;
3004 default: 3023 default:
3005 break; 3024 break;
3006 } 3025 }
3007 ASSERT_NOT_REACHED(); 3026 ASSERT_NOT_REACHED();
3008 return nullptr; 3027 return nullptr;
3009 } 3028 }
3010 3029
3011 } // namespace blink 3030 } // namespace blink
3031
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698