Changeset 224165 in webkit for trunk/Source/WebCore/css/CSSGradientValue.cpp
- Timestamp:
- Oct 29, 2017, 4:07:45 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSGradientValue.cpp
r210215 r224165 96 96 if (is<CSSLinearGradientValue>(value)) 97 97 return downcast<CSSLinearGradientValue>(value).clone(); 98 ASSERT(is<CSSRadialGradientValue>(value)); 99 return downcast<CSSRadialGradientValue>(value).clone(); 98 if (is<CSSRadialGradientValue>(value)) 99 return downcast<CSSRadialGradientValue>(value).clone(); 100 ASSERT(is<CSSConicGradientValue>(value)); 101 return downcast<CSSConicGradientValue>(value).clone(); 100 102 } 101 103 … … 545 547 bool CSSGradientValue::isCacheable() const 546 548 { 547 for (size_t i = 0; i < m_stops.size(); ++i) { 548 const CSSGradientColorStop& stop = m_stops[i]; 549 549 for (auto& stop : m_stops) { 550 550 if (stop.m_colorIsDerivedFromElement) 551 551 return false; … … 1275 1275 } 1276 1276 1277 1278 String CSSConicGradientValue::customCSSText() const 1279 { 1280 StringBuilder result; 1281 1282 if (m_repeating) 1283 result.appendLiteral("repeating-conic-gradient("); 1284 else 1285 result.appendLiteral("conic-gradient("); 1286 1287 bool wroteSomething = false; 1288 1289 if (m_angle) { 1290 result.appendLiteral("from "); 1291 result.append(m_angle->cssText()); 1292 wroteSomething = true; 1293 } 1294 1295 if (m_firstX && m_firstY) { 1296 if (wroteSomething) 1297 result.appendLiteral(" "); 1298 result.appendLiteral("at "); 1299 result.append(m_firstX->cssText()); 1300 result.append(' '); 1301 result.append(m_firstY->cssText()); 1302 wroteSomething = true; 1303 } 1304 1305 if (wroteSomething) 1306 result.appendLiteral(", "); 1307 1308 bool wroteFirstStop = false; 1309 for (auto& stop : m_stops) { 1310 if (wroteFirstStop) 1311 result.appendLiteral(", "); 1312 wroteFirstStop = true; 1313 if (!stop.isMidpoint) 1314 result.append(stop.m_color->cssText()); 1315 if (stop.m_position) { 1316 if (!stop.isMidpoint) 1317 result.append(' '); 1318 result.append(stop.m_position->cssText()); 1319 } 1320 } 1321 1322 result.append(')'); 1323 return result.toString(); 1324 } 1325 1326 Ref<Gradient> CSSConicGradientValue::createGradient(RenderElement&, const FloatSize&) 1327 { 1328 // FIXME: Implement. 1329 return Gradient::create(FloatPoint { }, FloatPoint { }); 1330 } 1331 1332 bool CSSConicGradientValue::equals(const CSSConicGradientValue& other) const 1333 { 1334 if (m_repeating != other.m_repeating) 1335 return false; 1336 1337 if (!compareCSSValuePtr(m_angle, other.m_angle)) 1338 return false; 1339 1340 bool equalXandY = false; 1341 if (m_firstX && m_firstY) 1342 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && compareCSSValuePtr(m_firstY, other.m_firstY); 1343 else if (m_firstX) 1344 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_firstY; 1345 else if (m_firstY) 1346 equalXandY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_firstX; 1347 else 1348 equalXandY = !other.m_firstX && !other.m_firstY; 1349 1350 return equalXandY && m_stops == other.m_stops; 1351 } 1352 1277 1353 } // namespace WebCore
Note:
See TracChangeset
for help on using the changeset viewer.