[CSS Exclusions] Refactor ExclusionShapeInsideInfo to more general ExclusionShapeInfo
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Jan 2013 18:36:28 +0000 (18:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Jan 2013 18:36:28 +0000 (18:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100766

Patch by Bear Travis <betravis@adobe.com> on 2013-01-28
Reviewed by Dirk Schulze.

Refactoring, covered by existing tests.

Factoring out code common to ExclusionShapeInsideInfo and ExclusionShapeOutsideInfo
into common classes in ExclusionShapeInfo.h. Since the ExclusionShapeInsideInfo and
ExclusionShapeOutsideInfo share almost all of their code, save the RenderObject type
they work with and the specific shapeInside/Outside methods they call on RenderStyle
and ExclusionShape, the code has been templated. The code responsible for maintaining
global maps has also been factored out into a MappedInfo class.

* CMakeLists.txt: Adding ExclusionShapeInfo files.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* rendering/ExclusionShapeInfo.cpp: Added.
(WebCore::::computedShape): Determine the shape based on the current logical
dimensions. Call this method rather than accessing m_shape directly.
* rendering/ExclusionShapeInfo.h: Added.
(MappedInfo): Helper class that maintains a global info map.
(WebCore::MappedInfo::ensureInfo): Look up the info for a key and add it if not present.
(WebCore::MappedInfo::removeInfo): Remove the info associated with a key.
(WebCore::MappedInfo::info): Look up the info associated with a key.
(WebCore::MappedInfo::infoMap): The map used to store key/info pairs.
(ExclusionShapeInfo): A common parent class for ExclusionShapeInside/OutsideInfos.
The methods were factored out of the code common to ExclusionShapeInside/OutsideInfo.
(WebCore::ExclusionShapeInfo::~ExclusionShapeInfo): Destructor.
(WebCore::ExclusionShapeInfo::setShapeSize): Sets the shape's logical size.
(WebCore::ExclusionShapeInfo::shapeLogicalTop/Bottom/Left/Right/Width/Height):
Returns the shape's logical dimensions.
(WebCore::ExclusionShapeInfo::dirtyShapeSize): Mark the shape for recomputation.
(WebCore::ExclusionShapeInfo::owner): The renderer to which this info belongs.
(WebCore::ExclusionShapeInfo::ExclusionShapeInfo): Constructor.
(WebCore::ExclusionShapeInfo::floatLogicalTopToLayoutUnit/floatLogicalBottomToLayoutUnit):
Helper methods that round float units from ExclusionShapes to LayoutUnits for layout.
* rendering/ExclusionShapeInsideInfo.cpp:
(WebCore::ExclusionShapeInsideInfo::computeSegmentsForLine): Modified to use
computedShape() rather than m_shape.
(WebCore::ExclusionShapeInsideInfo::adjustLogicalLineTop): Ditto.
* rendering/ExclusionShapeInsideInfo.h:
(WebCore::ExclusionShapeInsideInfo::createInfo): Renamed to match MappedInfo.
(WebCore::ExclusionShapeInsideInfo::isEnabledFor): Renamed to match shorter naming.
(WebCore::ExclusionShapeInsideInfo::lineOverlapsShapeBounds): Modified to use
computedShape().
* rendering/ExclusionShapeOutsideInfo.cpp:
(WebCore::ExclusionShapeOutsideInfo::isEnabledFor): Renamed to match shorter naming.
* rendering/ExclusionShapeOutsideInfo.h:
(WebCore::ExclusionShapeOutsideInfo::createInfo): Renamed to match MappedInfo.
(WebCore::ExclusionShapeOutsideInfo::ExclusionShapeOutsideInfo): Constructor.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::willBeDestroyed): Use shortened MappedInfo names for looking
up infos.
(WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
(WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Ditto.
(WebCore::RenderBlock::computeExclusionShapeSize): Ditto.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::willBeDestroyed): Ditto.
(WebCore::RenderBox::updateExclusionShapeOutsideInfoAfterStyleChange): Ditto.
* rendering/RenderBox.h:
(WebCore):
(WebCore::RenderBox::exclusionShapeOutsideInfo): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140978 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/ExclusionShapeInfo.cpp [new file with mode: 0644]
Source/WebCore/rendering/ExclusionShapeInfo.h [new file with mode: 0644]
Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp
Source/WebCore/rendering/ExclusionShapeInsideInfo.h
Source/WebCore/rendering/ExclusionShapeOutsideInfo.cpp
Source/WebCore/rendering/ExclusionShapeOutsideInfo.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockLineLayout.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h

index 46a76dc71cc76a33154afa51c81443b4c0c6ecea..9c5e0a823841caa663d22636c2e7cd63f7b684de 100644 (file)
@@ -2107,6 +2107,7 @@ set(WebCore_SOURCES
     rendering/ExclusionPolygon.cpp
     rendering/ExclusionRectangle.cpp
     rendering/ExclusionShape.cpp
+    rendering/ExclusionShapeInfo.cpp
     rendering/ExclusionShapeInsideInfo.cpp
     rendering/ExclusionShapeOutsideInfo.cpp
     rendering/FilterEffectRenderer.cpp
index 01106c0d5026208ab496ceef20c539d8c5c3cd8c..617a34f6e88d2cc9c9169283d584399419ebd8a8 100644 (file)
@@ -1,3 +1,72 @@
+2013-01-28  Bear Travis  <betravis@adobe.com>
+
+        [CSS Exclusions] Refactor ExclusionShapeInsideInfo to more general ExclusionShapeInfo
+        https://bugs.webkit.org/show_bug.cgi?id=100766
+
+        Reviewed by Dirk Schulze.
+
+        Refactoring, covered by existing tests.
+
+        Factoring out code common to ExclusionShapeInsideInfo and ExclusionShapeOutsideInfo
+        into common classes in ExclusionShapeInfo.h. Since the ExclusionShapeInsideInfo and
+        ExclusionShapeOutsideInfo share almost all of their code, save the RenderObject type
+        they work with and the specific shapeInside/Outside methods they call on RenderStyle
+        and ExclusionShape, the code has been templated. The code responsible for maintaining
+        global maps has also been factored out into a MappedInfo class.
+
+        * CMakeLists.txt: Adding ExclusionShapeInfo files.
+        * GNUmakefile.list.am: Ditto.
+        * Target.pri: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * rendering/ExclusionShapeInfo.cpp: Added.
+        (WebCore::::computedShape): Determine the shape based on the current logical
+        dimensions. Call this method rather than accessing m_shape directly.
+        * rendering/ExclusionShapeInfo.h: Added.
+        (MappedInfo): Helper class that maintains a global info map.
+        (WebCore::MappedInfo::ensureInfo): Look up the info for a key and add it if not present.
+        (WebCore::MappedInfo::removeInfo): Remove the info associated with a key.
+        (WebCore::MappedInfo::info): Look up the info associated with a key.
+        (WebCore::MappedInfo::infoMap): The map used to store key/info pairs.
+        (ExclusionShapeInfo): A common parent class for ExclusionShapeInside/OutsideInfos.
+        The methods were factored out of the code common to ExclusionShapeInside/OutsideInfo.
+        (WebCore::ExclusionShapeInfo::~ExclusionShapeInfo): Destructor.
+        (WebCore::ExclusionShapeInfo::setShapeSize): Sets the shape's logical size.
+        (WebCore::ExclusionShapeInfo::shapeLogicalTop/Bottom/Left/Right/Width/Height):
+        Returns the shape's logical dimensions.
+        (WebCore::ExclusionShapeInfo::dirtyShapeSize): Mark the shape for recomputation.
+        (WebCore::ExclusionShapeInfo::owner): The renderer to which this info belongs.
+        (WebCore::ExclusionShapeInfo::ExclusionShapeInfo): Constructor.
+        (WebCore::ExclusionShapeInfo::floatLogicalTopToLayoutUnit/floatLogicalBottomToLayoutUnit):
+        Helper methods that round float units from ExclusionShapes to LayoutUnits for layout.
+        * rendering/ExclusionShapeInsideInfo.cpp:
+        (WebCore::ExclusionShapeInsideInfo::computeSegmentsForLine): Modified to use
+        computedShape() rather than m_shape.
+        (WebCore::ExclusionShapeInsideInfo::adjustLogicalLineTop): Ditto.
+        * rendering/ExclusionShapeInsideInfo.h:
+        (WebCore::ExclusionShapeInsideInfo::createInfo): Renamed to match MappedInfo.
+        (WebCore::ExclusionShapeInsideInfo::isEnabledFor): Renamed to match shorter naming.
+        (WebCore::ExclusionShapeInsideInfo::lineOverlapsShapeBounds): Modified to use
+        computedShape().
+        * rendering/ExclusionShapeOutsideInfo.cpp:
+        (WebCore::ExclusionShapeOutsideInfo::isEnabledFor): Renamed to match shorter naming.
+        * rendering/ExclusionShapeOutsideInfo.h:
+        (WebCore::ExclusionShapeOutsideInfo::createInfo): Renamed to match MappedInfo.
+        (WebCore::ExclusionShapeOutsideInfo::ExclusionShapeOutsideInfo): Constructor.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::willBeDestroyed): Use shortened MappedInfo names for looking
+        up infos.
+        (WebCore::RenderBlock::exclusionShapeInsideInfo): Ditto.
+        (WebCore::RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange): Ditto.
+        (WebCore::RenderBlock::computeExclusionShapeSize): Ditto.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::willBeDestroyed): Ditto.
+        (WebCore::RenderBox::updateExclusionShapeOutsideInfoAfterStyleChange): Ditto.
+        * rendering/RenderBox.h:
+        (WebCore):
+        (WebCore::RenderBox::exclusionShapeOutsideInfo): Ditto.
+
 2013-01-28  Stephen Chenney  <schenney@chromium.org>
 
         SVGViewSpec fails when corresponding element has been removed
index 5fcfa9881c93e63d8b7325300e231ea7f747c80e..e4c81f3e2329dc8f61311426bbcdc1c66d3870b2 100644 (file)
@@ -4300,6 +4300,8 @@ webcore_sources += \
        Source/WebCore/rendering/ExclusionRectangle.h \
        Source/WebCore/rendering/ExclusionShape.cpp \
        Source/WebCore/rendering/ExclusionShape.h \
+       Source/WebCore/rendering/ExclusionShapeInfo.cpp \
+       Source/WebCore/rendering/ExclusionShapeInfo.h \
        Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp \
        Source/WebCore/rendering/ExclusionShapeInsideInfo.h \
        Source/WebCore/rendering/ExclusionShapeOutsideInfo.cpp \
index 2998c9d514d7d52b1c9badbcec976c5ea33b3446..531386b5abd2744e98273adabf77b95e12c908fe 100644 (file)
@@ -1145,6 +1145,7 @@ SOURCES += \
     rendering/ExclusionPolygon.cpp \
     rendering/ExclusionRectangle.cpp \
     rendering/ExclusionShape.cpp \
+    rendering/ExclusionShapeInfo.cpp \
     rendering/ExclusionShapeInsideInfo.cpp \
     rendering/ExclusionShapeOutsideInfo.cpp \
     rendering/FilterEffectRenderer.cpp \
@@ -2399,6 +2400,7 @@ HEADERS += \
     rendering/ExclusionPolygon.h \
     rendering/ExclusionRectangle.h \
     rendering/ExclusionShape.h \
+    rendering/ExclusionShapeInfo.h \
     rendering/ExclusionShapeInsideInfo.h \
     rendering/ExclusionShapeOutsideInfo.h \
     rendering/FilterEffectRenderer.h \
index d54e8da1a56b8f46066eeca36e71f9e5f7e80341..6cedd9ffbdc587251030d5c5684c36cf3f2f0c2c 100644 (file)
             'rendering/ExclusionRectangle.h',
             'rendering/ExclusionShape.cpp',
             'rendering/ExclusionShape.h',
+            'rendering/ExclusionShapeInfo.cpp',
+            'rendering/ExclusionShapeInfo.h',
             'rendering/ExclusionShapeInsideInfo.cpp',
             'rendering/ExclusionShapeInsideInfo.h',
             'rendering/ExclusionShapeOutsideInfo.cpp',
index 826cfa4b3c9d1e1774bacaa58f20032bce26c840..12944a5811c4272fed22227cb215c5a9980adb50 100755 (executable)
                                RelativePath="..\rendering\ExclusionShape.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\rendering\ExclusionShapeInfo.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\rendering\ExclusionShapeInfo.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\rendering\ExclusionShapeInsideInfo.cpp"
                                >
index 47d3a0b1a1d18713859c4302d9dc1480ec640c0e..0c7499e88b464f2ac883d7b4efff4fd145669ef2 100644 (file)
                FDB052E01561A42C00B500D6 /* AudioSummingJunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FDB052DE1561A42C00B500D6 /* AudioSummingJunction.h */; };
                FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDB1700314A2BAB200A2B5D9 /* MultiChannelResampler.cpp */; };
                FDB1700614A2BAB200A2B5D9 /* MultiChannelResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = FDB1700414A2BAB200A2B5D9 /* MultiChannelResampler.h */; };
