Title: [169904] trunk/Source/WebCore
Revision
169904
Author
[email protected]
Date
2014-06-12 11:50:18 -0700 (Thu, 12 Jun 2014)

Log Message

Add ShapeValue.cpp and move ShapeValue::isImageValid() there
https://bugs.webkit.org/show_bug.cgi?id=133809

Reviewed by Antti Koivisto.

This gets rid of CachedImage.h (and ResourceRequest and friends) from RenderStyle.h.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::shapePropertyValue):
* css/CSSCrossfadeValue.cpp:
* css/CSSFilterImageValue.cpp:
* css/StyleResolver.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc):
* rendering/ShapeValue.cpp: Added.
(WebCore::ShapeValue::isImageValid):
* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::referenceBox):
(WebCore::ShapeOutsideInfo::computedShape):
(WebCore::ShapeOutsideInfo::isEnabledFor):
* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::type):
(WebCore::ShapeValue::setImage):
(WebCore::ShapeValue::ShapeValue):
(WebCore::ShapeValue::isImageValid): Deleted.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (169903 => 169904)


--- trunk/Source/WebCore/CMakeLists.txt	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-06-12 18:50:18 UTC (rev 169904)
@@ -2394,6 +2394,7 @@
     rendering/style/SVGRenderStyle.cpp
     rendering/style/SVGRenderStyleDefs.cpp
     rendering/style/ShadowData.cpp
+    rendering/style/ShapeValue.cpp
     rendering/style/StyleBackgroundData.cpp
     rendering/style/StyleBoxData.cpp
     rendering/style/StyleCachedImage.cpp

Modified: trunk/Source/WebCore/ChangeLog (169903 => 169904)


--- trunk/Source/WebCore/ChangeLog	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/ChangeLog	2014-06-12 18:50:18 UTC (rev 169904)
@@ -1,3 +1,35 @@
+2014-06-12  Anders Carlsson  <[email protected]>
+
+        Add ShapeValue.cpp and move ShapeValue::isImageValid() there
+        https://bugs.webkit.org/show_bug.cgi?id=133809
+
+        Reviewed by Antti Koivisto.
+
+        This gets rid of CachedImage.h (and ResourceRequest and friends) from RenderStyle.h.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::shapePropertyValue):
+        * css/CSSCrossfadeValue.cpp:
+        * css/CSSFilterImageValue.cpp:
+        * css/StyleResolver.h:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc):
+        * rendering/ShapeValue.cpp: Added.
+        (WebCore::ShapeValue::isImageValid):
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::referenceBox):
+        (WebCore::ShapeOutsideInfo::computedShape):
+        (WebCore::ShapeOutsideInfo::isEnabledFor):
+        * rendering/style/ShapeValue.h:
+        (WebCore::ShapeValue::type):
+        (WebCore::ShapeValue::setImage):
+        (WebCore::ShapeValue::ShapeValue):
+        (WebCore::ShapeValue::isImageValid): Deleted.
+
 2014-06-12  Zalan Bujtas  <[email protected]>
 
         Subpixel rendering: Make <select> element's decoration subpixel aware.

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (169903 => 169904)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-06-12 18:50:18 UTC (rev 169904)
@@ -11542,6 +11542,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\rendering\style\ShapeValue.cpp" />
     <ClCompile Include="..\rendering\style\StyleAllInOne.cpp" />
     <ClCompile Include="..\rendering\style\StyleBackgroundData.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (169903 => 169904)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-06-12 18:50:18 UTC (rev 169904)
@@ -2790,6 +2790,9 @@
     <ClCompile Include="..\rendering\style\ShadowData.cpp">
       <Filter>rendering\style</Filter>
     </ClCompile>
+    <ClCompile Include="..\rendering\style\ShapeValue.cpp">
+      <Filter>rendering\style</Filter>
+    </ClCompile>
     <ClCompile Include="..\rendering\style\StyleAllInOne.cpp">
       <Filter>rendering\style</Filter>
     </ClCompile>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169903 => 169904)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-06-12 18:50:18 UTC (rev 169904)
@@ -791,6 +791,7 @@
 		1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */; };
 		1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */; };
 		1AB33DA512551E320024457A /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AB33DA412551E320024457A /* IOKit.framework */; };
+		1AB5EBD0194A1D170059AC70 /* ShapeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB5EBCF194A1D170059AC70 /* ShapeValue.cpp */; };
 		1AB7FC680A8B92EC00D9D37B /* XPathEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */; };
 		1AB7FC690A8B92EC00D9D37B /* XPathEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */; };
 		1AB7FC6B0A8B92EC00D9D37B /* XPathExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB7FC4A0A8B92EC00D9D37B /* XPathExpression.cpp */; };
