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

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

Issue 26147006: Fix three bugs in the equals() implementations for css gradients. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/cssom/cssvalue-comparison-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 716
717 if (m_repeating != other.m_repeating) 717 if (m_repeating != other.m_repeating)
718 return false; 718 return false;
719 719
720 if (m_angle) 720 if (m_angle)
721 return compareCSSValuePtr(m_angle, other.m_angle) && m_stops == other.m_ stops; 721 return compareCSSValuePtr(m_angle, other.m_angle) && m_stops == other.m_ stops;
722 722
723 if (other.m_angle) 723 if (other.m_angle)
724 return false; 724 return false;
725 725
726 bool equalXorY = false; 726 bool equalXandY = false;
727 if (m_firstX && m_firstY) 727 if (m_firstX && m_firstY)
728 equalXorY = compareCSSValuePtr(m_firstX, other.m_firstX) && compareCSSVa luePtr(m_firstY, other.m_firstY); 728 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && compareCSSV aluePtr(m_firstY, other.m_firstY);
729 else if (m_firstX) 729 else if (m_firstX)
730 equalXorY =compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_firs tY; 730 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_fi rstY;
731 else if (m_firstY) 731 else if (m_firstY)
732 equalXorY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fir stX; 732 equalXandY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fi rstX;
733 else 733 else
734 equalXorY = !other.m_firstX || !other.m_firstY; 734 equalXandY = !other.m_firstX && !other.m_firstY;
735 735
736 return equalXorY && m_stops == other.m_stops; 736 return equalXandY && m_stops == other.m_stops;
737 } 737 }
738 738
739 String CSSRadialGradientValue::customCSSText() const 739 String CSSRadialGradientValue::customCSSText() const
740 { 740 {
741 StringBuilder result; 741 StringBuilder result;
742 742
743 if (m_gradientType == CSSDeprecatedRadialGradient) { 743 if (m_gradientType == CSSDeprecatedRadialGradient) {
744 result.appendLiteral("-webkit-gradient(radial, "); 744 result.appendLiteral("-webkit-gradient(radial, ");
745 result.append(m_firstX->cssText()); 745 result.append(m_firstX->cssText());
746 result.append(' '); 746 result.append(' ');
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 && compareCSSValuePtr(m_firstY, other.m_firstY) 1130 && compareCSSValuePtr(m_firstY, other.m_firstY)
1131 && compareCSSValuePtr(m_secondX, other.m_secondX) 1131 && compareCSSValuePtr(m_secondX, other.m_secondX)
1132 && compareCSSValuePtr(m_secondY, other.m_secondY) 1132 && compareCSSValuePtr(m_secondY, other.m_secondY)
1133 && compareCSSValuePtr(m_firstRadius, other.m_firstRadius) 1133 && compareCSSValuePtr(m_firstRadius, other.m_firstRadius)
1134 && compareCSSValuePtr(m_secondRadius, other.m_secondRadius) 1134 && compareCSSValuePtr(m_secondRadius, other.m_secondRadius)
1135 && m_stops == other.m_stops; 1135 && m_stops == other.m_stops;
1136 1136
1137 if (m_repeating != other.m_repeating) 1137 if (m_repeating != other.m_repeating)
1138 return false; 1138 return false;
1139 1139
1140 bool equalXorY = false; 1140 bool equalXandY = false;
1141 if (m_firstX && m_firstY) 1141 if (m_firstX && m_firstY)
1142 equalXorY = compareCSSValuePtr(m_firstX, other.m_firstX) && compareCSSVa luePtr(m_firstY, other.m_firstY); 1142 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && compareCSSV aluePtr(m_firstY, other.m_firstY);
1143 else if (m_firstX) 1143 else if (m_firstX)
1144 equalXorY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_fir stY; 1144 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_fi rstY;
1145 else if (m_firstY) 1145 else if (m_firstY)
1146 equalXorY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fir stX; 1146 equalXandY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fi rstX;
1147 else 1147 else
1148 equalXorY == !other.m_firstX || !other.m_firstY; 1148 equalXandY = !other.m_firstX && !other.m_firstY;
1149 1149
1150 if (!equalXorY) 1150 if (!equalXandY)
1151 return false; 1151 return false;
1152 1152
1153 bool equalShape = true; 1153 bool equalShape = true;
1154 bool equalSizingBehavior = true; 1154 bool equalSizingBehavior = true;
1155 bool equalHorizontalAndVerticalSize = true; 1155 bool equalHorizontalAndVerticalSize = true;
1156 1156
1157 if (m_shape) 1157 if (m_shape)
1158 equalShape = compareCSSValuePtr(m_shape, other.m_shape); 1158 equalShape = compareCSSValuePtr(m_shape, other.m_shape);
1159 else if (m_sizingBehavior) 1159 else if (m_sizingBehavior)
1160 equalSizingBehavior = compareCSSValuePtr(m_sizingBehavior, other.m_sizin gBehavior); 1160 equalSizingBehavior = compareCSSValuePtr(m_sizingBehavior, other.m_sizin gBehavior);
1161 else if (m_endHorizontalSize && m_endVerticalSize) 1161 else if (m_endHorizontalSize && m_endVerticalSize)
1162 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize); 1162 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize, other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end VerticalSize);
1163 else { 1163 else {
1164 equalShape = !other.m_shape; 1164 equalShape = !other.m_shape;
1165 equalSizingBehavior = !other.m_sizingBehavior; 1165 equalSizingBehavior = !other.m_sizingBehavior;
1166 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize; 1166 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_ endVerticalSize;
1167 } 1167 }
1168 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops; 1168 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize & & m_stops == other.m_stops;
1169 } 1169 }
1170 1170
1171 } // namespace WebCore 1171 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/cssom/cssvalue-comparison-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698