+               FDB8D1DA16B0C0D700340F10 /* ExclusionShapeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDB8D1D916B0C0D700340F10 /* ExclusionShapeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               FDB8D1E516B0CC9700340F10 /* ExclusionShapeInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDB8D1DB16B0C0F600340F10 /* ExclusionShapeInfo.cpp */; };
                FDBD1DFC167FE27D0051A11E /* JSOscillatorNodeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */; };
                FDBD480C159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDBD480A159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp */; };
                FDBD480D159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FDBD480B159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h */; };
                FDB052DE1561A42C00B500D6 /* AudioSummingJunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSummingJunction.h; sourceTree = "<group>"; };
                FDB1700314A2BAB200A2B5D9 /* MultiChannelResampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiChannelResampler.cpp; sourceTree = "<group>"; };
                FDB1700414A2BAB200A2B5D9 /* MultiChannelResampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiChannelResampler.h; sourceTree = "<group>"; };
+               FDB8D1D916B0C0D700340F10 /* ExclusionShapeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExclusionShapeInfo.h; sourceTree = "<group>"; };
+               FDB8D1DB16B0C0F600340F10 /* ExclusionShapeInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExclusionShapeInfo.cpp; sourceTree = "<group>"; };
                FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOscillatorNodeCustom.cpp; sourceTree = "<group>"; };
                FDBD480A159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamAudioSourceNode.cpp; sourceTree = "<group>"; };
                FDBD480B159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaStreamAudioSourceNode.h; sourceTree = "<group>"; };
                                6E8798B715F81E4A00BFE4AA /* ExclusionRectangle.h */,
                                6E8798B815F81E4A00BFE4AA /* ExclusionShape.cpp */,
                                6E8798B915F81E4A00BFE4AA /* ExclusionShape.h */,