@@ -7717,6 +7718,7 @@
 		1AB1AE780C051FDE00139F4F /* zoomInCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomInCursor.png; sourceTree = "<group>"; };
 		1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomOutCursor.png; sourceTree = "<group>"; };
 		1AB33DA412551E320024457A /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+		1AB5EBCF194A1D170059AC70 /* ShapeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ShapeValue.cpp; path = style/ShapeValue.cpp; sourceTree = "<group>"; };
 		1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathEvaluator.cpp; sourceTree = "<group>"; };
 		1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathEvaluator.h; sourceTree = "<group>"; };
 		1AB7FC490A8B92EC00D9D37B /* XPathEvaluator.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XPathEvaluator.idl; sourceTree = "<group>"; };
@@ -20868,6 +20870,7 @@
 				BC5EB6670E81CB7100B25965 /* RenderStyleConstants.h */,
 				BC5EB8C10E82031B00B25965 /* ShadowData.cpp */,
 				BC5EB8C20E82031B00B25965 /* ShadowData.h */,
+				1AB5EBCF194A1D170059AC70 /* ShapeValue.cpp */,
 				FD1AF14E1656F12100C6D4F7 /* ShapeValue.h */,
 				BC5EB6A00E81DC4F00B25965 /* StyleBackgroundData.cpp */,
 				BC5EB6A10E81DC4F00B25965 /* StyleBackgroundData.h */,
@@ -29702,6 +29705,7 @@
 				B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
 				CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */,
 				F55B3DDF1251F12D003EF269 /* WeekInputType.cpp in Sources */,
+				1AB5EBD0194A1D170059AC70 /* ShapeValue.cpp in Sources */,
 				85031B500A44EFC700F992E0 /* WheelEvent.cpp in Sources */,
 				93EC44A1188F4BB800661DF1 /* WheelEventDeltaTracker.cpp in Sources */,
 				9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */,

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (169903 => 169904)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -1622,13 +1622,13 @@
     if (!shapeValue)
         return cssValuePool().createIdentifierValue(CSSValueNone);
 
-    if (shapeValue->type() == ShapeValue::Box)
+    if (shapeValue->type() == ShapeValue::Type::Box)
         return cssValuePool().createValue(shapeValue->cssBox());
 
-    if (shapeValue->type() == ShapeValue::Image)
+    if (shapeValue->type() == ShapeValue::Type::Image)
         return shapeValue->image() ? shapeValue->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone);
 
-    ASSERT(shapeValue->type() == ShapeValue::Shape);
+    ASSERT(shapeValue->type() == ShapeValue::Type::Shape);
 
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     list->append(valueForBasicShape(style, shapeValue->shape()));

Modified: trunk/Source/WebCore/css/CSSCrossfadeValue.cpp (169903 => 169904)


--- trunk/Source/WebCore/css/CSSCrossfadeValue.cpp	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/css/CSSCrossfadeValue.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -29,6 +29,7 @@
 
 #include "AnimationUtilities.h"
 #include "CSSImageValue.h"
+#include "CachedImage.h"
 #include "CachedResourceLoader.h"
 #include "CrossfadeGeneratedImage.h"
 #include "ImageBuffer.h"

Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (169903 => 169904)


--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -30,6 +30,7 @@
 #if ENABLE(CSS_FILTERS)
 
 #include "CSSImageValue.h"
+#include "CachedImage.h"
 #include "CachedResourceLoader.h"
 #include "CrossfadeGeneratedImage.h"
 #include "FilterEffectRenderer.h"

Modified: trunk/Source/WebCore/css/StyleResolver.h (169903 => 169904)


--- trunk/Source/WebCore/css/StyleResolver.h	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/css/StyleResolver.h	2014-06-12 18:50:18 UTC (rev 169904)
@@ -90,6 +90,7 @@
 class StyledElement;
 class ViewportStyleResolver;
 class WebKitCSSFilterValue;
