Title: [158736] trunk/Source/WebCore
Revision
158736
Author
[email protected]
Date
2013-11-06 02:26:56 -0800 (Wed, 06 Nov 2013)

Log Message

Add InlineElementBox and stop instantiating InlineBox directly.
<https://webkit.org/b/123882>

Make the InlineBox constructors protected and add a new class
called InlineElementBox on top. This is somewhat analogous to the
split between RenderText and RenderElement, and allows us to make
renderer() return a far tighter RenderBoxModelObject& instead
of a RenderObject&.

Moved over attachLine(), deleteLine() and extractLine() to start
things off. More things will follow.

Reviewed by Antti Koivisto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (158735 => 158736)


--- trunk/Source/WebCore/CMakeLists.txt	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-11-06 10:26:56 UTC (rev 158736)
@@ -2081,6 +2081,7 @@
     rendering/HitTestingTransformState.cpp
     rendering/ImageQualityController.cpp
     rendering/InlineBox.cpp
+    rendering/InlineElementBox.cpp
     rendering/InlineFlowBox.cpp
     rendering/InlineTextBox.cpp
     rendering/LayoutRepainter.cpp

Modified: trunk/Source/WebCore/ChangeLog (158735 => 158736)


--- trunk/Source/WebCore/ChangeLog	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/ChangeLog	2013-11-06 10:26:56 UTC (rev 158736)
@@ -1,3 +1,19 @@
+2013-11-06  Andreas Kling  <[email protected]>
+
+        Add InlineElementBox and stop instantiating InlineBox directly.
+        <https://webkit.org/b/123882>
+
+        Make the InlineBox constructors protected and add a new class
+        called InlineElementBox on top. This is somewhat analogous to the
+        split between RenderText and RenderElement, and allows us to make
+        renderer() return a far tighter RenderBoxModelObject& instead
+        of a RenderObject&.
+
+        Moved over attachLine(), deleteLine() and extractLine() to start
+        things off. More things will follow.
+
+        Reviewed by Antti Koivisto.
+
 2013-11-06  Piotr Grad  <[email protected]>
 
         Seek for video doesn't work when playback rate is negative

Modified: trunk/Source/WebCore/GNUmakefile.list.am (158735 => 158736)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-11-06 10:26:56 UTC (rev 158736)
@@ -4278,6 +4278,8 @@
 	Source/WebCore/rendering/ImageQualityController.h \
 	Source/WebCore/rendering/InlineBox.cpp \
 	Source/WebCore/rendering/InlineBox.h \
+	Source/WebCore/rendering/InlineElementBox.cpp \
+	Source/WebCore/rendering/InlineElementBox.h \
 	Source/WebCore/rendering/InlineFlowBox.cpp \
 	Source/WebCore/rendering/InlineFlowBox.h \
 	Source/WebCore/rendering/InlineIterator.h \

Modified: trunk/Source/WebCore/WebCore.exp.in (158735 => 158736)


--- trunk/Source/WebCore/WebCore.exp.in	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-11-06 10:26:56 UTC (rev 158736)
@@ -1323,8 +1323,6 @@
 __ZN7WebCore9HTMLNames9selectTagE
 __ZN7WebCore9HTMLNames9styleAttrE
 __ZN7WebCore9HTMLNames9valueAttrE
-__ZN7WebCore9InlineBox10attachLineEv
-__ZN7WebCore9InlineBox11extractLineEv
 __ZN7WebCore9InlineBox11nodeAtPointERKNS_14HitTestRequestERNS_13HitTestResultERKNS_15HitTestLocationERKNS_11LayoutPointENS_10LayoutUnitESC_
 __ZN7WebCore9InlineBox14adjustPositionEff
 __ZN7WebCore9InlineBox14dirtyLineBoxesEv

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (158735 => 158736)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-11-06 10:26:56 UTC (rev 158736)
@@ -9478,6 +9478,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\rendering\InlineElementBox.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\rendering\InlineFlowBox.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -19560,6 +19574,7 @@
     <ClInclude Include="..\rendering\HitTestResult.h" />
     <ClInclude Include="..\rendering\ImageQualityController.h" />
     <ClInclude Include="..\rendering\InlineBox.h" />
+    <ClInclude Include="..\rendering\InlineElementBox.h" />
     <ClInclude Include="..\rendering\InlineFlowBox.h" />
     <ClInclude Include="..\rendering\InlineIterator.h" />
     <ClInclude Include="..\rendering\InlineTextBox.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (158735 => 158736)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-11-06 10:26:56 UTC (rev 158736)
@@ -2385,6 +2385,9 @@
     <ClCompile Include="..\rendering\InlineBox.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
