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

Side by Side Diff: sky/engine/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 667003003: Remove most of visited link support. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 { 244 {
245 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property)); 245 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property));
246 if (value->isUnknown()) { 246 if (value->isUnknown()) {
247 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)- >toCSSValue().get()); 247 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)- >toCSSValue().get());
248 return; 248 return;
249 } 249 }
250 RenderStyle* style = state.style(); 250 RenderStyle* style = state.style();
251 switch (property) { 251 switch (property) {
252 case CSSPropertyBackgroundColor: 252 case CSSPropertyBackgroundColor:
253 style->setBackgroundColor(toAnimatableColor(value)->color()); 253 style->setBackgroundColor(toAnimatableColor(value)->color());
254 style->setVisitedLinkBackgroundColor(toAnimatableColor(value)->visitedLi nkColor());
255 return; 254 return;
256 case CSSPropertyBackgroundImage: 255 case CSSPropertyBackgroundImage:
257 setOnFillLayers<CSSPropertyBackgroundImage>(style->accessBackgroundLayer s(), value, state); 256 setOnFillLayers<CSSPropertyBackgroundImage>(style->accessBackgroundLayer s(), value, state);
258 return; 257 return;
259 case CSSPropertyBackgroundPositionX: 258 case CSSPropertyBackgroundPositionX:
260 setOnFillLayers<CSSPropertyBackgroundPositionX>(style->accessBackgroundL ayers(), value, state); 259 setOnFillLayers<CSSPropertyBackgroundPositionX>(style->accessBackgroundL ayers(), value, state);
261 return; 260 return;
262 case CSSPropertyBackgroundPositionY: 261 case CSSPropertyBackgroundPositionY:
263 setOnFillLayers<CSSPropertyBackgroundPositionY>(style->accessBackgroundL ayers(), value, state); 262 setOnFillLayers<CSSPropertyBackgroundPositionY>(style->accessBackgroundL ayers(), value, state);
264 return; 263 return;
265 case CSSPropertyBackgroundSize: 264 case CSSPropertyBackgroundSize:
266 setOnFillLayers<CSSPropertyBackgroundSize>(style->accessBackgroundLayers (), value, state); 265 setOnFillLayers<CSSPropertyBackgroundSize>(style->accessBackgroundLayers (), value, state);
267 return; 266 return;
268 case CSSPropertyBorderBottomColor: 267 case CSSPropertyBorderBottomColor:
269 style->setBorderBottomColor(toAnimatableColor(value)->color()); 268 style->setBorderBottomColor(toAnimatableColor(value)->color());
270 style->setVisitedLinkBorderBottomColor(toAnimatableColor(value)->visited LinkColor());
271 return; 269 return;
272 case CSSPropertyBorderBottomLeftRadius: 270 case CSSPropertyBorderBottomLeftRadius:
273 style->setBorderBottomLeftRadius(animatableValueToLengthSize(value, stat e, ValueRangeNonNegative)); 271 style->setBorderBottomLeftRadius(animatableValueToLengthSize(value, stat e, ValueRangeNonNegative));
274 return; 272 return;
275 case CSSPropertyBorderBottomRightRadius: 273 case CSSPropertyBorderBottomRightRadius:
276 style->setBorderBottomRightRadius(animatableValueToLengthSize(value, sta te, ValueRangeNonNegative)); 274 style->setBorderBottomRightRadius(animatableValueToLengthSize(value, sta te, ValueRangeNonNegative));
277 return; 275 return;
278 case CSSPropertyBorderBottomWidth: 276 case CSSPropertyBorderBottomWidth:
279 style->setBorderBottomWidth(animatableValueRoundClampTo<unsigned>(value) ); 277 style->setBorderBottomWidth(animatableValueRoundClampTo<unsigned>(value) );
280 return; 278 return;
281 case CSSPropertyBorderImageOutset: 279 case CSSPropertyBorderImageOutset:
282 style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state)); 280 style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state));
283 return; 281 return;
284 case CSSPropertyBorderImageSlice: 282 case CSSPropertyBorderImageSlice:
285 style->setBorderImageSlices(animatableValueToLengthBox(value, state, Val ueRangeNonNegative)); 283 style->setBorderImageSlices(animatableValueToLengthBox(value, state, Val ueRangeNonNegative));
286 return; 284 return;
287 case CSSPropertyBorderImageSource: 285 case CSSPropertyBorderImageSource:
288 style->setBorderImageSource(state.styleImage(property, toAnimatableImage (value)->toCSSValue())); 286 style->setBorderImageSource(state.styleImage(property, toAnimatableImage (value)->toCSSValue()));
289 return; 287 return;
290 case CSSPropertyBorderImageWidth: 288 case CSSPropertyBorderImageWidth:
291 style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state)); 289 style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state));
292 return; 290 return;
293 case CSSPropertyBorderLeftColor: 291 case CSSPropertyBorderLeftColor:
294 style->setBorderLeftColor(toAnimatableColor(value)->color()); 292 style->setBorderLeftColor(toAnimatableColor(value)->color());
295 style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLi nkColor());
296 return; 293 return;
297 case CSSPropertyBorderLeftWidth: 294 case CSSPropertyBorderLeftWidth:
298 style->setBorderLeftWidth(animatableValueRoundClampTo<unsigned>(value)); 295 style->setBorderLeftWidth(animatableValueRoundClampTo<unsigned>(value));
299 return; 296 return;
300 case CSSPropertyBorderRightColor: 297 case CSSPropertyBorderRightColor:
301 style->setBorderRightColor(toAnimatableColor(value)->color()); 298 style->setBorderRightColor(toAnimatableColor(value)->color());
302 style->setVisitedLinkBorderRightColor(toAnimatableColor(value)->visitedL inkColor());
303 return; 299 return;
304 case CSSPropertyBorderRightWidth: 300 case CSSPropertyBorderRightWidth:
305 style->setBorderRightWidth(animatableValueRoundClampTo<unsigned>(value)) ; 301 style->setBorderRightWidth(animatableValueRoundClampTo<unsigned>(value)) ;
306 return; 302 return;
307 case CSSPropertyBorderTopColor: 303 case CSSPropertyBorderTopColor:
308 style->setBorderTopColor(toAnimatableColor(value)->color()); 304 style->setBorderTopColor(toAnimatableColor(value)->color());
309 style->setVisitedLinkBorderTopColor(toAnimatableColor(value)->visitedLin kColor());
310 return; 305 return;
311 case CSSPropertyBorderTopLeftRadius: 306 case CSSPropertyBorderTopLeftRadius:
312 style->setBorderTopLeftRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative)); 307 style->setBorderTopLeftRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
313 return; 308 return;
314 case CSSPropertyBorderTopRightRadius: 309 case CSSPropertyBorderTopRightRadius:
315 style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative)); 310 style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
316 return; 311 return;
317 case CSSPropertyBorderTopWidth: 312 case CSSPropertyBorderTopWidth:
318 style->setBorderTopWidth(animatableValueRoundClampTo<unsigned>(value)); 313 style->setBorderTopWidth(animatableValueRoundClampTo<unsigned>(value));
319 return; 314 return;
320 case CSSPropertyBottom: 315 case CSSPropertyBottom:
321 style->setBottom(animatableValueToLength(value, state)); 316 style->setBottom(animatableValueToLength(value, state));
322 return; 317 return;
323 case CSSPropertyBoxShadow: 318 case CSSPropertyBoxShadow:
324 case CSSPropertyWebkitBoxShadow: 319 case CSSPropertyWebkitBoxShadow:
325 style->setBoxShadow(toAnimatableShadow(value)->shadowList()); 320 style->setBoxShadow(toAnimatableShadow(value)->shadowList());
326 return; 321 return;
327 case CSSPropertyClip: 322 case CSSPropertyClip:
328 style->setClip(animatableValueToLengthBox(value, state)); 323 style->setClip(animatableValueToLengthBox(value, state));
329 return; 324 return;
330 case CSSPropertyColor: 325 case CSSPropertyColor:
331 style->setColor(toAnimatableColor(value)->color()); 326 style->setColor(toAnimatableColor(value)->color());
332 style->setVisitedLinkColor(toAnimatableColor(value)->visitedLinkColor()) ;
333 return; 327 return;
334 case CSSPropertyFlexGrow: 328 case CSSPropertyFlexGrow:
335 style->setFlexGrow(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0)); 329 style->setFlexGrow(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
336 return; 330 return;
337 case CSSPropertyFlexShrink: 331 case CSSPropertyFlexShrink:
338 style->setFlexShrink(clampTo<float>(toAnimatableDouble(value)->toDouble( ), 0)); 332 style->setFlexShrink(clampTo<float>(toAnimatableDouble(value)->toDouble( ), 0));
339 return; 333 return;
340 case CSSPropertyFlexBasis: 334 case CSSPropertyFlexBasis:
341 style->setFlexBasis(animatableValueToLength(value, state, ValueRangeNonN egative)); 335 style->setFlexBasis(animatableValueToLength(value, state, ValueRangeNonN egative));
342 return; 336 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return; 390 return;
397 case CSSPropertyOpacity: 391 case CSSPropertyOpacity:
398 // Avoiding a value of 1 forces a layer to be created. 392 // Avoiding a value of 1 forces a layer to be created.
399 style->setOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, nextafterf(1, 0))); 393 style->setOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, nextafterf(1, 0)));
400 return; 394 return;
401 case CSSPropertyOrphans: 395 case CSSPropertyOrphans:
402 style->setOrphans(animatableValueRoundClampTo<unsigned short>(value, 1)) ; 396 style->setOrphans(animatableValueRoundClampTo<unsigned short>(value, 1)) ;
403 return; 397 return;
404 case CSSPropertyOutlineColor: 398 case CSSPropertyOutlineColor:
405 style->setOutlineColor(toAnimatableColor(value)->color()); 399 style->setOutlineColor(toAnimatableColor(value)->color());
406 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkC olor());
407 return; 400 return;
408 case CSSPropertyOutlineOffset: 401 case CSSPropertyOutlineOffset:
409 style->setOutlineOffset(animatableValueRoundClampTo<int>(value)); 402 style->setOutlineOffset(animatableValueRoundClampTo<int>(value));
410 return; 403 return;
411 case CSSPropertyOutlineWidth: 404 case CSSPropertyOutlineWidth:
412 style->setOutlineWidth(animatableValueRoundClampTo<unsigned short>(value )); 405 style->setOutlineWidth(animatableValueRoundClampTo<unsigned short>(value ));
413 return; 406 return;
414 case CSSPropertyPaddingBottom: 407 case CSSPropertyPaddingBottom:
415 style->setPaddingBottom(animatableValueToLength(value, state, ValueRange NonNegative)); 408 style->setPaddingBottom(animatableValueToLength(value, state, ValueRange NonNegative));
416 return; 409 return;
417 case CSSPropertyPaddingLeft: 410 case CSSPropertyPaddingLeft:
418 style->setPaddingLeft(animatableValueToLength(value, state, ValueRangeNo nNegative)); 411 style->setPaddingLeft(animatableValueToLength(value, state, ValueRangeNo nNegative));
419 return; 412 return;
420 case CSSPropertyPaddingRight: 413 case CSSPropertyPaddingRight:
421 style->setPaddingRight(animatableValueToLength(value, state, ValueRangeN onNegative)); 414 style->setPaddingRight(animatableValueToLength(value, state, ValueRangeN onNegative));
422 return; 415 return;
423 case CSSPropertyPaddingTop: 416 case CSSPropertyPaddingTop:
424 style->setPaddingTop(animatableValueToLength(value, state, ValueRangeNon Negative)); 417 style->setPaddingTop(animatableValueToLength(value, state, ValueRangeNon Negative));
425 return; 418 return;
426 case CSSPropertyRight: 419 case CSSPropertyRight:
427 style->setRight(animatableValueToLength(value, state)); 420 style->setRight(animatableValueToLength(value, state));
428 return; 421 return;
429 case CSSPropertyTextDecorationColor: 422 case CSSPropertyTextDecorationColor:
430 style->setTextDecorationColor(toAnimatableColor(value)->color()); 423 style->setTextDecorationColor(toAnimatableColor(value)->color());
431 style->setVisitedLinkTextDecorationColor(toAnimatableColor(value)->visit edLinkColor());
432 return; 424 return;
433 case CSSPropertyTextIndent: 425 case CSSPropertyTextIndent:
434 style->setTextIndent(animatableValueToLength(value, state)); 426 style->setTextIndent(animatableValueToLength(value, state));
435 return; 427 return;
436 case CSSPropertyTextShadow: 428 case CSSPropertyTextShadow:
437 style->setTextShadow(toAnimatableShadow(value)->shadowList()); 429 style->setTextShadow(toAnimatableShadow(value)->shadowList());
438 return; 430 return;
439 case CSSPropertyTop: 431 case CSSPropertyTop:
440 style->setTop(animatableValueToLength(value, state)); 432 style->setTop(animatableValueToLength(value, state));
441 return; 433 return;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 style->setShapeOutside(toAnimatableShapeValue(value)->shapeValue()); 484 style->setShapeOutside(toAnimatableShapeValue(value)->shapeValue());
493 return; 485 return;
494 case CSSPropertyShapeMargin: 486 case CSSPropertyShapeMargin:
495 style->setShapeMargin(animatableValueToLength(value, state, ValueRangeNo nNegative)); 487 style->setShapeMargin(animatableValueToLength(value, state, ValueRangeNo nNegative));
496 return; 488 return;
497 case CSSPropertyShapeImageThreshold: 489 case CSSPropertyShapeImageThreshold:
498 style->setShapeImageThreshold(clampTo<float>(toAnimatableDouble(value)-> toDouble(), 0, 1)); 490 style->setShapeImageThreshold(clampTo<float>(toAnimatableDouble(value)-> toDouble(), 0, 1));
499 return; 491 return;
500 case CSSPropertyWebkitTextStrokeColor: 492 case CSSPropertyWebkitTextStrokeColor:
501 style->setTextStrokeColor(toAnimatableColor(value)->color()); 493 style->setTextStrokeColor(toAnimatableColor(value)->color());
502 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLi nkColor());
503 return; 494 return;
504 case CSSPropertyTransform: { 495 case CSSPropertyTransform: {
505 const TransformOperations& operations = toAnimatableTransform(value)->tr ansformOperations(); 496 const TransformOperations& operations = toAnimatableTransform(value)->tr ansformOperations();
506 // FIXME: This normalization (handling of 'none') should be performed at input in AnimatableValueFactory. 497 // FIXME: This normalization (handling of 'none') should be performed at input in AnimatableValueFactory.
507 style->setTransform(operations.size() ? operations : TransformOperations (true)); 498 style->setTransform(operations.size() ? operations : TransformOperations (true));
508 return; 499 return;
509 } 500 }
510 case CSSPropertyTransformOrigin: { 501 case CSSPropertyTransformOrigin: {
511 const AnimatableLengthPoint3D* animatableLengthPoint3D = toAnimatableLen gthPoint3D(value); 502 const AnimatableLengthPoint3D* animatableLengthPoint3D = toAnimatableLen gthPoint3D(value);
512 style->setTransformOriginX(animatableValueToLength(animatableLengthPoint 3D->x(), state)); 503 style->setTransformOriginX(animatableValueToLength(animatableLengthPoint 3D->x(), state));
(...skipping 18 matching lines...) Expand all
531 return; 522 return;
532 case CSSPropertyZoom: 523 case CSSPropertyZoom:
533 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min())); 524 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std ::numeric_limits<float>::denorm_min()));
534 return; 525 return;
535 default: 526 default:
536 ASSERT_NOT_REACHED(); 527 ASSERT_NOT_REACHED();
537 } 528 }
538 } 529 }
539 530
540 } // namespace blink 531 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSComputedStyleDeclaration.cpp ('k') | sky/engine/core/css/resolver/StyleBuilderConverter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698