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

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

Issue 1318543010: Change first() and second() in CSSPairValue to return const references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSBasicShapes.cpp ('k') | Source/core/css/CSSValuePair.h » ('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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2015 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal) 483 static float positionFromValue(CSSValue* value, const CSSToLengthConversionData& conversionData, const IntSize& size, bool isHorizontal)
484 { 484 {
485 int origin = 0; 485 int origin = 0;
486 int sign = 1; 486 int sign = 1;
487 int edgeDistance = isHorizontal ? size.width() : size.height(); 487 int edgeDistance = isHorizontal ? size.width() : size.height();
488 488
489 // In this case the center of the gradient is given relative to an edge in t he form of: 489 // In this case the center of the gradient is given relative to an edge in t he form of:
490 // [ top | bottom | right | left ] [ <percentage> | <length> ]. 490 // [ top | bottom | right | left ] [ <percentage> | <length> ].
491 if (value->isValuePair()) { 491 if (value->isValuePair()) {
492 CSSValuePair* pair = toCSSValuePair(value); 492 CSSValuePair& pair = toCSSValuePair(*value);
493 CSSValueID originID = toCSSPrimitiveValue(pair->first())->getValueID(); 493 CSSValueID originID = toCSSPrimitiveValue(pair.first()).getValueID();
494 value = pair->second(); 494 value = &pair.second();
495 495
496 if (originID == CSSValueRight || originID == CSSValueBottom) { 496 if (originID == CSSValueRight || originID == CSSValueBottom) {
497 // For right/bottom, the offset is relative to the far edge. 497 // For right/bottom, the offset is relative to the far edge.
498 origin = edgeDistance; 498 origin = edgeDistance;
499 sign = -1; 499 sign = -1;
500 } 500 }
501 } 501 }
502 502
503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 503 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
504 504
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 visitor->trace(m_firstRadius); 1207 visitor->trace(m_firstRadius);
1208 visitor->trace(m_secondRadius); 1208 visitor->trace(m_secondRadius);
1209 visitor->trace(m_shape); 1209 visitor->trace(m_shape);
1210 visitor->trace(m_sizingBehavior); 1210 visitor->trace(m_sizingBehavior);
1211 visitor->trace(m_endHorizontalSize); 1211 visitor->trace(m_endHorizontalSize);
1212 visitor->trace(m_endVerticalSize); 1212 visitor->trace(m_endVerticalSize);
1213 CSSGradientValue::traceAfterDispatch(visitor); 1213 CSSGradientValue::traceAfterDispatch(visitor);
1214 } 1214 }
1215 1215
1216 } // namespace blink 1216 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/CSSBasicShapes.cpp ('k') | Source/core/css/CSSValuePair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698