Changeset 115291 in webkit
- Timestamp:
- Apr 25, 2012, 10:44:22 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/Platform/ChangeLog
r115206 r115291 1 2012-04-25 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Remove guarded virtual methods from WebFilterOperation API 4 https://bugs.webkit.org/show_bug.cgi?id=84926 5 6 Reviewed by James Robinson. 7 8 We remove the virtual methods from the WebFilterOperation class, 9 and use an enum in the base class to distinguish which subclass 10 the object is. Then WebFilterOperations can access the correct 11 subclass to get the filter operation's data and construct a 12 WebCore::FilterOperation to store internally. 13 14 * chromium/public/WebFilterOperation.h: 15 (WebKit::WebFilterOperation::WebFilterOperation): 16 (WebKit::WebBasicColorMatrixFilterOperation::WebBasicColorMatrixFilterOperation): 17 (WebBasicColorMatrixFilterOperation): 18 (WebKit::WebBasicComponentTransferFilterOperation::WebBasicComponentTransferFilterOperation): 19 (WebBasicComponentTransferFilterOperation): 20 (WebKit::WebBlurFilterOperation::WebBlurFilterOperation): 21 (WebKit::WebDropShadowFilterOperation::WebDropShadowFilterOperation): 22 1 23 2012-04-25 Gavin Peters <gavinp@chromium.org> 2 24 -
trunk/Source/Platform/chromium/public/WebFilterOperation.h
r114343 r115291 35 35 #endif 36 36 37 #if WEBKIT_IMPLEMENTATION38 namespace WebCore {39 class FilterOperation;40 }41 #endif42 43 37 namespace WebKit { 44 38 45 39 struct WebFilterOperation { 46 #if WEBKIT_IMPLEMENTATION 47 virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const = 0; 48 #endif 40 enum FilterType { 41 FilterTypeBasicColorMatrix, 42 FilterTypeBasicComponentTransfer, 43 FilterTypeBlur, 44 FilterTypeDropShadow 45 }; 46 47 FilterType type; 49 48 50 49 protected: 51 WebFilterOperation() { } 50 WebFilterOperation(FilterType type) 51 : type(type) 52 { } 52 53 }; 53 54 54 55 struct WebBasicColorMatrixFilterOperation : public WebFilterOperation { 55 enum FilterType {56 FilterTypeGrayscale = 1,57 FilterTypeSepia = 2,58 FilterTypeSaturate = 3,59 FilterTypeHueRotate = 456 enum BasicColorMatrixFilterType { 57 BasicColorMatrixFilterTypeGrayscale = 1, 58 BasicColorMatrixFilterTypeSepia = 2, 59 BasicColorMatrixFilterTypeSaturate = 3, 60 BasicColorMatrixFilterTypeHueRotate = 4 60 61 }; 61 62 62 WebBasicColorMatrixFilterOperation(FilterType type, float amount) 63 : type(type) 63 WebBasicColorMatrixFilterOperation(BasicColorMatrixFilterType type, float amount) 64 : WebFilterOperation(FilterTypeBasicColorMatrix) 65 , subtype(type) 64 66 , amount(amount) 65 67 { } 66 68 67 #if WEBKIT_IMPLEMENTATION 68 virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE; 69 #endif 70 71 FilterType type; 69 BasicColorMatrixFilterType subtype; 72 70 float amount; 73 71 }; 74 72 75 73 struct WebBasicComponentTransferFilterOperation : public WebFilterOperation { 76 enum FilterType {77 FilterTypeInvert = 5,78 FilterTypeBrightness = 7,79 FilterTypeContrast = 874 enum BasicComponentTransferFilterType { 75 BasicComponentTransferFilterTypeInvert = 5, 76 BasicComponentTransferFilterTypeBrightness = 7, 77 BasicComponentTransferFilterTypeContrast = 8 80 78 // Opacity is missing because this is more expensive than just setting opacity on the layer. 81 79 }; 82 80 83 WebBasicComponentTransferFilterOperation(FilterType type, float amount) 84 : type(type) 81 WebBasicComponentTransferFilterOperation(BasicComponentTransferFilterType type, float amount) 82 : WebFilterOperation(FilterTypeBasicComponentTransfer) 83 , subtype(type) 85 84 , amount(amount) 86 85 { } 87 86 88 #if WEBKIT_IMPLEMENTATION 89 virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE; 90 #endif 91 92 FilterType type; 87 BasicComponentTransferFilterType subtype; 93 88 float amount; 94 89 }; 95 90 96 91 struct WebBlurFilterOperation : public WebFilterOperation { 97 explicit WebBlurFilterOperation(int pixelRadius) : pixelRadius(pixelRadius) { } 98 99 #if WEBKIT_IMPLEMENTATION 100 virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE; 101 #endif 92 explicit WebBlurFilterOperation(int pixelRadius) 93 : WebFilterOperation(FilterTypeBlur) 94 , pixelRadius(pixelRadius) 95 { } 102 96 103 97 int pixelRadius; 104 98 }; 105 99 106 class WebDropShadowFilterOperation : public WebFilterOperation { 107 WebDropShadowFilterOperation(int x, int y, int stdDeviation, WebColor color) 108 : x(x) 100 struct WebDropShadowFilterOperation : public WebFilterOperation { 101 WebDropShadowFilterOperation(int x, int y, int stdDeviation, WebColor color) 102 : WebFilterOperation(FilterTypeDropShadow) 103 , x(x) 109 104 , y(y) 110 105 , stdDeviation(stdDeviation) 111 106 , color(color) 112 107 { } 113 114 #if WEBKIT_IMPLEMENTATION115 virtual PassRefPtr<WebCore::FilterOperation> toFilterOperation() const OVERRIDE;116 #endif117 108 118 109 int x; -
trunk/Source/WebCore/ChangeLog
r115290 r115291 1 2012-04-25 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Remove guarded virtual methods from WebFilterOperation API 4 https://bugs.webkit.org/show_bug.cgi?id=84926 5 6 Reviewed by James Robinson. 7 8 * WebCore.gypi: 9 * platform/chromium/support/WebFilterOperation.cpp: Removed. 10 * platform/chromium/support/WebFilterOperations.cpp: 11 (WebKit::WebFilterOperations::append): 12 1 13 2012-04-25 Benjamin Poulain <benjamin@webkit.org> 2 14 -
trunk/Source/WebCore/WebCore.gypi
r115274 r115291 8244 8244 'platform/chromium/support/WebHTTPBody.cpp', 8245 8245 'platform/chromium/support/WebHTTPLoadInfo.cpp', 8246 'platform/chromium/support/WebFilterOperation.cpp',8247 8246 'platform/chromium/support/WebFilterOperations.cpp', 8248 8247 'platform/chromium/support/WebICECandidateDescriptor.cpp', -
trunk/Source/WebCore/platform/chromium/support/WebFilterOperations.cpp
r114807 r115291 43 43 void WebFilterOperations::append(const WebFilterOperation& filter) 44 44 { 45 m_private->operations().append(filter.toFilterOperation()); 45 switch (filter.type) { 46 case WebFilterOperation::FilterTypeBasicColorMatrix: { 47 const WebBasicColorMatrixFilterOperation& colorFilter = static_cast<const WebBasicColorMatrixFilterOperation&>(filter); 48 m_private->operations().append(BasicColorMatrixFilterOperation::create(colorFilter.amount, static_cast<FilterOperation::OperationType>(colorFilter.subtype))); 49 break; 50 } 51 case WebFilterOperation::FilterTypeBasicComponentTransfer: { 52 const WebBasicComponentTransferFilterOperation& componentFilter = static_cast<const WebBasicComponentTransferFilterOperation&>(filter); 53 m_private->operations().append(BasicComponentTransferFilterOperation::create(componentFilter.amount, static_cast<FilterOperation::OperationType>(componentFilter.subtype))); 54 break; 55 } 56 case WebFilterOperation::FilterTypeBlur: { 57 const WebBlurFilterOperation& blurFilter = static_cast<const WebBlurFilterOperation&>(filter); 58 m_private->operations().append(BlurFilterOperation::create(Length(blurFilter.pixelRadius, Fixed), FilterOperation::BLUR)); 59 break; 60 } 61 case WebFilterOperation::FilterTypeDropShadow: { 62 const WebDropShadowFilterOperation& shadowFilter = static_cast<const WebDropShadowFilterOperation&>(filter); 63 m_private->operations().append(DropShadowFilterOperation::create(IntPoint(shadowFilter.x, shadowFilter.y), shadowFilter.stdDeviation, shadowFilter.color, FilterOperation::DROP_SHADOW)); 64 break; 65 } 66 } 46 67 } 47 68 -
trunk/Source/WebKit/chromium/ChangeLog
r115285 r115291 1 2012-04-25 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Remove guarded virtual methods from WebFilterOperation API 4 https://bugs.webkit.org/show_bug.cgi?id=84926 5 6 Reviewed by James Robinson. 7 8 * src/AssertMatchingEnums.cpp: 9 1 10 2012-04-25 James Robinson <jamesr@chromium.org> 2 11 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r115200 r115291 320 320 COMPILE_ASSERT_MATCHING_ENUM(WebEditingActionDropped, EditorInsertActionDropped); 321 321 322 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation:: FilterTypeGrayscale, FilterOperation::GRAYSCALE);323 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation:: FilterTypeSepia, FilterOperation::SEPIA);324 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation:: FilterTypeSaturate, FilterOperation::SATURATE);325 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation:: FilterTypeHueRotate, FilterOperation::HUE_ROTATE);326 327 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation:: FilterTypeInvert, FilterOperation::INVERT);328 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation:: FilterTypeBrightness, FilterOperation::BRIGHTNESS);329 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation:: FilterTypeContrast, FilterOperation::CONTRAST);322 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeGrayscale, FilterOperation::GRAYSCALE); 323 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSepia, FilterOperation::SEPIA); 324 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeSaturate, FilterOperation::SATURATE); 325 COMPILE_ASSERT_MATCHING_ENUM(WebBasicColorMatrixFilterOperation::BasicColorMatrixFilterTypeHueRotate, FilterOperation::HUE_ROTATE); 326 327 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeInvert, FilterOperation::INVERT); 328 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeBrightness, FilterOperation::BRIGHTNESS); 329 COMPILE_ASSERT_MATCHING_ENUM(WebBasicComponentTransferFilterOperation::BasicComponentTransferFilterTypeContrast, FilterOperation::CONTRAST); 330 330 331 331 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescription::NoFamily);
Note:
See TracChangeset
for help on using the changeset viewer.