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

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

Issue 2814453002: Add CSS conic-gradient calc() support (Closed)
Patch Set: Created 3 years, 8 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } else if (stop.offset_->IsLength() || 590 } else if (stop.offset_->IsLength() ||
591 stop.offset_->IsCalculatedPercentageWithLength()) { 591 stop.offset_->IsCalculatedPercentageWithLength()) {
592 float length; 592 float length;
593 if (stop.offset_->IsLength()) 593 if (stop.offset_->IsLength())
594 length = stop.offset_->ComputeLength<float>(conversion_data); 594 length = stop.offset_->ComputeLength<float>(conversion_data);
595 else 595 else
596 length = stop.offset_->CssCalcValue() 596 length = stop.offset_->CssCalcValue()
597 ->ToCalcValue(conversion_data) 597 ->ToCalcValue(conversion_data)
598 ->Evaluate(gradient_length); 598 ->Evaluate(gradient_length);
599 stops[i].offset = (gradient_length > 0) ? length / gradient_length : 0; 599 stops[i].offset = (gradient_length > 0) ? length / gradient_length : 0;
600 } else if (stop.offset_->IsAngle()) { 600 } else if (CSSPrimitiveValue::IsAngle(
601 stop.offset_->TypeWithCalcResolved())) {
601 stops[i].offset = stop.offset_->ComputeDegrees() / 360.0f; 602 stops[i].offset = stop.offset_->ComputeDegrees() / 360.0f;
602 } else { 603 } else {
603 NOTREACHED(); 604 NOTREACHED();
604 stops[i].offset = 0; 605 stops[i].offset = 0;
605 } 606 }
606 stops[i].specified = true; 607 stops[i].specified = true;
607 } else { 608 } else {
608 // If the first color-stop does not have a position, its position defaults 609 // If the first color-stop does not have a position, its position defaults
609 // to 0%. If the last color-stop does not have a position, its position 610 // to 0%. If the last color-stop does not have a position, its position
610 // defaults to 100%. 611 // defaults to 100%.
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 DataEquivalent(from_angle_, other.from_angle_) && 1524 DataEquivalent(from_angle_, other.from_angle_) &&
1524 stops_ == other.stops_; 1525 stops_ == other.stops_;
1525 } 1526 }
1526 1527
1527 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) { 1528 DEFINE_TRACE_AFTER_DISPATCH(CSSConicGradientValue) {
1528 visitor->Trace(from_angle_); 1529 visitor->Trace(from_angle_);
1529 CSSGradientValue::TraceAfterDispatch(visitor); 1530 CSSGradientValue::TraceAfterDispatch(visitor);
1530 } 1531 }
1531 1532
1532 } // namespace blink 1533 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698