+    <ClCompile Include="..\rendering\InlineElementBox.cpp">
+      <Filter>rendering</Filter>
+    </ClCompile>
     <ClCompile Include="..\rendering\InlineFlowBox.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
@@ -9253,6 +9256,9 @@
     <ClInclude Include="..\rendering\InlineBox.h">
       <Filter>rendering</Filter>
     </ClInclude>
+    <ClInclude Include="..\rendering\InlineElementBox.h">
+      <Filter>rendering</Filter>
+    </ClInclude>
     <ClInclude Include="..\rendering\InlineFlowBox.h">
       <Filter>rendering</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (158735 => 158736)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-11-06 10:26:56 UTC (rev 158736)
@@ -4657,6 +4657,8 @@
 		B562DB6117D3CD660010AF96 /* SVGElementTypeHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = B562DB5F17D3CD560010AF96 /* SVGElementTypeHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B56576E817DA94E200A56BDC /* DOMConstructorWithDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B56576E717DA94E200A56BDC /* DOMConstructorWithDocument.h */; };
 		B56579B51824D12A00E79F23 /* RenderChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = B56579B41824D12A00E79F23 /* RenderChildIterator.h */; };
+		B57CB52D182A3EED0079A647 /* InlineElementBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B57CB52C182A3EED0079A647 /* InlineElementBox.cpp */; };
+		B57CB52E182A3EFC0079A647 /* InlineElementBox.h in Headers */ = {isa = PBXBuildFile; fileRef = B57CB52B182A37F60079A647 /* InlineElementBox.h */; };
 		B58CEB6911913607002A6790 /* JSDatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6711913607002A6790 /* JSDatabaseSync.h */; };
 		B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */; };
 		B58CEB6D1191361C002A6790 /* JSSQLTransactionSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */; };
@@ -11598,6 +11600,8 @@
 		B56576E417DA599F00A56BDC /* JSMainThreadExecStateInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecStateInstrumentation.h; sourceTree = "<group>"; };
 		B56576E717DA94E200A56BDC /* DOMConstructorWithDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMConstructorWithDocument.h; sourceTree = "<group>"; };
 		B56579B41824D12A00E79F23 /* RenderChildIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderChildIterator.h; sourceTree = "<group>"; };
+		B57CB52B182A37F60079A647 /* InlineElementBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineElementBox.h; sourceTree = "<group>"; };
+		B57CB52C182A3EED0079A647 /* InlineElementBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineElementBox.cpp; sourceTree = "<group>"; };
 		B58CEB6711913607002A6790 /* JSDatabaseSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDatabaseSync.h; sourceTree = "<group>"; };
 		B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSync.cpp; sourceTree = "<group>"; };
 		B58CEB6B1191361C002A6790 /* JSSQLTransactionSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSync.h; sourceTree = "<group>"; };
@@ -20798,6 +20802,8 @@
 				B51A2F3E17D7D3A40072517A /* ImageQualityController.h */,
 				A8CFF5DF0A155A05000A4234 /* InlineBox.cpp */,
 				A8CFF5DE0A155A05000A4234 /* InlineBox.h */,
+				B57CB52C182A3EED0079A647 /* InlineElementBox.cpp */,
+				B57CB52B182A37F60079A647 /* InlineElementBox.h */,
 				A8CFF5DD0A155A05000A4234 /* InlineFlowBox.cpp */,
 				A8CFF5DC0A155A05000A4234 /* InlineFlowBox.h */,
 				BCE789151120D6080060ECE5 /* InlineIterator.h */,
@@ -24599,6 +24605,7 @@
 				B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
 				088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
 				081DD49C13BA1A6000DC7627 /* SVGPropertyInfo.h in Headers */,
+				B57CB52E182A3EFC0079A647 /* InlineElementBox.h in Headers */,
 				088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */,
 				088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */,
 				B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
@@ -27017,6 +27024,7 @@
 				F5973DE115CFB2030027F804 /* LocaleMac.mm in Sources */,
 				7633A72713D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp in Sources */,
 				C046E1AC1208A9FE00BA2CF7 /* LocalizedStrings.cpp in Sources */,
+				B57CB52D182A3EED0079A647 /* InlineElementBox.cpp in Sources */,
 				BC25B52A131C6D3900180E10 /* LocalizedStringsMac.cpp in Sources */,
 				BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */,
 				078E090817D14CEE00420AA1 /* RTCDTMFToneChangeEvent.cpp in Sources */,

Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (158735 => 158736)