+                               FDB8D1DB16B0C0F600340F10 /* ExclusionShapeInfo.cpp */,
+                               FDB8D1D916B0C0D700340F10 /* ExclusionShapeInfo.h */,
                                FD748ABD15BF74ED0059CF0D /* ExclusionShapeInsideInfo.cpp */,
                                FD748ABE15BF74ED0059CF0D /* ExclusionShapeInsideInfo.h */,
                                9A9CEF8B163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp */,
                                6EAF34101613869A00859625 /* ExclusionPolygon.h in Headers */,
                                6E8798BD15F81E4A00BFE4AA /* ExclusionRectangle.h in Headers */,
                                6E8798BF15F81E4A00BFE4AA /* ExclusionShape.h in Headers */,
+                               FDB8D1DA16B0C0D700340F10 /* ExclusionShapeInfo.h in Headers */,
                                FD748AC015BF74ED0059CF0D /* ExclusionShapeInsideInfo.h in Headers */,
                                9A9CEF8E163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.h in Headers */,
                                FD1AF1501656F15100C6D4F7 /* ExclusionShapeValue.h in Headers */,
                                6EAF340F1613869A00859625 /* ExclusionPolygon.cpp in Sources */,
                                6E8798BC15F81E4A00BFE4AA /* ExclusionRectangle.cpp in Sources */,
                                6E8798BE15F81E4A00BFE4AA /* ExclusionShape.cpp in Sources */,