+struct ResourceLoaderOptions;
 
 class MediaQueryResult {
     WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (169903 => 169904)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -145,7 +145,7 @@
     if (!from || !to)
         return to;
 
-    if (from->type() != ShapeValue::Shape || to->type() != ShapeValue::Shape)
+    if (from->type() != ShapeValue::Type::Shape || to->type() != ShapeValue::Type::Shape)
         return to;
 
     if (from->cssBox() != to->cssBox())

Modified: trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp (169903 => 169904)


--- trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -75,7 +75,7 @@
 static inline CSSBoxType referenceBox(const ShapeValue& shapeValue)
 {
     if (shapeValue.cssBox() == BoxMissing) {
-        if (shapeValue.type() == ShapeValue::Image)
+        if (shapeValue.type() == ShapeValue::Type::Image)
             return ContentBox;
         return MarginBox;
     }
@@ -175,15 +175,15 @@
     const ShapeValue& shapeValue = *style.shapeOutside();
 
     switch (shapeValue.type()) {
-    case ShapeValue::Shape:
+    case ShapeValue::Type::Shape:
         ASSERT(shapeValue.shape());
         m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSize, writingMode, margin);
         break;
-    case ShapeValue::Image:
+    case ShapeValue::Type::Image:
         ASSERT(shapeValue.isImageValid());
         m_shape = createShapeForImage(shapeValue.image(), shapeImageThreshold, writingMode, margin);
         break;
-    case ShapeValue::Box: {
+    case ShapeValue::Type::Box: {
         RoundedRect shapeRect = computeRoundedRectForBoxShape(referenceBox(shapeValue), m_renderer);
         if (!containingBlockStyle.isHorizontalWritingMode())
             shapeRect = shapeRect.transposedRect();
@@ -294,9 +294,9 @@
         return false;
 
     switch (shapeValue->type()) {
-    case ShapeValue::Shape: return shapeValue->shape();
-    case ShapeValue::Image: return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(), *(shapeValue->image()));
-    case ShapeValue::Box: return true;
+    case ShapeValue::Type::Shape: return shapeValue->shape();
+    case ShapeValue::Type::Image: return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(), *(shapeValue->image()));
+    case ShapeValue::Type::Box: return true;
     }
 
     ASSERT_NOT_REACHED();

Added: trunk/Source/WebCore/rendering/style/ShapeValue.cpp (0 => 169904)


--- trunk/Source/WebCore/rendering/style/ShapeValue.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/style/ShapeValue.cpp	2014-06-12 18:50:18 UTC (rev 169904)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ShapeValue.h"
+
+#include "CachedImage.h"
+
+namespace WebCore {
+
+bool ShapeValue::isImageValid() const
+{
+    if (!image())
+        return false;
+    if (image()->isCachedImage() || image()->isCachedImageSet())
+        return image()->cachedImage() && image()->cachedImage()->hasImage();
+    return image()->isGeneratedImage();
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/ShapeValue.h (169903 => 169904)


--- trunk/Source/WebCore/rendering/style/ShapeValue.h	2014-06-12 18:22:46 UTC (rev 169903)
+++ trunk/Source/WebCore/rendering/style/ShapeValue.h	2014-06-12 18:50:18 UTC (rev 169904)
@@ -32,7 +32,6 @@
 
 #include "BasicShapes.h"
 #include "CSSValueKeywords.h"
-#include "CachedImage.h"
 #include "StyleImage.h"
 #include <wtf/PassRefPtr.h>
 
@@ -40,7 +39,7 @@
 
 class ShapeValue : public RefCounted<ShapeValue> {
 public:
-    enum ShapeValueType {
+    enum class Type {
         // The None value is defined by a null ShapeValue*
         Shape,
         Box,
@@ -62,24 +61,17 @@
         return adoptRef(new ShapeValue(image));
     }
 
-    ShapeValueType type() const { return m_type; }
+    Type type() const { return m_type; }
     BasicShape* shape() const { return m_shape.get(); }
     CSSBoxType cssBox() const { return m_cssBox; }
 
     StyleImage* image() const { return m_image.get(); }
 
-    bool isImageValid() const
-    {
-        if (!image())
-            return false;
-        if (image()->isCachedImage() || image()->isCachedImageSet())
-            return image()->cachedImage() && image()->cachedImage()->hasImage();
-        return image()->isGeneratedImage();
-    }
+    bool isImageValid() const;
 
     void setImage(PassRefPtr<StyleImage> image)
     {
-        ASSERT(type() == Image);
+        ASSERT(type() == Type::Image);
         if (m_image != image)
             m_image = image;
     }
@@ -88,29 +80,30 @@
 
 private:
     ShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
-        : m_type(Shape)
+        : m_type(Type::Shape)
         , m_shape(shape)
         , m_cssBox(cssBox)
     {
     }
-    ShapeValue(ShapeValueType type)
+    ShapeValue(Type type)
         : m_type(type)
         , m_cssBox(BoxMissing)
     {
     }
     ShapeValue(PassRefPtr<StyleImage> image)
-        : m_type(Image)
+        : m_type(Type::Image)
         , m_image(image)
         , m_cssBox(BoxMissing)
     {
     }
+
     ShapeValue(CSSBoxType cssBox)
-        : m_type(Box)
+        : m_type(Type::Box)
         , m_cssBox(cssBox)
     {
     }
 
-    ShapeValueType m_type;
+    Type m_type;
     RefPtr<BasicShape> m_shape;
     RefPtr<StyleImage> m_image;
     CSSBoxType m_cssBox;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to