Title: [100560] trunk/Source/WebCore
Revision
100560
Author
[email protected]
Date
2011-11-16 21:24:42 -0800 (Wed, 16 Nov 2011)

Log Message

DropShadowFilterOperation violates platform isolation
https://bugs.webkit.org/show_bug.cgi?id=72544

Reviewed by Simon Fraser.

Move ShadowData properties into the DropShadowFilterOperation
to avoid depending on something outside platform.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::valueForFilter):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::createFilterOperations):
* platform/graphics/filters/FilterOperation.h:
(WebCore::DropShadowFilterOperation::create):
(WebCore::DropShadowFilterOperation::x):
(WebCore::DropShadowFilterOperation::y):
(WebCore::DropShadowFilterOperation::stdDeviation):
(WebCore::DropShadowFilterOperation::color):
(WebCore::DropShadowFilterOperation::operator==):
(WebCore::DropShadowFilterOperation::DropShadowFilterOperation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (100559 => 100560)


--- trunk/Source/WebCore/ChangeLog	2011-11-17 05:14:53 UTC (rev 100559)
+++ trunk/Source/WebCore/ChangeLog	2011-11-17 05:24:42 UTC (rev 100560)
@@ -1,3 +1,26 @@
+2011-11-16  Dean Jackson  <[email protected]>
+
+        DropShadowFilterOperation violates platform isolation
+        https://bugs.webkit.org/show_bug.cgi?id=72544
+
+        Reviewed by Simon Fraser.
+
+        Move ShadowData properties into the DropShadowFilterOperation
+        to avoid depending on something outside platform.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::valueForFilter):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::createFilterOperations):
+        * platform/graphics/filters/FilterOperation.h:
+        (WebCore::DropShadowFilterOperation::create):
+        (WebCore::DropShadowFilterOperation::x):
+        (WebCore::DropShadowFilterOperation::y):
+        (WebCore::DropShadowFilterOperation::stdDeviation):
+        (WebCore::DropShadowFilterOperation::color):
+        (WebCore::DropShadowFilterOperation::operator==):
+        (WebCore::DropShadowFilterOperation::DropShadowFilterOperation):
+
 2011-11-16  Adam Bergkvist  <[email protected]>
 
         Use a simple page client for user consent in getUserMedia()

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (100559 => 100560)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-11-17 05:14:53 UTC (rev 100559)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-11-17 05:24:42 UTC (rev 100560)
@@ -735,7 +735,8 @@
             DropShadowFilterOperation* dropShadowOperation = static_cast<DropShadowFilterOperation*>(filterOperation);
             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::DropShadowFilterOperation);
             // We want our computed style to look like that of a text shadow (has neither spread nor inset style).
-            filterValue->append(valueForShadow(dropShadowOperation->shadow(), CSSPropertyTextShadow, style));
+            ShadowData shadowData = ShadowData(dropShadowOperation->x(), dropShadowOperation->y(), dropShadowOperation->stdDeviation(), 0, Normal, false, dropShadowOperation->color());
+            filterValue->append(valueForShadow(&shadowData, CSSPropertyTextShadow, style));
             break;
         }
 #if ENABLE(CSS_SHADERS)

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (100559 => 100560)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-11-17 05:14:53 UTC (rev 100559)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-11-17 05:24:42 UTC (rev 100560)
@@ -5657,9 +5657,8 @@
             Color color;
             if (item->color)
                 color = getColorFromPrimitiveValue(item->color.get());
-            OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(x, y, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
             
-            operations.operations().append(DropShadowFilterOperation::create(shadowData.release(), operationType));
+            operations.operations().append(DropShadowFilterOperation::create(x, y, blur, color.isValid() ? color : Color::transparent, operationType));
             break;
         }
         case WebKitCSSFilterValue::UnknownFilterOperation:

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h (100559 => 100560)


--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2011-11-17 05:14:53 UTC (rev 100559)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h	2011-11-17 05:24:42 UTC (rev 100560)
@@ -29,7 +29,6 @@
 #if ENABLE(CSS_FILTERS)
 
 #include "Length.h"
-#include "ShadowData.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefCounted.h>
@@ -270,12 +269,15 @@
 
 class DropShadowFilterOperation : public FilterOperation {
 public:
-    static PassRefPtr<DropShadowFilterOperation> create(PassOwnPtr<ShadowData> shadow, OperationType type)
+    static PassRefPtr<DropShadowFilterOperation> create(int x, int y, int stdDeviation, Color color, OperationType type)
     {
-        return adoptRef(new DropShadowFilterOperation(shadow, type));
+        return adoptRef(new DropShadowFilterOperation(x, y, stdDeviation, color, type));
     }
 
-    const ShadowData* shadow() const { return m_shadow.get(); }
+    int x() const { return m_x; }
+    int y() const { return m_y; }
+    int stdDeviation() const { return m_stdDeviation; }
+    Color color() const { return m_color; }
 
 private:
 
@@ -284,16 +286,22 @@
         if (!isSameType(o))
             return false;
         const DropShadowFilterOperation* other = static_cast<const DropShadowFilterOperation*>(&o);
-        return *m_shadow == *(other->m_shadow);
+        return m_x == other->m_x && m_y == other->m_y && m_stdDeviation == other->m_stdDeviation && m_color == other->m_color;
     }
 
-    DropShadowFilterOperation(PassOwnPtr<ShadowData> shadow, OperationType type)
+    DropShadowFilterOperation(int x, int y, int stdDeviation, Color color, OperationType type)
         : FilterOperation(type)
-        , m_shadow(shadow)
+        , m_x(x)
+        , m_y(y)
+        , m_stdDeviation(stdDeviation)
+        , m_color(color)
     {
     }
 
-    OwnPtr<ShadowData> m_shadow;
+    int m_x;
+    int m_y;
+    int m_stdDeviation;
+    Color m_color;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to