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

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

Issue 22839023: Add support for the object-position CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 CSSPropertyListStyleType, 149 CSSPropertyListStyleType,
150 CSSPropertyMarginBottom, 150 CSSPropertyMarginBottom,
151 CSSPropertyMarginLeft, 151 CSSPropertyMarginLeft,
152 CSSPropertyMarginRight, 152 CSSPropertyMarginRight,
153 CSSPropertyMarginTop, 153 CSSPropertyMarginTop,
154 CSSPropertyMaxHeight, 154 CSSPropertyMaxHeight,
155 CSSPropertyMaxWidth, 155 CSSPropertyMaxWidth,
156 CSSPropertyMinHeight, 156 CSSPropertyMinHeight,
157 CSSPropertyMinWidth, 157 CSSPropertyMinWidth,
158 CSSPropertyMixBlendMode, 158 CSSPropertyMixBlendMode,
159 CSSPropertyObjectFit,
160 CSSPropertyObjectPosition,
159 CSSPropertyOpacity, 161 CSSPropertyOpacity,
160 CSSPropertyOrphans, 162 CSSPropertyOrphans,
161 CSSPropertyOutlineColor, 163 CSSPropertyOutlineColor,
162 CSSPropertyOutlineOffset, 164 CSSPropertyOutlineOffset,
163 CSSPropertyOutlineStyle, 165 CSSPropertyOutlineStyle,
164 CSSPropertyOutlineWidth, 166 CSSPropertyOutlineWidth,
165 CSSPropertyOverflowWrap, 167 CSSPropertyOverflowWrap,
166 CSSPropertyOverflowX, 168 CSSPropertyOverflowX,
167 CSSPropertyOverflowY, 169 CSSPropertyOverflowY,
168 CSSPropertyPaddingBottom, 170 CSSPropertyPaddingBottom,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& i mage) 515 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& i mage)
514 { 516 {
515 RefPtr<CSSPrimitiveValue> horizontalRepeat; 517 RefPtr<CSSPrimitiveValue> horizontalRepeat;
516 RefPtr<CSSPrimitiveValue> verticalRepeat; 518 RefPtr<CSSPrimitiveValue> verticalRepeat;
517 519
518 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule())); 520 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule()));
519 if (image.horizontalRule() == image.verticalRule()) 521 if (image.horizontalRule() == image.verticalRule())
520 verticalRepeat = horizontalRepeat; 522 verticalRepeat = horizontalRepeat;
521 else 523 else
522 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule())); 524 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule()));
523 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release())); 525 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release(), Pair::DropIdenticalValues));
524 } 526 }
525 527
526 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle* style) 528 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle* style)
527 { 529 {
528 if (!image.hasImage()) 530 if (!image.hasImage())
529 return cssValuePool().createIdentifierValue(CSSValueNone); 531 return cssValuePool().createIdentifierValue(CSSValueNone);
530 532
531 // Image first. 533 // Image first.
532 RefPtr<CSSValue> imageValue; 534 RefPtr<CSSValue> imageValue;
533 if (image.image()) 535 if (image.image())
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 if (style->minHeight().isAuto()) 2127 if (style->minHeight().isAuto())
2126 return zoomAdjustedPixelValue(0, style.get()); 2128 return zoomAdjustedPixelValue(0, style.get());
2127 return zoomAdjustedPixelValueForLength(style->minHeight(), style.get ()); 2129 return zoomAdjustedPixelValueForLength(style->minHeight(), style.get ());
2128 case CSSPropertyMinWidth: 2130 case CSSPropertyMinWidth:
2129 // FIXME: For flex-items, min-width:auto should compute to min-conte nt. 2131 // FIXME: For flex-items, min-width:auto should compute to min-conte nt.
2130 if (style->minWidth().isAuto()) 2132 if (style->minWidth().isAuto())
2131 return zoomAdjustedPixelValue(0, style.get()); 2133 return zoomAdjustedPixelValue(0, style.get());
2132 return zoomAdjustedPixelValueForLength(style->minWidth(), style.get( )); 2134 return zoomAdjustedPixelValueForLength(style->minWidth(), style.get( ));
2133 case CSSPropertyObjectFit: 2135 case CSSPropertyObjectFit:
2134 return cssValuePool().createValue(style->objectFit()); 2136 return cssValuePool().createValue(style->objectFit());
2137 case CSSPropertyObjectPosition:
2138 return cssValuePool().createValue(
2139 Pair::create(
2140 cssValuePool().createValue(style->objectPosition().x()),
2141 cssValuePool().createValue(style->objectPosition().y()),
2142 Pair::KeepIdenticalValues));
2135 case CSSPropertyOpacity: 2143 case CSSPropertyOpacity:
2136 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu e::CSS_NUMBER); 2144 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu e::CSS_NUMBER);
2137 case CSSPropertyOrphans: 2145 case CSSPropertyOrphans:
2138 if (style->hasAutoOrphans()) 2146 if (style->hasAutoOrphans())
2139 return cssValuePool().createIdentifierValue(CSSValueAuto); 2147 return cssValuePool().createIdentifierValue(CSSValueAuto);
2140 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu e::CSS_NUMBER); 2148 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu e::CSS_NUMBER);
2141 case CSSPropertyOutlineColor: 2149 case CSSPropertyOutlineColor:
2142 return currentColorOrValidColor(renderer, style.get(), CSSPropertyOu tlineColor); 2150 return currentColorOrValidColor(renderer, style.get(), CSSPropertyOu tlineColor);
2143 case CSSPropertyOutlineOffset: 2151 case CSSPropertyOutlineOffset:
2144 return zoomAdjustedPixelValue(style->outlineOffset(), style.get()); 2152 return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3161 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3154 CSSPropertyB ackgroundClip }; 3162 CSSPropertyB ackgroundClip };
3155 3163
3156 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3164 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3157 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3165 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3158 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3166 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3159 return list.release(); 3167 return list.release();
3160 } 3168 }
3161 3169
3162 } // namespace WebCore 3170 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698