+                               FDB8D1E516B0CC9700340F10 /* ExclusionShapeInfo.cpp in Sources */,
                                FD748ABF15BF74ED0059CF0D /* ExclusionShapeInsideInfo.cpp in Sources */,
                                9A9CEF8D163B3EA100DE7EFE /* ExclusionShapeOutsideInfo.cpp in Sources */,
                                6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
diff --git a/Source/WebCore/rendering/ExclusionShapeInfo.cpp b/Source/WebCore/rendering/ExclusionShapeInfo.cpp
new file mode 100644 (file)
index 0000000..fe1a782
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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 "ExclusionShapeInfo.h"
+
+#if ENABLE(CSS_EXCLUSIONS)
+
+#include "ExclusionShape.h"
+#include "RenderBlock.h"
+#include "RenderBox.h"
+#include "RenderStyle.h"
+
+namespace WebCore {
+template <class RenderType, ExclusionShapeValue* (RenderStyle::*shapeGetter)() const>
+const ExclusionShape* ExclusionShapeInfo<RenderType, shapeGetter>::computedShape() const
+{
+    if (ExclusionShape* exclusionShape = m_shape.get())
+        return exclusionShape;
+
+    ExclusionShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)();
+    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
+
+    ASSERT(shape);
+
+    m_shape = ExclusionShape::createExclusionShape(shape, m_logicalWidth, m_logicalHeight, m_renderer->style()->writingMode());
+    ASSERT(m_shape);
+    return m_shape.get();
+}
+
+template class ExclusionShapeInfo<RenderBlock, &RenderStyle::shapeInside>;
+template class ExclusionShapeInfo<RenderBox, &RenderStyle::shapeOutside>;
+}
+#endif
diff --git a/Source/WebCore/rendering/ExclusionShapeInfo.h b/Source/WebCore/rendering/ExclusionShapeInfo.h
new file mode 100644 (file)
index 0000000..bd0a66a
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+* Copyright (C) 2012 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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.
+*/
+
+#ifndef ExclusionShapeInfo_h
+#define ExclusionShapeInfo_h
+
+#if ENABLE(CSS_EXCLUSIONS)
+
+#include "ExclusionShape.h"
+#include "ExclusionShapeValue.h"
+#include "FloatRect.h"
+#include "LayoutUnit.h"
+#include "RenderStyle.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+template<class KeyType, class InfoType>
+class MappedInfo {
+public:
+    static InfoType* ensureInfo(const KeyType* key)
+    {
+        InfoMap& infoMap = MappedInfo<KeyType, InfoType>::infoMap();
+        if (InfoType* info = infoMap.get(key))
+            return info;
+        typename InfoMap::AddResult result = infoMap.add(key, InfoType::createInfo(key));
+        return result.iterator->value.get();
+    }
+    static void removeInfo(const KeyType* key) { infoMap().remove(key); }
+    static InfoType* info(const KeyType* key) { return infoMap().get(key); }
+private:
+    typedef HashMap<const KeyType*, OwnPtr<InfoType> > InfoMap;
+    static InfoMap& infoMap()
+    {
+        DEFINE_STATIC_LOCAL(InfoMap, staticInfoMap, ());
+        return staticInfoMap;
+    }
+};
+
+template <class RenderType, ExclusionShapeValue* (RenderStyle::*shapeGetter)() const>
+class ExclusionShapeInfo {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ~ExclusionShapeInfo() { }
+
+    void setShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight)
+    {
+        if (m_logicalWidth == logicalWidth && m_logicalHeight == logicalHeight)
+            return;
+        dirtyShapeSize();
+        m_logicalWidth = logicalWidth;
+        m_logicalHeight = logicalHeight;
+    }
+
+    LayoutUnit shapeLogicalTop() const { return floatLogicalTopToLayoutUnit(computedShape()->shapeLogicalBoundingBox().y()); }
+    LayoutUnit shapeLogicalBottom() const { return floatLogicalBottomToLayoutUnit(computedShape()->shapeLogicalBoundingBox().maxY()); }
+    LayoutUnit shapeLogicalLeft() const { return computedShape()->shapeLogicalBoundingBox().x(); }
+    LayoutUnit shapeLogicalRight() const { return computedShape()->shapeLogicalBoundingBox().y(); }
+    LayoutUnit shapeLogicalWidth() const { return computedShape()->shapeLogicalBoundingBox().width(); }
+    LayoutUnit shapeLogicalHeight() const { return computedShape()->shapeLogicalBoundingBox().height(); }
+
+    void dirtyShapeSize() { m_shape.clear(); }
+    const RenderType* owner() const { return m_renderer; }
+
+protected:
+    ExclusionShapeInfo(const RenderType* renderer): m_renderer(renderer) { }
+
+    const ExclusionShape* computedShape() const;
+
+    // Use ceil and floor to ensure that the returned LayoutUnit value is within the shape's bounds.
+    LayoutUnit floatLogicalTopToLayoutUnit(float logicalTop) const { return LayoutUnit::fromFloatCeil(logicalTop); }
+    LayoutUnit floatLogicalBottomToLayoutUnit(float logicalBottom) const { return LayoutUnit::fromFloatFloor(logicalBottom); }
+
+private:
+    mutable OwnPtr<ExclusionShape> m_shape;
+
+    LayoutUnit m_logicalWidth;
+    LayoutUnit m_logicalHeight;
+    const RenderType* m_renderer;
+};
+}
+#endif
+#endif
index e7609899f44081d559b66ab5e628cdb1860723f1..467154cf697f5f937541a5f77fca84982551ffd6 100644 (file)
 
 #if ENABLE(CSS_EXCLUSIONS)
 