--- trunk/Source/WebCore/rendering/EllipsisBox.cpp	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp	2013-11-06 10:26:56 UTC (rev 158736)
@@ -32,7 +32,7 @@
 namespace WebCore {
 
 EllipsisBox::EllipsisBox(RenderBlockFlow& renderer, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox)
-    : InlineBox(renderer, FloatPoint(0, y), width, firstLine, true, false, false, isVertical, 0, 0, parent)
+    : InlineElementBox(renderer, FloatPoint(0, y), width, firstLine, true, false, false, isVertical, 0, 0, parent)
     , m_shouldPaintMarkupBox(markupBox)
     , m_height(height)
     , m_str(ellipsisStr)

Modified: trunk/Source/WebCore/rendering/EllipsisBox.h (158735 => 158736)


--- trunk/Source/WebCore/rendering/EllipsisBox.h	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/EllipsisBox.h	2013-11-06 10:26:56 UTC (rev 158736)
@@ -20,7 +20,7 @@
 #ifndef EllipsisBox_h
 #define EllipsisBox_h
 
-#include "InlineBox.h"
+#include "InlineElementBox.h"
 #include "RenderBlockFlow.h"
 
 namespace WebCore {
@@ -28,7 +28,7 @@
 class HitTestRequest;
 class HitTestResult;
 
-class EllipsisBox FINAL : public InlineBox {
+class EllipsisBox FINAL : public InlineElementBox {
 public:
     EllipsisBox(RenderBlockFlow&, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox);
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom);

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (158735 => 158736)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2013-11-06 10:26:56 UTC (rev 158736)
@@ -156,35 +156,6 @@
         curr->markDirty();
 }
 
-void InlineBox::deleteLine()
-{
-    if (!m_bitfields.extracted()) {
-        if (m_renderer.isBox())
-            toRenderBox(renderer()).setInlineBoxWrapper(0);
-        else if (renderer().isLineBreak())
-            toRenderLineBreak(renderer()).setInlineBoxWrapper(0);
-    }
-    delete this;
-}
-
-void InlineBox::extractLine()
-{
-    m_bitfields.setExtracted(true);
-    if (m_renderer.isBox())
-        toRenderBox(renderer()).setInlineBoxWrapper(0);
-    else if (renderer().isLineBreak())
-        toRenderLineBreak(renderer()).setInlineBoxWrapper(0);
-}
-
-void InlineBox::attachLine()
-{
-    m_bitfields.setExtracted(false);
-    if (m_renderer.isBox())
-        toRenderBox(renderer()).setInlineBoxWrapper(this);
-    else if (renderer().isLineBreak())
-        toRenderLineBreak(renderer()).setInlineBoxWrapper(this);
-}
-
 void InlineBox::adjustPosition(float dx, float dy)
 {
     m_topLeft.move(dx, dy);

Modified: trunk/Source/WebCore/rendering/InlineBox.h (158735 => 158736)


--- trunk/Source/WebCore/rendering/InlineBox.h	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2013-11-06 10:26:56 UTC (rev 158736)
@@ -34,38 +34,11 @@
 // some RenderObject (i.e., it represents a portion of that RenderObject).
 class InlineBox {
 public:
-    explicit InlineBox(RenderObject& renderer)
-        : m_next(0)
-        , m_prev(0)
-        , m_parent(0)
-        , m_renderer(renderer)
-        , m_logicalWidth(0)
-#if !ASSERT_DISABLED
-        , m_hasBadParent(false)
-#endif
-    {
-    }
-
-    InlineBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed,
-              bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
-        : m_next(next)
-        , m_prev(prev)
-        , m_parent(parent)
-        , m_renderer(renderer)
-        , m_topLeft(topLeft)
-        , m_logicalWidth(logicalWidth)
-        , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal)
-#if !ASSERT_DISABLED
-        , m_hasBadParent(false)
-#endif
-    {
-    }
-
     virtual ~InlineBox();
 
-    virtual void deleteLine();
-    virtual void extractLine();
-    virtual void attachLine();
+    virtual void deleteLine() = 0;
+    virtual void extractLine() = 0;
+    virtual void attachLine() = 0;
 
     virtual bool isLineBreak() const { return renderer().isLineBreak(); }
 
@@ -169,7 +142,7 @@
     InlineBox* nextLeafChildIgnoringLineBreak() const;
     InlineBox* prevLeafChildIgnoringLineBreak() const;
 
-    // FIXME: There should be a subclass that returns RenderElement. Plain InlineBox shouldn't be instantiated.
+    // FIXME: Hide this once all callers are using tighter types.
     RenderObject& renderer() const { return m_renderer; }
 
     InlineFlowBox* parent() const
@@ -387,6 +360,33 @@
     InlineBoxBitfields m_bitfields;
 
 protected:
+    explicit InlineBox(RenderObject& renderer)
+        : m_next(nullptr)
+        , m_prev(nullptr)
+        , m_parent(nullptr)
+        , m_renderer(renderer)
+        , m_logicalWidth(0)
+#if !ASSERT_DISABLED
+        , m_hasBadParent(false)
+#endif
+    {
+    }
+
+    InlineBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed,
+              bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
+        : m_next(next)
+        , m_prev(prev)
+        , m_parent(parent)
+        , m_renderer(renderer)
+        , m_topLeft(topLeft)
+        , m_logicalWidth(logicalWidth)
+        , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal)
+#if !ASSERT_DISABLED
+        , m_hasBadParent(false)
+#endif
+    {
+    }
+
     // For RootInlineBox
     bool endsWithBreak() const { return m_bitfields.endsWithBreak(); }
     void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(endsWithBreak); }

Added: trunk/Source/WebCore/rendering/InlineElementBox.cpp (0 => 158736)


--- trunk/Source/WebCore/rendering/InlineElementBox.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/InlineElementBox.cpp	2013-11-06 10:26:56 UTC (rev 158736)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2013 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 "InlineElementBox.h"
+
+#include "RenderBox.h"
+#include "RenderLineBreak.h"
+
+namespace WebCore {
+
+void InlineElementBox::deleteLine()
+{
+    if (!extracted()) {
+        if (renderer().isBox())
+            toRenderBox(renderer()).setInlineBoxWrapper(nullptr);
+        else if (renderer().isLineBreak())
+            toRenderLineBreak(renderer()).setInlineBoxWrapper(nullptr);
+    }
+    delete this;
+}
+
+void InlineElementBox::extractLine()
+{
+    setExtracted(true);
+    if (renderer().isBox())
+        toRenderBox(renderer()).setInlineBoxWrapper(nullptr);
+    else if (renderer().isLineBreak())
+        toRenderLineBreak(renderer()).setInlineBoxWrapper(nullptr);
+}
+
+void InlineElementBox::attachLine()
+{
+    setExtracted(false);
+    if (renderer().isBox())
+        toRenderBox(renderer()).setInlineBoxWrapper(this);
+    else if (renderer().isLineBreak())
+        toRenderLineBreak(renderer()).setInlineBoxWrapper(this);
+}
+
+}
\ No newline at end of file

Added: trunk/Source/WebCore/rendering/InlineElementBox.h (0 => 158736)


--- trunk/Source/WebCore/rendering/InlineElementBox.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/InlineElementBox.h	2013-11-06 10:26:56 UTC (rev 158736)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef InlineElementBox_h
+#define InlineElementBox_h
+
+#include "InlineBox.h"
+
+namespace WebCore {
+
+class InlineElementBox : public InlineBox {
+public:
+    explicit InlineElementBox(RenderBoxModelObject& renderer)
+        : InlineBox(renderer)
+    {
+    }
+
+    InlineElementBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed, bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* prev, InlineFlowBox* parent)
+        : InlineBox(renderer, topLeft, logicalWidth, firstLine, constructed, dirty, extracted, isHorizontal, next, prev, parent)
+    {
+    }
+
+    RenderBoxModelObject& renderer() const { return toRenderBoxModelObject(InlineBox::renderer()); }
+
+    virtual void deleteLine() OVERRIDE;
+    virtual void extractLine() OVERRIDE;
+    virtual void attachLine() OVERRIDE;
+};
+
+}
+
+#endif // InlineElementBox_h

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (158735 => 158736)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-11-06 10:26:56 UTC (rev 158736)
@@ -38,6 +38,7 @@
 #include "HTMLNames.h"
 #include "HTMLTextAreaElement.h"
 #include "HitTestResult.h"
+#include "InlineElementBox.h"
 #include "Page.h"
 #include "PaintInfo.h"
 #include "RenderBoxRegionInfo.h"
@@ -1941,7 +1942,7 @@
 
 std::unique_ptr<InlineBox> RenderBox::createInlineBox()
 {
-    return std::make_unique<InlineBox>(*this);
+    return std::make_unique<InlineElementBox>(*this);
 }
 
 void RenderBox::dirtyLineBoxes(bool fullLayout)

Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (158735 => 158736)


--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2013-11-06 10:21:26 UTC (rev 158735)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2013-11-06 10:26:56 UTC (rev 158736)
@@ -24,6 +24,7 @@
 
 #include "Document.h"
 #include "HTMLElement.h"
+#include "InlineElementBox.h"
 #include "RenderBlock.h"
 #include "RootInlineBox.h"
 #include "VisiblePosition.h"
@@ -69,7 +70,7 @@
 
 std::unique_ptr<InlineBox> RenderLineBreak::createInlineBox()
 {
-    return std::make_unique<InlineBox>(*this);
+    return std::make_unique<InlineElementBox>(*this);
 }
 
 void RenderLineBreak::setInlineBoxWrapper(InlineBox* inlineBox)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to