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 18 matching lines...) Expand all Loading... |
29 #include "CSSCalculationValue.h" | 29 #include "CSSCalculationValue.h" |
30 #include "CSSValueKeywords.h" | 30 #include "CSSValueKeywords.h" |
31 #include "GeneratorGeneratedImage.h" | 31 #include "GeneratorGeneratedImage.h" |
32 #include "Gradient.h" | 32 #include "Gradient.h" |
33 #include "Image.h" | 33 #include "Image.h" |
34 #include "IntSize.h" | 34 #include "IntSize.h" |
35 #include "IntSizeHash.h" | 35 #include "IntSizeHash.h" |
36 #include "NodeRenderStyle.h" | 36 #include "NodeRenderStyle.h" |
37 #include "RenderObject.h" | 37 #include "RenderObject.h" |
38 #include "StyleResolver.h" | 38 #include "StyleResolver.h" |
39 #include "WebCoreMemoryInstrumentation.h" | |
40 #include <wtf/MemoryInstrumentationVector.h> | |
41 #include <wtf/text/StringBuilder.h> | 39 #include <wtf/text/StringBuilder.h> |
42 #include <wtf/text/WTFString.h> | 40 #include <wtf/text/WTFString.h> |
43 | 41 |
44 using namespace std; | 42 using namespace std; |
45 | 43 |
46 namespace WebCore { | 44 namespace WebCore { |
47 | 45 |
48 void CSSGradientColorStop::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
const | |
49 { | |
50 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
51 info.addMember(m_position, "position"); | |
52 info.addMember(m_color, "color"); | |
53 } | |
54 | |
55 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize&
size) | 46 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize&
size) |
56 { | 47 { |
57 if (size.isEmpty()) | 48 if (size.isEmpty()) |
58 return 0; | 49 return 0; |
59 | 50 |
60 bool cacheable = isCacheable(); | 51 bool cacheable = isCacheable(); |
61 if (cacheable) { | 52 if (cacheable) { |
62 if (!clients().contains(renderer)) | 53 if (!clients().contains(renderer)) |
63 return 0; | 54 return 0; |
64 | 55 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 455 |
465 bool CSSGradientValue::knownToBeOpaque(const RenderObject*) const | 456 bool CSSGradientValue::knownToBeOpaque(const RenderObject*) const |
466 { | 457 { |
467 for (size_t i = 0; i < m_stops.size(); ++i) { | 458 for (size_t i = 0; i < m_stops.size(); ++i) { |
468 if (m_stops[i].m_resolvedColor.hasAlpha()) | 459 if (m_stops[i].m_resolvedColor.hasAlpha()) |
469 return false; | 460 return false; |
470 } | 461 } |
471 return true; | 462 return true; |
472 } | 463 } |
473 | 464 |
474 void CSSGradientValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObject
Info) const | |
475 { | |
476 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
477 CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo); | |
478 info.addMember(m_firstX, "firstX"); | |
479 info.addMember(m_firstY, "firstY"); | |
480 info.addMember(m_secondX, "secondX"); | |
481 info.addMember(m_secondY, "secondY"); | |
482 info.addMember(m_stops, "stops"); | |
483 } | |
484 | |
485 String CSSLinearGradientValue::customCssText() const | 465 String CSSLinearGradientValue::customCssText() const |
486 { | 466 { |
487 StringBuilder result; | 467 StringBuilder result; |
488 if (m_gradientType == CSSDeprecatedLinearGradient) { | 468 if (m_gradientType == CSSDeprecatedLinearGradient) { |
489 result.appendLiteral("-webkit-gradient(linear, "); | 469 result.appendLiteral("-webkit-gradient(linear, "); |
490 result.append(m_firstX->cssText()); | 470 result.append(m_firstX->cssText()); |
491 result.append(' '); | 471 result.append(' '); |
492 result.append(m_firstY->cssText()); | 472 result.append(m_firstY->cssText()); |
493 result.appendLiteral(", "); | 473 result.appendLiteral(", "); |
494 result.append(m_secondX->cssText()); | 474 result.append(m_secondX->cssText()); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 else if (m_firstX) | 728 else if (m_firstX) |
749 equalXorY =compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_firs
tY; | 729 equalXorY =compareCSSValuePtr(m_firstX, other.m_firstX) && !other.m_firs
tY; |
750 else if (m_firstY) | 730 else if (m_firstY) |
751 equalXorY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fir
stX; | 731 equalXorY = compareCSSValuePtr(m_firstY, other.m_firstY) && !other.m_fir
stX; |
752 else | 732 else |
753 equalXorY = !other.m_firstX || !other.m_firstY; | 733 equalXorY = !other.m_firstX || !other.m_firstY; |
754 | 734 |
755 return equalXorY && m_stops == other.m_stops; | 735 return equalXorY && m_stops == other.m_stops; |
756 } | 736 } |
757 | 737 |
758 void CSSLinearGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memor
yObjectInfo) const | |
759 { | |
760 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
761 CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo); | |
762 info.addMember(m_angle, "angle"); | |
763 } | |
764 | |
765 String CSSRadialGradientValue::customCssText() const | 738 String CSSRadialGradientValue::customCssText() const |
766 { | 739 { |
767 StringBuilder result; | 740 StringBuilder result; |
768 | 741 |
769 if (m_gradientType == CSSDeprecatedRadialGradient) { | 742 if (m_gradientType == CSSDeprecatedRadialGradient) { |
770 result.appendLiteral("-webkit-gradient(radial, "); | 743 result.appendLiteral("-webkit-gradient(radial, "); |
771 result.append(m_firstX->cssText()); | 744 result.append(m_firstX->cssText()); |
772 result.append(' '); | 745 result.append(' '); |
773 result.append(m_firstY->cssText()); | 746 result.append(m_firstY->cssText()); |
774 result.appendLiteral(", "); | 747 result.appendLiteral(", "); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 else if (m_endHorizontalSize && m_endVerticalSize) | 1156 else if (m_endHorizontalSize && m_endVerticalSize) |
1184 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize,
other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end
VerticalSize); | 1157 equalHorizontalAndVerticalSize = compareCSSValuePtr(m_endHorizontalSize,
other.m_endHorizontalSize) && compareCSSValuePtr(m_endVerticalSize, other.m_end
VerticalSize); |
1185 else { | 1158 else { |
1186 equalShape = !other.m_shape; | 1159 equalShape = !other.m_shape; |
1187 equalSizingBehavior = !other.m_sizingBehavior; | 1160 equalSizingBehavior = !other.m_sizingBehavior; |
1188 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_
endVerticalSize; | 1161 equalHorizontalAndVerticalSize = !other.m_endHorizontalSize && !other.m_
endVerticalSize; |
1189 } | 1162 } |
1190 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize &
& m_stops == other.m_stops; | 1163 return equalShape && equalSizingBehavior && equalHorizontalAndVerticalSize &
& m_stops == other.m_stops; |
1191 } | 1164 } |
1192 | 1165 |
1193 void CSSRadialGradientValue::reportDescendantMemoryUsage(MemoryObjectInfo* memor
yObjectInfo) const | |
1194 { | |
1195 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
1196 CSSGradientValue::reportBaseClassMemoryUsage(memoryObjectInfo); | |
1197 info.addMember(m_firstRadius, "firstRadius"); | |
1198 info.addMember(m_secondRadius, "secondRadius"); | |
1199 info.addMember(m_shape, "shape"); | |
1200 info.addMember(m_sizingBehavior, "sizingBehavior"); | |
1201 info.addMember(m_endHorizontalSize, "endHorizontalSize"); | |
1202 info.addMember(m_endVerticalSize, "endVerticalSize"); | |
1203 } | |
1204 | |
1205 } // namespace WebCore | 1166 } // namespace WebCore |
OLD | NEW |