-#include "NotImplemented.h"
 #include "RenderBlock.h"
-#include <wtf/HashMap.h>
-#include <wtf/OwnPtr.h>
 
 namespace WebCore {
-
-typedef HashMap<const RenderBlock*, OwnPtr<ExclusionShapeInsideInfo> > ExclusionShapeInsideInfoMap;
-
-static ExclusionShapeInsideInfoMap& exclusionShapeInsideInfoMap()
-{
-    DEFINE_STATIC_LOCAL(ExclusionShapeInsideInfoMap, staticExclusionShapeInsideInfoMap, ());
-    return staticExclusionShapeInsideInfoMap;
-}
-
-ExclusionShapeInsideInfo::ExclusionShapeInsideInfo(RenderBlock* block)
-    : m_block(block)
-    , m_shapeSizeDirty(true)
-{
-}
-
-ExclusionShapeInsideInfo::~ExclusionShapeInsideInfo()
-{
-}
-
-ExclusionShapeInsideInfo* ExclusionShapeInsideInfo::ensureExclusionShapeInsideInfoForRenderBlock(RenderBlock* block)
-{
-    ExclusionShapeInsideInfoMap::AddResult result = exclusionShapeInsideInfoMap().add(block, create(block));
-    return result.iterator->value.get();
-}
-
-ExclusionShapeInsideInfo* ExclusionShapeInsideInfo::exclusionShapeInsideInfoForRenderBlock(const RenderBlock* block)
-{
-    ASSERT(block->style()->shapeInside());
-    return exclusionShapeInsideInfoMap().get(block);
-}
-
-bool ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock(const RenderBlock* block)
-{
-    // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
-    ExclusionShapeValue* shapeValue = block->style()->shapeInside();
-    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
-    return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON);
-}
-
-void ExclusionShapeInsideInfo::removeExclusionShapeInsideInfoForRenderBlock(const RenderBlock* block)
-{
-    if (!block->style() || !block->style()->shapeInside())
-        return;
-    exclusionShapeInsideInfoMap().remove(block);
-}
-
-void ExclusionShapeInsideInfo::computeShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight)
-{
-    if (!m_shapeSizeDirty && logicalWidth == m_logicalWidth && logicalHeight == m_logicalHeight)
-        return;
-
-    m_shapeSizeDirty = false;
-    m_logicalWidth = logicalWidth;
-    m_logicalHeight = logicalHeight;
-
-    // FIXME: Bug 89993: The wrap shape may come from the parent object
-    ExclusionShapeValue* shapeValue = m_block->style()->shapeInside();
-    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
-
-    ASSERT(shape);
-
-    m_shape = ExclusionShape::createExclusionShape(shape, logicalWidth, logicalHeight, m_block->style()->writingMode());
-    ASSERT(m_shape);
-}
-
 bool ExclusionShapeInsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
 {
     ASSERT(lineHeight >= 0);
@@ -112,19 +44,19 @@ bool ExclusionShapeInsideInfo::computeSegmentsForLine(LayoutUnit lineTop, Layout
     m_segmentRanges.clear();
 
     if (lineOverlapsShapeBounds()) {
-        ASSERT(m_shape);
-        m_shape->getIncludedIntervals(lineTop, std::min(lineHeight, shapeLogicalBottom() - lineTop), m_segments);
+        computedShape()->getIncludedIntervals(lineTop, std::min(lineHeight, shapeLogicalBottom() - lineTop), m_segments);
     }
     return m_segments.size();
 }
 
 bool ExclusionShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth)
 {
-    if (!m_shape || m_lineHeight <= 0 || m_lineTop > shapeLogicalBottom())
+    const ExclusionShape* shape = computedShape();
+    if (!shape || m_lineHeight <= 0 || m_lineTop > shapeLogicalBottom())
         return false;
 
     float floatNewLineTop;
-    if (m_shape->firstIncludedIntervalLogicalTop(m_lineTop, FloatSize(minSegmentWidth, m_lineHeight), floatNewLineTop)) {
+    if (shape->firstIncludedIntervalLogicalTop(m_lineTop, FloatSize(minSegmentWidth, m_lineHeight), floatNewLineTop)) {
         LayoutUnit newLineTop = floatLogicalTopToLayoutUnit(floatNewLineTop);
         if (newLineTop > m_lineTop) {
             m_lineTop = newLineTop;
index 2c1e7db535eac3a57ccbfbef9aa717b773836c3a..2b1877257992a9b856478bac406484f0943f49d7 100644 (file)
@@ -13,7 +13,7 @@
  *    disclaimer in the documentation and/or other materials
  *    provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER BE
 
 #if ENABLE(CSS_EXCLUSIONS)
 
-#include "ExclusionShape.h"
-#include "FloatRect.h"
+#include "ExclusionShapeInfo.h"
 #include "InlineIterator.h"
-#include "LayoutUnit.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 
@@ -55,26 +52,16 @@ struct LineSegmentRange {
 };
 typedef Vector<LineSegmentRange> SegmentRangeList;
 
-class ExclusionShapeInsideInfo {
-    WTF_MAKE_FAST_ALLOCATED;
+class ExclusionShapeInsideInfo : public ExclusionShapeInfo<RenderBlock, &RenderStyle::shapeInside>, public MappedInfo<RenderBlock, ExclusionShapeInsideInfo> {
 public:
-    ~ExclusionShapeInsideInfo();
+    static PassOwnPtr<ExclusionShapeInsideInfo> createInfo(const RenderBlock* renderer) { return adoptPtr(new ExclusionShapeInsideInfo(renderer)); }
 
-    static PassOwnPtr<ExclusionShapeInsideInfo> create(RenderBlock* block) { return adoptPtr(new ExclusionShapeInsideInfo(block)); }
-    static ExclusionShapeInsideInfo* exclusionShapeInsideInfoForRenderBlock(const RenderBlock*);
-    static ExclusionShapeInsideInfo* ensureExclusionShapeInsideInfoForRenderBlock(RenderBlock*);
-    static void removeExclusionShapeInsideInfoForRenderBlock(const RenderBlock*);
-    static bool isExclusionShapeInsideInfoEnabledForRenderBlock(const RenderBlock*);
-
-    LayoutUnit shapeLogicalTop() const
-    {
-        ASSERT(m_shape);
-        return floatLogicalTopToLayoutUnit(m_shape->shapeLogicalBoundingBox().y());
-    }
-    LayoutUnit shapeLogicalBottom() const
+    static bool isEnabledFor(const RenderBlock* renderer)
     {
-        ASSERT(m_shape);
-        return floatLogicalBottomToLayoutUnit(m_shape->shapeLogicalBoundingBox().maxY());
+        // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
+        ExclusionShapeValue* shapeValue = renderer->style()->shapeInside();
+        BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
+        return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON);
     }
     bool lineOverlapsShapeBounds() const { return m_lineTop < shapeLogicalBottom() && m_lineTop + m_lineHeight >= shapeLogicalTop(); }
 
@@ -98,30 +85,16 @@ public:
     }
     bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight);
     bool adjustLogicalLineTop(float minSegmentWidth);
-    void computeShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight);
-    void dirtyShapeSize() { m_shapeSizeDirty = true; }
-
     LayoutUnit logicalLineTop() const { return m_lineTop; }
-    RenderBlock* ownerBlock() const { return m_block; }
 
 private:
-    ExclusionShapeInsideInfo(RenderBlock*);
-
-    // Use ceil and floor to ensure that the returned LayoutUnit value is within the shape's bounds.
-    LayoutUnit floatLogicalTopToLayoutUnit(float logicalTop) const { return LayoutUnit::fromFloatCeil(logicalTop); }
-    LayoutUnit floatLogicalBottomToLayoutUnit(float logicalBottom) const { return LayoutUnit::fromFloatFloor(logicalBottom); }
-
-    RenderBlock* m_block;
-    OwnPtr<ExclusionShape> m_shape;
+    ExclusionShapeInsideInfo(const RenderBlock* renderer) : ExclusionShapeInfo<RenderBlock, &RenderStyle::shapeInside>(renderer) { }
 
     LayoutUnit m_lineTop;
     LayoutUnit m_lineHeight;
-    LayoutUnit m_logicalWidth;
-    LayoutUnit m_logicalHeight;
 
     SegmentList m_segments;
     SegmentRangeList m_segmentRanges;
-    bool m_shapeSizeDirty;
 };
 
 }
