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

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

Issue 1226123008: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase 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
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/FontFace.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } else { 231 } else {
232 if (image.imageSlices().left().hasPercent()) 232 if (image.imageSlices().left().hasPercent())
233 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_PERCENTAGE); 233 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_PERCENTAGE);
234 else 234 else
235 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_NUMBER); 235 left = cssValuePool().createValue(image.imageSlices().left() .value(), CSSPrimitiveValue::CSS_NUMBER);
236 } 236 }
237 } 237 }
238 } 238 }
239 239
240 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 240 RefPtrWillBeRawPtr<Quad> quad = Quad::create();
241 quad->setTop(toCSSPrimitiveValue(*top)); 241 quad->setTop(toCSSPrimitiveValue(top));
242 quad->setRight(toCSSPrimitiveValue(*right)); 242 quad->setRight(toCSSPrimitiveValue(right));
243 quad->setBottom(toCSSPrimitiveValue(*bottom)); 243 quad->setBottom(toCSSPrimitiveValue(bottom));
244 quad->setLeft(toCSSPrimitiveValue(*left)); 244 quad->setLeft(toCSSPrimitiveValue(left));
245 245
246 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill()); 246 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.rele ase()), image.fill());
247 } 247 }
248 248
249 static CSSPrimitiveValue valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style) 249 static CSSPrimitiveValue valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style)
250 { 250 {
251 // Create the slices. 251 // Create the slices.
252 NullableCSSValue top; 252 NullableCSSValue top;
253 NullableCSSValue right; 253 NullableCSSValue right;
254 NullableCSSValue bottom; 254 NullableCSSValue bottom;
(...skipping 28 matching lines...) Expand all
283 } else { 283 } else {
284 if (box.left().isNumber()) 284 if (box.left().isNumber())
285 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::CSS_NUMBER); 285 left = cssValuePool().createValue(box.left().number(), CSSPr imitiveValue::CSS_NUMBER);
286 else 286 else
287 left = cssValuePool().createValue(box.left().length(), style ); 287 left = cssValuePool().createValue(box.left().length(), style );
288 } 288 }
289 } 289 }
290 } 290 }
291 291
292 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); 292 RefPtrWillBeRawPtr<Quad> quad = Quad::create();
293 quad->setTop(toCSSPrimitiveValue(*top)); 293 quad->setTop(toCSSPrimitiveValue(top));
294 quad->setRight(toCSSPrimitiveValue(*right)); 294 quad->setRight(toCSSPrimitiveValue(right));
295 quad->setBottom(toCSSPrimitiveValue(*bottom)); 295 quad->setBottom(toCSSPrimitiveValue(bottom));
296 quad->setLeft(toCSSPrimitiveValue(*left)); 296 quad->setLeft(toCSSPrimitiveValue(left));
297 297
298 return cssValuePool().createValue(quad.release()); 298 return cssValuePool().createValue(quad.release());
299 } 299 }
300 300
301 static CSSValueID valueForRepeatRule(int rule) 301 static CSSValueID valueForRepeatRule(int rule)
302 { 302 {
303 switch (rule) { 303 switch (rule) {
304 case RepeatImageRule: 304 case RepeatImageRule:
305 return CSSValueRepeat; 305 return CSSValueRepeat;
306 case RoundImageRule: 306 case RoundImageRule:
307 return CSSValueRound; 307 return CSSValueRound;
308 case SpaceImageRule: 308 case SpaceImageRule:
309 return CSSValueSpace; 309 return CSSValueSpace;
310 default: 310 default:
311 return CSSValueStretch; 311 return CSSValueStretch;
312 } 312 }
313 } 313 }
314 314
315 static CSSValue valueForNinePieceImageRepeat(const NinePieceImage& image) 315 static CSSValue valueForNinePieceImageRepeat(const NinePieceImage& image)
316 { 316 {
317 NullableCSSValue horizontalRepeat; 317 NullableCSSValue horizontalRepeat;
318 NullableCSSValue verticalRepeat; 318 NullableCSSValue verticalRepeat;
319 319
320 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule())); 320 horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(i mage.horizontalRule()));
321 if (image.horizontalRule() == image.verticalRule()) 321 if (image.horizontalRule() == image.verticalRule())
322 verticalRepeat = horizontalRepeat; 322 verticalRepeat = horizontalRepeat;
323 else 323 else
324 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule())); 324 verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule (image.verticalRule()));
325 return cssValuePool().createValue(Pair::create(toCSSPrimitiveValue(*horizont alRepeat), toCSSPrimitiveValue(*verticalRepeat), Pair::DropIdenticalValues)); 325 return cssValuePool().createValue(Pair::create(toCSSPrimitiveValue(horizonta lRepeat), toCSSPrimitiveValue(verticalRepeat), Pair::DropIdenticalValues));
326 } 326 }
327 327
328 static CSSValue valueForNinePieceImage(const NinePieceImage& image, const Comput edStyle& style) 328 static CSSValue valueForNinePieceImage(const NinePieceImage& image, const Comput edStyle& style)
329 { 329 {
330 if (!image.hasImage()) 330 if (!image.hasImage())
331 return cssValuePool().createIdentifierValue(CSSValueNone); 331 return cssValuePool().createIdentifierValue(CSSValueNone);
332 332
333 // Image first. 333 // Image first.
334 NullableCSSValue imageValue; 334 NullableCSSValue imageValue;
335 if (image.image()) 335 if (image.image())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 direction = cssValuePool().createIdentifierValue(CSSValueAbove); 371 direction = cssValuePool().createIdentifierValue(CSSValueAbove);
372 break; 372 break;
373 case ReflectionLeft: 373 case ReflectionLeft:
374 direction = cssValuePool().createIdentifierValue(CSSValueLeft); 374 direction = cssValuePool().createIdentifierValue(CSSValueLeft);
375 break; 375 break;
376 case ReflectionRight: 376 case ReflectionRight:
377 direction = cssValuePool().createIdentifierValue(CSSValueRight); 377 direction = cssValuePool().createIdentifierValue(CSSValueRight);
378 break; 378 break;
379 } 379 }
380 380
381 return CSSReflectValue::create(toCSSPrimitiveValue(*direction), toCSSPrimiti veValue(*offset), valueForNinePieceImage(reflection->mask(), style)); 381 return CSSReflectValue::create(toCSSPrimitiveValue(direction), toCSSPrimitiv eValue(offset), valueForNinePieceImage(reflection->mask(), style));
382 } 382 }
383 383
384 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) 384 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
385 { 385 {
386 if (position != ItemPositionAuto) 386 if (position != ItemPositionAuto)
387 return position; 387 return position;
388 388
389 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart; 389 return isFlexOrGrid(element) ? ItemPositionStretch : ItemPositionStart;
390 } 390 }
391 391
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 case CSSPropertyAll: 2701 case CSSPropertyAll:
2702 return nullptr; 2702 return nullptr;
2703 default: 2703 default:
2704 break; 2704 break;
2705 } 2705 }
2706 ASSERT_NOT_REACHED(); 2706 ASSERT_NOT_REACHED();
2707 return nullptr; 2707 return nullptr;
2708 } 2708 }
2709 2709
2710 } 2710 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSValuePool.cpp ('k') | Source/core/css/FontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698