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

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

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 years, 2 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) 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 newStops[y].color = blend(leftColor, rightColor, weighting); 185 newStops[y].color = blend(leftColor, rightColor, weighting);
186 } 186 }
187 187
188 // Replace the color hint with the new color stops. 188 // Replace the color hint with the new color stops.
189 stops.remove(x); 189 stops.remove(x);
190 stops.insert(x, newStops, 9); 190 stops.insert(x, newStops, 9);
191 indexOffset += 8; 191 indexOffset += 8;
192 } 192 }
193 } 193 }
194 194
195 static Color resolveStopColor(const CSSPrimitiveValue& stopColor, const LayoutOb ject& object) 195 static Color resolveStopColor(const CSSValue& stopColor, const LayoutObject& obj ect)
196 { 196 {
197 return object.document().textLinkColors().colorFromPrimitiveValue(stopColor, object.resolveColor(CSSPropertyColor)); 197 return object.document().textLinkColors().colorFromCSSValue(stopColor, objec t.resolveColor(CSSPropertyColor));
198 } 198 }
199 199
200 void CSSGradientValue::addDeprecatedStops(Gradient* gradient, const LayoutObject & object) 200 void CSSGradientValue::addDeprecatedStops(Gradient* gradient, const LayoutObject & object)
201 { 201 {
202 ASSERT(m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CS SDeprecatedRadialGradient); 202 ASSERT(m_gradientType == CSSDeprecatedLinearGradient || m_gradientType == CS SDeprecatedRadialGradient);
203 203
204 if (!m_stopsSorted) { 204 if (!m_stopsSorted) {
205 if (m_stops.size()) 205 if (m_stops.size())
206 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); 206 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops);
207 m_stopsSorted = true; 207 m_stopsSorted = true;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 result.setY(positionFromValue(vertical, conversionData, size, false)); 542 result.setY(positionFromValue(vertical, conversionData, size, false));
543 543
544 return result; 544 return result;
545 } 545 }
546 546
547 bool CSSGradientValue::isCacheable() const 547 bool CSSGradientValue::isCacheable() const
548 { 548 {
549 for (size_t i = 0; i < m_stops.size(); ++i) { 549 for (size_t i = 0; i < m_stops.size(); ++i) {
550 const CSSGradientColorStop& stop = m_stops[i]; 550 const CSSGradientColorStop& stop = m_stops[i];
551 551
552 if (!stop.isHint() && stop.m_color->colorIsDerivedFromElement()) 552 if (!stop.isHint() && stop.m_color->isPrimitiveValue() && toCSSPrimitive Value(*stop.m_color).colorIsDerivedFromElement())
553 return false; 553 return false;
554 554
555 if (!stop.m_position) 555 if (!stop.m_position)
556 continue; 556 continue;
557 557
558 if (stop.m_position->isFontRelativeLength()) 558 if (stop.m_position->isFontRelativeLength())
559 return false; 559 return false;
560 } 560 }
561 561
562 return true; 562 return true;
(...skipping 644 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 | « third_party/WebKit/Source/core/css/CSSGradientValue.h ('k') | third_party/WebKit/Source/core/css/CSSPrimitiveValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698