index 0353cbb8899743f293f5e0e872019e8b0ca663cf..87fa8c6b309bdfa37d5de6c056d74fade22887c2 100644 (file)
 #include "ExclusionShapeOutsideInfo.h"
 
 #include "RenderBox.h"
-#include <wtf/HashMap.h>
 
 namespace WebCore {
-
-typedef HashMap<const RenderBox*, OwnPtr<ExclusionShapeOutsideInfo> > ExclusionShapeOutsideInfoMap;
-
-static ExclusionShapeOutsideInfoMap& exclusionShapeOutsideInfoMap()
-{
-    DEFINE_STATIC_LOCAL(ExclusionShapeOutsideInfoMap, staticExclusionShapeOutsideInfoMap, ());
-    return staticExclusionShapeOutsideInfoMap;
-}
-
-ExclusionShapeOutsideInfo::ExclusionShapeOutsideInfo(RenderBox* box)
-    : m_box(box)
-    , m_logicalWidth(0)
-    , m_logicalHeight(0)
-{
-}
-
-ExclusionShapeOutsideInfo::~ExclusionShapeOutsideInfo()
-{
-}
-
-ExclusionShapeOutsideInfo* ExclusionShapeOutsideInfo::ensureInfoForRenderBox(RenderBox* box)
-{
-    ExclusionShapeOutsideInfoMap& infoMap = exclusionShapeOutsideInfoMap();
-    if (ExclusionShapeOutsideInfo* shapeInfo = infoMap.get(box))
-        return shapeInfo;
-
-    ExclusionShapeOutsideInfoMap::AddResult result = infoMap.add(box, create(box));
-    return result.iterator->value.get();
-}
-
-ExclusionShapeOutsideInfo* ExclusionShapeOutsideInfo::infoForRenderBox(const RenderBox* box)
-{
-    ASSERT(box->style()->shapeOutside());
-    return exclusionShapeOutsideInfoMap().get(box);
-}
-
-bool ExclusionShapeOutsideInfo::isInfoEnabledForRenderBox(const RenderBox* box)
+bool ExclusionShapeOutsideInfo::isEnabledFor(const RenderBox* box)
 {
     // FIXME: Enable shape outside for non-rectangular shapes! (bug 98664)
     ExclusionShapeValue* value = box->style()->shapeOutside();
     return value && (value->type() == ExclusionShapeValue::SHAPE) && (value->shape()->type() == BasicShape::BASIC_SHAPE_RECTANGLE);
 }
 
-void ExclusionShapeOutsideInfo::removeInfoForRenderBox(const RenderBox* box)
-{
-    exclusionShapeOutsideInfoMap().remove(box);
-}
-
-const ExclusionShape* ExclusionShapeOutsideInfo::computedShape() const
-{
-    if (ExclusionShape* shapeOutside = m_computedShape.get())
-        return shapeOutside;
-
-    ExclusionShapeValue* basicShapeValue = m_box->style()->shapeOutside();
-    ASSERT(basicShapeValue);
-    ASSERT(basicShapeValue->type() == ExclusionShapeValue::SHAPE);
-
-    m_computedShape = ExclusionShape::createExclusionShape(basicShapeValue->shape(), m_logicalWidth, m_logicalHeight, m_box->style()->writingMode());
-    return m_computedShape.get();
-}
-
 }
 #endif
