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

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

Issue 1304993002: Change Rect and Quad to be CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_counter_out_attempt_3
Patch Set: Removed empty destructor Created 5 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 18 matching lines...) Expand all
29 #include "core/css/BasicShapeFunctions.h" 29 #include "core/css/BasicShapeFunctions.h"
30 #include "core/css/CSSBorderImage.h" 30 #include "core/css/CSSBorderImage.h"
31 #include "core/css/CSSBorderImageSliceValue.h" 31 #include "core/css/CSSBorderImageSliceValue.h"
32 #include "core/css/CSSCounterValue.h" 32 #include "core/css/CSSCounterValue.h"
33 #include "core/css/CSSFontFeatureValue.h" 33 #include "core/css/CSSFontFeatureValue.h"
34 #include "core/css/CSSFunctionValue.h" 34 #include "core/css/CSSFunctionValue.h"
35 #include "core/css/CSSGridLineNamesValue.h" 35 #include "core/css/CSSGridLineNamesValue.h"
36 #include "core/css/CSSGridTemplateAreasValue.h" 36 #include "core/css/CSSGridTemplateAreasValue.h"
37 #include "core/css/CSSPathValue.h" 37 #include "core/css/CSSPathValue.h"
38 #include "core/css/CSSPrimitiveValueMappings.h" 38 #include "core/css/CSSPrimitiveValueMappings.h"
39 #include "core/css/CSSQuadValue.h"
39 #include "core/css/CSSReflectValue.h" 40 #include "core/css/CSSReflectValue.h"
40 #include "core/css/CSSShadowValue.h" 41 #include "core/css/CSSShadowValue.h"
41 #include "core/css/CSSTimingFunctionValue.h" 42 #include "core/css/CSSTimingFunctionValue.h"
42 #include "core/css/CSSValueList.h" 43 #include "core/css/CSSValueList.h"
43 #include "core/css/CSSValuePool.h" 44 #include "core/css/CSSValuePool.h"
44 #include "core/css/Pair.h" 45 #include "core/css/Pair.h"
45 #include "core/css/Rect.h"
46 #include "core/layout/LayoutBlock.h" 46 #include "core/layout/LayoutBlock.h"
47 #include "core/layout/LayoutBox.h" 47 #include "core/layout/LayoutBox.h"
48 #include "core/layout/LayoutGrid.h" 48 #include "core/layout/LayoutGrid.h"
49 #include "core/layout/LayoutObject.h" 49 #include "core/layout/LayoutObject.h"
50 #include "core/style/ComputedStyle.h" 50 #include "core/style/ComputedStyle.h"
51 #include "core/style/ContentData.h" 51 #include "core/style/ContentData.h"
52 #include "core/style/PathStyleMotionPath.h" 52 #include "core/style/PathStyleMotionPath.h"
53 #include "core/style/QuotesData.h" 53 #include "core/style/QuotesData.h"
54 #include "core/style/ShadowList.h" 54 #include "core/style/ShadowList.h"
55 #include "platform/LengthFunctions.h" 55 #include "platform/LengthFunctions.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 left = right; 231 left = right;
232 } else { 232 } else {
233 if (image.imageSlices().left().hasPercent()) 233 if (image.imageSlices().left().hasPercent())
234 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Percentage); 234 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Percentage);
235 else 235 else
236 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Number); 236 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::UnitType::Number);
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 241 return CSSBorderImageSliceValue::create(CSSQuadValue::createQuad(top, right, bottom, left), image.fill());
242 quad->setTop(top);
243 quad->setRight(right);
244 quad->setBottom(bottom);
245 quad->setLeft(left);
246
247 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill());
248 } 242 }
249 243
250 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons t BorderImageLengthBox& box, const ComputedStyle& style) 244 static PassRefPtrWillBeRawPtr<CSSQuadValue> valueForNinePieceImageQuad(const Bor derImageLengthBox& box, const ComputedStyle& style)
251 { 245 {
252 // Create the slices. 246 // Create the slices.
253 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; 247 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr;
254 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; 248 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
255 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; 249 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
256 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; 250 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
257 251
258 if (box.top().isNumber()) 252 if (box.top().isNumber())
259 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue:: UnitType::Number); 253 top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue:: UnitType::Number);
260 else 254 else
(...skipping 22 matching lines...) Expand all
283 left = right; 277 left = right;
284 } else { 278 } else {
285 if (box.left().isNumber()) 279 if (box.left().isNumber())
286 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::UnitType::Number); 280 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::UnitType::Number);
287 else 281 else
288 left = cssValuePool().createValue(box.left().length(), style ); 282 left = cssValuePool().createValue(box.left().length(), style );
289 } 283 }
290 } 284 }
291 } 285 }
292 286
293 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 287 return CSSQuadValue::createQuad(top, right, bottom, left);
294 quad->setTop(top);
295 quad->setRight(right);
296 quad->setBottom(bottom);
297 quad->setLeft(left);
298
299 return cssValuePool().createValue(quad.release());
300 } 288 }
301 289
302 static CSSValueID valueForRepeatRule(int rule) 290 static CSSValueID valueForRepeatRule(int rule)
303 { 291 {
304 switch (rule) { 292 switch (rule) {
305 case RepeatImageRule: 293 case RepeatImageRule:
306 return CSSValueRepeat; 294 return CSSValueRepeat;
307 case RoundImageRule: 295 case RoundImageRule:
308 return CSSValueRound; 296 return CSSValueRound;
309 case SpaceImageRule: 297 case SpaceImageRule:
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style) ; 2237 return valueForBorderRadiusCorner(style.borderBottomLeftRadius(), style) ;
2250 case CSSPropertyBorderBottomRightRadius: 2238 case CSSPropertyBorderBottomRightRadius:
2251 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style ); 2239 return valueForBorderRadiusCorner(style.borderBottomRightRadius(), style );
2252 case CSSPropertyBorderTopLeftRadius: 2240 case CSSPropertyBorderTopLeftRadius:
2253 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style); 2241 return valueForBorderRadiusCorner(style.borderTopLeftRadius(), style);
2254 case CSSPropertyBorderTopRightRadius: 2242 case CSSPropertyBorderTopRightRadius:
2255 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style); 2243 return valueForBorderRadiusCorner(style.borderTopRightRadius(), style);
2256 case CSSPropertyClip: { 2244 case CSSPropertyClip: {
2257 if (style.hasAutoClip()) 2245 if (style.hasAutoClip())
2258 return cssValuePool().createIdentifierValue(CSSValueAuto); 2246 return cssValuePool().createIdentifierValue(CSSValueAuto);
2259 RefPtrWillBeRawPtr<Rect> rect = Rect::create(); 2247 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = zoomAdjustedPixelValue(style .clip().top().value(), style);
2260 rect->setTop(zoomAdjustedPixelValue(style.clip().top().value(), style)); 2248 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = zoomAdjustedPixelValue(sty le.clip().right().value(), style);
2261 rect->setRight(zoomAdjustedPixelValue(style.clip().right().value(), styl e)); 2249 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = zoomAdjustedPixelValue(st yle.clip().bottom().value(), style);
2262 rect->setBottom(zoomAdjustedPixelValue(style.clip().bottom().value(), st yle)); 2250 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = zoomAdjustedPixelValue(styl e.clip().left().value(), style);
2263 rect->setLeft(zoomAdjustedPixelValue(style.clip().left().value(), style) ); 2251 return CSSQuadValue::createRect(top, right, bottom, left);
2264 return cssValuePool().createValue(rect.release());
2265 } 2252 }
2266 case CSSPropertySpeak: 2253 case CSSPropertySpeak:
2267 return cssValuePool().createValue(style.speak()); 2254 return cssValuePool().createValue(style.speak());
2268 case CSSPropertyTransform: 2255 case CSSPropertyTransform:
2269 return computedTransform(layoutObject, style); 2256 return computedTransform(layoutObject, style);
2270 case CSSPropertyTransformOrigin: { 2257 case CSSPropertyTransformOrigin: {
2271 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); 2258 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed();
2272 if (layoutObject) { 2259 if (layoutObject) {
2273 LayoutRect box; 2260 LayoutRect box;
2274 if (layoutObject->isBox()) 2261 if (layoutObject->isBox())
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 case CSSPropertyAll: 2676 case CSSPropertyAll:
2690 return nullptr; 2677 return nullptr;
2691 default: 2678 default:
2692 break; 2679 break;
2693 } 2680 }
2694 ASSERT_NOT_REACHED(); 2681 ASSERT_NOT_REACHED();
2695 return nullptr; 2682 return nullptr;
2696 } 2683 }
2697 2684
2698 } 2685 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698