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

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: Rebase master 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& i mage) 516 static PassRefPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& i mage)
515 { 517 {
516 RefPtr<CSSPrimitiveValue> horizontalRepeat; 518 RefPtr<CSSPrimitiveValue> horizontalRepeat;
517 RefPtr<CSSPrimitiveValue> verticalRepeat; 519 RefPtr<CSSPrimitiveValue> verticalRepeat;
518 520
519 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule())); 521 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule()));
520 if (image.horizontalRule() == image.verticalRule()) 522 if (image.horizontalRule() == image.verticalRule())
521 verticalRepeat = horizontalRepeat; 523 verticalRepeat = horizontalRepeat;
522 else 524 else
523 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule())); 525 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule()));
524 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release())); 526 return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), v erticalRepeat.release(), Pair::DropIdenticalValues));
525 } 527 }
526 528
527 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle* style) 529 static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const RenderStyle* style)
528 { 530 {
529 if (!image.hasImage()) 531 if (!image.hasImage())
530 return cssValuePool().createIdentifierValue(CSSValueNone); 532 return cssValuePool().createIdentifierValue(CSSValueNone);
531 533
532 // Image first. 534 // Image first.
533 RefPtr<CSSValue> imageValue; 535 RefPtr<CSSValue> imageValue;
534 if (image.image()) 536 if (image.image())
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 if (style->minHeight().isAuto()) 2178 if (style->minHeight().isAuto())
2177 return zoomAdjustedPixelValue(0, style.get()); 2179 return zoomAdjustedPixelValue(0, style.get());
2178 return zoomAdjustedPixelValueForLength(style->minHeight(), style.get ()); 2180 return zoomAdjustedPixelValueForLength(style->minHeight(), style.get ());
2179 case CSSPropertyMinWidth: 2181 case CSSPropertyMinWidth:
2180 // FIXME: For flex-items, min-width:auto should compute to min-conte nt. 2182 // FIXME: For flex-items, min-width:auto should compute to min-conte nt.
2181 if (style->minWidth().isAuto()) 2183 if (style->minWidth().isAuto())
2182 return zoomAdjustedPixelValue(0, style.get()); 2184 return zoomAdjustedPixelValue(0, style.get());
2183 return zoomAdjustedPixelValueForLength(style->minWidth(), style.get( )); 2185 return zoomAdjustedPixelValueForLength(style->minWidth(), style.get( ));
2184 case CSSPropertyObjectFit: 2186 case CSSPropertyObjectFit:
2185 return cssValuePool().createValue(style->objectFit()); 2187 return cssValuePool().createValue(style->objectFit());
2188 case CSSPropertyObjectPosition:
2189 return cssValuePool().createValue(
2190 Pair::create(
2191 cssValuePool().createValue(style->objectPosition().x()),
2192 cssValuePool().createValue(style->objectPosition().y()),
2193 Pair::KeepIdenticalValues));
2186 case CSSPropertyOpacity: 2194 case CSSPropertyOpacity:
2187 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu e::CSS_NUMBER); 2195 return cssValuePool().createValue(style->opacity(), CSSPrimitiveValu e::CSS_NUMBER);
2188 case CSSPropertyOrphans: 2196 case CSSPropertyOrphans:
2189 if (style->hasAutoOrphans()) 2197 if (style->hasAutoOrphans())
2190 return cssValuePool().createIdentifierValue(CSSValueAuto); 2198 return cssValuePool().createIdentifierValue(CSSValueAuto);
2191 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu e::CSS_NUMBER); 2199 return cssValuePool().createValue(style->orphans(), CSSPrimitiveValu e::CSS_NUMBER);
2192 case CSSPropertyOutlineColor: 2200 case CSSPropertyOutlineColor:
2193 return m_allowVisitedStyle ? cssValuePool().createColorValue(style-> visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor (style.get(), style->outlineColor()); 2201 return m_allowVisitedStyle ? cssValuePool().createColorValue(style-> visitedDependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor (style.get(), style->outlineColor());
2194 case CSSPropertyOutlineOffset: 2202 case CSSPropertyOutlineOffset:
2195 return zoomAdjustedPixelValue(style->outlineOffset(), style.get()); 2203 return zoomAdjustedPixelValue(style->outlineOffset(), style.get());
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3202 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3195 CSSPropertyB ackgroundClip }; 3203 CSSPropertyB ackgroundClip };
3196 3204
3197 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3205 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3198 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3206 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3199 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3207 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3200 return list.release(); 3208 return list.release();
3201 } 3209 }
3202 3210
3203 } // namespace WebCore 3211 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/css-properties-as-js-properties-expected.txt ('k') | Source/core/css/CSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698