index 53a00713d42dba64d1364a732727c215d202ea38..0f6c91eb73879110753ad9f0806663d09e8c91e8 100644 (file)
 
 #if ENABLE(CSS_EXCLUSIONS)
 
-#include "ExclusionShape.h"
-#include "FloatRect.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include "ExclusionShapeInfo.h"
 
 namespace WebCore {
 
 class RenderBox;
 
-class ExclusionShapeOutsideInfo {
-    WTF_MAKE_NONCOPYABLE(ExclusionShapeOutsideInfo); WTF_MAKE_FAST_ALLOCATED;
+class ExclusionShapeOutsideInfo : public ExclusionShapeInfo<RenderBox, &RenderStyle::shapeOutside>, public MappedInfo<RenderBox, ExclusionShapeOutsideInfo> {
 public:
-    ~ExclusionShapeOutsideInfo();
-
-    static PassOwnPtr<ExclusionShapeOutsideInfo> create(RenderBox* box) { return adoptPtr(new ExclusionShapeOutsideInfo(box)); }
-    static ExclusionShapeOutsideInfo* infoForRenderBox(const RenderBox*);
-    static ExclusionShapeOutsideInfo* ensureInfoForRenderBox(RenderBox*);
-    static void removeInfoForRenderBox(const RenderBox*);
-    static bool isInfoEnabledForRenderBox(const RenderBox*);
-
-    LayoutUnit shapeLogicalLeft() const
-    { 
-        return computedShape()->shapeLogicalBoundingBox().x();
-    }
-    LayoutUnit shapeLogicalRight() const
-    { 
-        return computedShape()->shapeLogicalBoundingBox().maxX();
-    }
-    LayoutUnit shapeLogicalTop() const
-    { 
-        return LayoutUnit::fromFloatCeil(computedShape()->shapeLogicalBoundingBox().y());
-    }
-    LayoutUnit shapeLogicalBottom() const
-    {
-        return LayoutUnit::fromFloatFloor(computedShape()->shapeLogicalBoundingBox().maxY());
-    }
-    LayoutUnit shapeLogicalWidth() const
-    { 
-        return computedShape()->shapeLogicalBoundingBox().width();
-    }
-    LayoutUnit shapeLogicalHeight() const
-    {
-        return computedShape()->shapeLogicalBoundingBox().height();
-    }
-
-    void setShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight)
-    {
-        if (m_logicalWidth == logicalWidth && m_logicalHeight == logicalHeight)
-            return;
-
-        dirtyShapeSize();
-        m_logicalWidth = logicalWidth;
-        m_logicalHeight = logicalHeight;
-    }
-
-    void dirtyShapeSize() { m_computedShape.clear(); }
-
+    static PassOwnPtr<ExclusionShapeOutsideInfo> createInfo(const RenderBox* renderer) { return adoptPtr(new ExclusionShapeOutsideInfo(renderer)); }
+    static bool isEnabledFor(const RenderBox*);
 private:
-    explicit ExclusionShapeOutsideInfo(RenderBox*);
-    const ExclusionShape* computedShape() const;
-
-    RenderBox* m_box;
-    mutable OwnPtr<ExclusionShape> m_computedShape;
-
-    LayoutUnit m_logicalWidth;
-    LayoutUnit m_logicalHeight;
+    ExclusionShapeOutsideInfo(const RenderBox* renderer) : ExclusionShapeInfo<RenderBox, &RenderStyle::shapeOutside>(renderer) { }
 };
 
 }
