| OLD | NEW |
| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/rendering/RenderObject.h" | 35 #include "core/rendering/RenderObject.h" |
| 36 #include "platform/geometry/IntSize.h" | 36 #include "platform/geometry/IntSize.h" |
| 37 #include "platform/graphics/Gradient.h" | 37 #include "platform/graphics/Gradient.h" |
| 38 #include "platform/graphics/GradientGeneratedImage.h" | 38 #include "platform/graphics/GradientGeneratedImage.h" |
| 39 #include "platform/graphics/Image.h" | 39 #include "platform/graphics/Image.h" |
| 40 #include "wtf/text/StringBuilder.h" | 40 #include "wtf/text/StringBuilder.h" |
| 41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 void CSSGradientColorStop::trace(Visitor* visitor) | |
| 46 { | |
| 47 visitor->trace(m_position); | |
| 48 visitor->trace(m_color); | |
| 49 } | |
| 50 | |
| 51 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize&
size) | 45 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize&
size) |
| 52 { | 46 { |
| 53 if (size.isEmpty()) | 47 if (size.isEmpty()) |
| 54 return nullptr; | 48 return nullptr; |
| 55 | 49 |
| 56 bool cacheable = isCacheable(); | 50 bool cacheable = isCacheable(); |
| 57 if (cacheable) { | 51 if (cacheable) { |
| 58 if (!clients().contains(renderer)) | 52 if (!clients().contains(renderer)) |
| 59 return nullptr; | 53 return nullptr; |
| 60 | 54 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 463 |
| 470 bool CSSGradientValue::knownToBeOpaque(const RenderObject*) const | 464 bool CSSGradientValue::knownToBeOpaque(const RenderObject*) const |
| 471 { | 465 { |
| 472 for (size_t i = 0; i < m_stops.size(); ++i) { | 466 for (size_t i = 0; i < m_stops.size(); ++i) { |
| 473 if (m_stops[i].m_resolvedColor.hasAlpha()) | 467 if (m_stops[i].m_resolvedColor.hasAlpha()) |
| 474 return false; | 468 return false; |
| 475 } | 469 } |
| 476 return true; | 470 return true; |
| 477 } | 471 } |
| 478 | 472 |
| 479 void CSSGradientValue::traceAfterDispatch(Visitor* visitor) | |
| 480 { | |
| 481 visitor->trace(m_firstX); | |
| 482 visitor->trace(m_firstY); | |
| 483 visitor->trace(m_secondX); | |
| 484 visitor->trace(m_secondY); | |
| 485 visitor->trace(m_stops); | |
| 486 CSSImageGeneratorValue::traceAfterDispatch(visitor); | |
| 487 } | |
| 488 | |
| 489 String CSSLinearGradientValue::customCSSText() const | 473 String CSSLinearGradientValue::customCSSText() const |
| 490 { | 474 { |
| 491 StringBuilder result; | 475 StringBuilder result; |
| 492 if (m_gradientType == CSSDeprecatedLinearGradient) { | 476 if (m_gradientType == CSSDeprecatedLinearGradient) { |
| 493 result.appendLiteral("-webkit-gradient(linear, "); | 477 result.appendLiteral("-webkit-gradient(linear, "); |
| 494 result.append(m_firstX->cssText()); | 478 result.append(m_firstX->cssText()); |
| 495 result.append(' '); | 479 result.append(' '); |
| 496 result.append(m_firstY->cssText()); | 480 result.append(m_firstY->cssText()); |
| 497 result.appendLiteral(", "); | 481 result.appendLiteral(", "); |
| 498 result.append(m_secondX->cssText()); | 482 result.append(m_secondX->cssText()); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 else if (m_firstX) | 736 else if (m_firstX) |
| 753 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_fi
rstY; | 737 equalXandY = compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_fi
rstY; |
| 754 else if (m_firstY) | 738 else if (m_firstY) |
| 755 equalXandY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fi
rstX; | 739 equalXandY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fi
rstX; |
| 756 else | 740 else |
| 757 equalXandY = !other.m_firstX && !other.m_firstY; | 741 equalXandY = !other.m_firstX && !other.m_firstY; |
| 758 | 742 |
| 759 return equalXandY && m_stops == other.m_stops; | 743 return equalXandY && m_stops == other.m_stops; |
| 760 } | 744 } |
| 761 | 745 |
| 762 void CSSLinearGradientValue::traceAfterDispatch(Visitor* visitor) | |
| 763 { | |
| 764 visitor->trace(m_angle); | |
| 765 CSSGradientValue::traceAfterDispatch(visitor); | |
| 766 } | |
| 767 | |
| 768 String CSSRadialGradientValue::customCSSText() const | 746 String CSSRadialGradientValue::customCSSText() const |
| 769 { | 747 { |
| 770 StringBuilder result; | 748 StringBuilder result; |
| 771 | 749 |
| 772 if (m_gradientType == CSSDeprecatedRadialGradient) { | 750 if (m_gradientType == CSSDeprecatedRadialGradient) { |
| 773 result.appendLiteral("-webkit-gradient(radial, "); | 751 result.appendLiteral("-webkit-gradient(radial, "); |
| 774 result.append(m_firstX->cssText()); | 752 result.append(m_firstX->cssText()); |
| 775 result.append(' '); | 753 result.append(' '); |
| 776 result.append(m_firstY->cssText()); | 754 result.append(m_firstY->cssText()); |
| 777 result.appendLiteral(", "); | 755 result.appendLiteral(", "); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 else if (m_endHorizontalSize && m_endVerticalSize) | 1164 else if (m_endHorizontalSize && m_endVerticalSize) |
| 1187 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize,
other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end
VerticalSize); | 1165 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize,
other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end
VerticalSize); |
| 1188 else { | 1166 else { |
| 1189 equalShape = !other.m_shape; | 1167 equalShape = !other.m_shape; |
| 1190 equalSizingBehavior = !other.m_sizingBehavior; | 1168 equalSizingBehavior = !other.m_sizingBehavior; |
| 1191 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_
endVerticalSize; | 1169 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_
endVerticalSize; |
| 1192 } | 1170 } |
| 1193 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize &
& m_stops == other.m_stops; | 1171 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize &
& m_stops == other.m_stops; |
| 1194 } | 1172 } |
| 1195 | 1173 |
| 1196 void CSSRadialGradientValue::traceAfterDispatch(Visitor* visitor) | |
| 1197 { | |
| 1198 visitor->trace(m_firstRadius); | |
| 1199 visitor->trace(m_secondRadius); | |
| 1200 visitor->trace(m_shape); | |
| 1201 visitor->trace(m_sizingBehavior); | |
| 1202 visitor->trace(m_endHorizontalSize); | |
| 1203 visitor->trace(m_endVerticalSize); | |
| 1204 CSSGradientValue::traceAfterDispatch(visitor); | |
| 1205 } | |
| 1206 | |
| 1207 } // namespace blink | 1174 } // namespace blink |
| OLD | NEW |