Changeset 251437 in webkit for trunk/Source/WebCore/css/CSSGradientValue.cpp
- Timestamp:
- Oct 22, 2019, 10:03:34 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSGradientValue.cpp
r249013 r251437 680 680 } 681 681 682 void CSSGradientValue::writeColorStop(StringBuilder& builder, const CSSGradientColorStop& stop) const 683 { 684 if (!stop.isMidpoint && stop.m_color) 685 builder.append(stop.m_color->cssText()); 686 687 if (stop.m_position) { 688 if (!stop.isMidpoint) 689 builder.append(' '); 690 builder.append(stop.m_position->cssText()); 691 } 692 } 693 682 694 String CSSLinearGradientValue::customCSSText() const 683 695 { … … 704 716 705 717 for (auto& stop : m_stops) { 706 result.append(", ", stop.m_color->cssText()); 707 if (stop.m_position) 708 result.append(' ', stop.m_position->cssText()); 718 result.appendLiteral(", "); 719 writeColorStop(result, stop); 709 720 } 710 721 } else { … … 738 749 result.appendLiteral(", "); 739 750 wroteFirstStop = true; 740 if (!stop.isMidpoint) 741 result.append(stop.m_color->cssText()); 742 if (stop.m_position) { 743 if (!stop.isMidpoint) 744 result.append(' '); 745 result.append(stop.m_position->cssText()); 746 } 751 writeColorStop(result, stop); 747 752 } 748 753 } … … 955 960 956 961 for (auto& stop : m_stops) { 957 result.append(", ", stop.m_color->cssText()); 958 if (stop.m_position) 959 result.append(' ', stop.m_position->cssText()); 962 result.appendLiteral(", "); 963 writeColorStop(result, stop); 960 964 } 961 965 } else { … … 1004 1008 result.appendLiteral(", "); 1005 1009 1006 for (unsigned i = 0; i < m_stops.size(); i++) {1007 const CSSGradientColorStop& stop = m_stops[i];1008 if ( i)1010 bool wroteFirstStop = false; 1011 for (auto& stop : m_stops) { 1012 if (wroteFirstStop) 1009 1013 result.appendLiteral(", "); 1010 if (!stop.isMidpoint) 1011 result.append(stop.m_color->cssText()); 1012 if (stop.m_position) { 1013 if (!stop.isMidpoint) 1014 result.append(' '); 1015 result.append(stop.m_position->cssText()); 1016 } 1017 } 1018 1014 wroteFirstStop = true; 1015 writeColorStop(result, stop); 1016 } 1019 1017 } 1020 1018 … … 1333 1331 result.appendLiteral(", "); 1334 1332 wroteFirstStop = true; 1335 if (!stop.isMidpoint) 1336 result.append(stop.m_color->cssText()); 1337 if (stop.m_position) { 1338 if (!stop.isMidpoint) 1339 result.append(' '); 1340 result.append(stop.m_position->cssText()); 1341 } 1342 } 1343 1333 writeColorStop(result, stop); 1334 } 1335 1344 1336 result.append(')'); 1345 1337 return result.toString();
Note:
See TracChangeset
for help on using the changeset viewer.