index 9c375fa360e0371dbf94881c47e5dcb375ab1452..ac8001de5785e0bbeb4bb4a4991a39bef40de257 100644 (file)
@@ -291,7 +291,7 @@ void RenderBlock::willBeDestroyed()
         lineGridBox()->destroy(renderArena());
 
 #if ENABLE(CSS_EXCLUSIONS)
-    ExclusionShapeInsideInfo::removeExclusionShapeInsideInfoForRenderBlock(this);
+    ExclusionShapeInsideInfo::removeInfo(this);
 #endif
 
     if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
@@ -1371,7 +1371,7 @@ void RenderBlock::layout()
 #if ENABLE(CSS_EXCLUSIONS)
 ExclusionShapeInsideInfo* RenderBlock::exclusionShapeInsideInfo() const
 {
-    return style()->shapeInside() && ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock(this) ? ExclusionShapeInsideInfo::exclusionShapeInsideInfoForRenderBlock(this) : 0;
+    return style()->shapeInside() && ExclusionShapeInsideInfo::isEnabledFor(this) ? ExclusionShapeInsideInfo::info(this) : 0;
 }
 
 void RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange(const ExclusionShapeValue* shapeInside, const ExclusionShapeValue* oldShapeInside)
@@ -1381,10 +1381,10 @@ void RenderBlock::updateExclusionShapeInsideInfoAfterStyleChange(const Exclusion
         return;
 
     if (shapeInside) {
-        ExclusionShapeInsideInfo* exclusionShapeInsideInfo = ExclusionShapeInsideInfo::ensureExclusionShapeInsideInfoForRenderBlock(this);
+        ExclusionShapeInsideInfo* exclusionShapeInsideInfo = ExclusionShapeInsideInfo::ensureInfo(this);
         exclusionShapeInsideInfo->dirtyShapeSize();
     } else
-        ExclusionShapeInsideInfo::removeExclusionShapeInsideInfoForRenderBlock(this);
+        ExclusionShapeInsideInfo::removeInfo(this);
 }
 #endif
 
@@ -1423,7 +1423,7 @@ void RenderBlock::computeExclusionShapeSize()
     ExclusionShapeInsideInfo* exclusionShapeInsideInfo = this->exclusionShapeInsideInfo();
     if (exclusionShapeInsideInfo) {
         bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvableFromBlock(this, false);
-        exclusionShapeInsideInfo->computeShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : LayoutUnit());
+        exclusionShapeInsideInfo->setShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : LayoutUnit());
     }
 }
 #endif
index fbb3ddba99066cb3817a0a945ae82d4ec54290d2..011fe26da894a9268e12003ba12b8428ebdcfea7 100644 (file)
@@ -1495,7 +1495,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin
     LayoutUnit absoluteLogicalTop;
     ExclusionShapeInsideInfo* exclusionShapeInsideInfo = layoutExclusionShapeInsideInfo(this);
     if (exclusionShapeInsideInfo) {
-        ASSERT(exclusionShapeInsideInfo->ownerBlock() == this || allowsExclusionShapeInsideInfoSharing());
+        ASSERT(exclusionShapeInsideInfo->owner() == this || allowsExclusionShapeInsideInfoSharing());
         if (exclusionShapeInsideInfo != this->exclusionShapeInsideInfo()) {
             // FIXME Bug 100284: If subsequent LayoutStates are pushed, we will have to add
             // their offsets from the original shape-inside container.
index eb8d14f0b53671c1d109b815ebeb96dbf2a180c5..d21e408f0fb49d32fadca4075fef52db74a00ea1 100644 (file)
@@ -160,7 +160,7 @@ void RenderBox::willBeDestroyed()
     RenderBlock::removePercentHeightDescendantIfNeeded(this);
 
 #if ENABLE(CSS_EXCLUSIONS)
-    ExclusionShapeOutsideInfo::removeInfoForRenderBox(this);
+    ExclusionShapeOutsideInfo::removeInfo(this);
 #endif
 
     RenderBoxModelObject::willBeDestroyed();
@@ -330,10 +330,10 @@ void RenderBox::updateExclusionShapeOutsideInfoAfterStyleChange(const ExclusionS
         return;
 
     if (shapeOutside) {
-        ExclusionShapeOutsideInfo* exclusionShapeOutsideInfo = ExclusionShapeOutsideInfo::ensureInfoForRenderBox(this);
+        ExclusionShapeOutsideInfo* exclusionShapeOutsideInfo = ExclusionShapeOutsideInfo::ensureInfo(this);
         exclusionShapeOutsideInfo->dirtyShapeSize();
     } else
-        ExclusionShapeOutsideInfo::removeInfoForRenderBox(this);
+        ExclusionShapeOutsideInfo::removeInfo(this);
 }
 #endif
 
index 330af827e9eecf71a4084af348aa46276b7edf4d..cad21ff059de14f9fff162b616b5ca783cb9a3b2 100644 (file)
@@ -584,7 +584,7 @@ public:
 #if ENABLE(CSS_EXCLUSIONS)
     ExclusionShapeOutsideInfo* exclusionShapeOutsideInfo() const
     {
-        return style()->shapeOutside() && ExclusionShapeOutsideInfo::isInfoEnabledForRenderBox(this) ? ExclusionShapeOutsideInfo::infoForRenderBox(this) : 0;
+        return style()->shapeOutside() && ExclusionShapeOutsideInfo::isEnabledFor(this) ? ExclusionShapeOutsideInfo::info(this) : 0;
     }
 #endif