Title: [175720] trunk/Source/WebCore
Revision
175720
Author
cdu...@apple.com
Date
2014-11-06 15:17:32 -0800 (Thu, 06 Nov 2014)

Log Message

Stop special-casing wbr elements in HTMLElement::createElementRenderer()
https://bugs.webkit.org/show_bug.cgi?id=138474

Reviewed by Ryosuke Niwa.

Stop special-casing wbr elements in HTMLElement::createElementRenderer()
and move the code to a HTMLWBRElement subclass instead, that is
overriding createElementRenderer(). This function is already virtual.

No new tests, no behavior change.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::createElementRenderer):
* html/HTMLElementsAllInOne.cpp:
* html/HTMLTagNames.in:
* html/HTMLWBRElement.cpp: Added.
(WebCore::HTMLWBRElement::create):
(WebCore::HTMLWBRElement::HTMLWBRElement):
(WebCore::HTMLWBRElement::createElementRenderer):
* html/HTMLWBRElement.h: Added.
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::RenderLineBreak):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (175719 => 175720)


--- trunk/Source/WebCore/CMakeLists.txt	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-11-06 23:17:32 UTC (rev 175720)
@@ -1625,6 +1625,7 @@
     html/HTMLTrackElement.cpp
     html/HTMLUListElement.cpp
     html/HTMLVideoElement.cpp
+    html/HTMLWBRElement.cpp
     html/HiddenInputType.cpp
     html/ImageData.cpp
     html/ImageDocument.cpp

Modified: trunk/Source/WebCore/ChangeLog (175719 => 175720)


--- trunk/Source/WebCore/ChangeLog	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/ChangeLog	2014-11-06 23:17:32 UTC (rev 175720)
@@ -1,3 +1,31 @@
+2014-11-06  Chris Dumez  <cdu...@apple.com>
+
+        Stop special-casing wbr elements in HTMLElement::createElementRenderer()
+        https://bugs.webkit.org/show_bug.cgi?id=138474
+
+        Reviewed by Ryosuke Niwa.
+
+        Stop special-casing wbr elements in HTMLElement::createElementRenderer()
+        and move the code to a HTMLWBRElement subclass instead, that is
+        overriding createElementRenderer(). This function is already virtual.
+
+        No new tests, no behavior change.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::createElementRenderer):
+        * html/HTMLElementsAllInOne.cpp:
+        * html/HTMLTagNames.in:
+        * html/HTMLWBRElement.cpp: Added.
+        (WebCore::HTMLWBRElement::create):
+        (WebCore::HTMLWBRElement::HTMLWBRElement):
+        (WebCore::HTMLWBRElement::createElementRenderer):
+        * html/HTMLWBRElement.h: Added.
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::RenderLineBreak):
+
 2014-11-05  Jer Noble  <jer.no...@apple.com>
 
         De-templatize Timer

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (175719 => 175720)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-11-06 23:17:32 UTC (rev 175720)
@@ -16016,6 +16016,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\html\HTMLWBRElement.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="..\html\ImageData.cpp" />
     <ClCompile Include="..\html\ImageDocument.cpp" />
     <ClCompile Include="..\html\ImageInputType.cpp" />
@@ -20793,6 +20807,7 @@
     <ClInclude Include="..\html\HTMLTrackElement.h" />
     <ClInclude Include="..\html\HTMLUListElement.h" />
     <ClInclude Include="..\html\HTMLVideoElement.h" />
+    <ClInclude Include="..\html\HTMLWBRElement.h" />
     <ClInclude Include="..\html\ImageData.h" />
     <ClInclude Include="..\html\ImageDocument.h" />
     <ClInclude Include="..\html\ImageInputType.h" />

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (175719 => 175720)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-11-06 23:17:32 UTC (rev 175720)
@@ -2504,6 +2504,8 @@
 		836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */; };
 		8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */; };
 		8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
+		839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */; };
+		839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */; };
 		83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */; };
 		83C1D425178D5AB400141E68 /* SVGPathSegArcAbs.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */; };
 		83C1D426178D5AB400141E68 /* SVGPathSegArcRel.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C1D414178D5AB400141E68 /* SVGPathSegArcRel.h */; };
@@ -9686,6 +9688,8 @@
 		836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedProperty.cpp; sourceTree = "<group>"; };
 		8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilder.h; sourceTree = "<group>"; };
 		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
+		839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
+		839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
 		83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
 		83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcAbs.h; sourceTree = "<group>"; };
 		83C1D414178D5AB400141E68 /* SVGPathSegArcRel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcRel.h; sourceTree = "<group>"; };
@@ -17941,6 +17945,8 @@
 				E44613980CD6331000FADA75 /* HTMLVideoElement.cpp */,
 				E44613990CD6331000FADA75 /* HTMLVideoElement.h */,
 				E446139A0CD6331000FADA75 /* HTMLVideoElement.idl */,
+				839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */,
+				839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */,
 				A77979130D6B9D0C003851B9 /* ImageData.cpp */,
 				A77979140D6B9D0C003851B9 /* ImageData.h */,
 				A77979150D6B9D0C003851B9 /* ImageData.idl */,
@@ -26251,6 +26257,7 @@
 				B2227A270D00BF220071B782 /* SVGGElement.h in Headers */,
 				087E0AF713606D0B00FA4BA8 /* SVGGlyph.h in Headers */,
 				B2A1F2AE0CEF0ABF00442F6A /* SVGGlyphElement.h in Headers */,
+				839AAFED1A0C0C8D00605F99 /* HTMLWBRElement.h in Headers */,
 				3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */,
 				24D912BE13CA9A9700D21915 /* SVGGlyphRefElement.h in Headers */,
 				B2227A2A0D00BF220071B782 /* SVGGradientElement.h in Headers */,
@@ -28031,6 +28038,7 @@
 				977B3877122883E900B81FF8 /* HTMLTokenizer.cpp in Sources */,
 				0707568B142262D600414161 /* HTMLTrackElement.cpp in Sources */,
 				977B37251228721700B81FF8 /* HTMLTreeBuilder.cpp in Sources */,
+				839AAFEC1A0C0C8D00605F99 /* HTMLWBRElement.cpp in Sources */,
 				A8EA79F30A1916DF00A8EF5F /* HTMLUListElement.cpp in Sources */,
 				E44613AA0CD6331000FADA75 /* HTMLVideoElement.cpp in Sources */,
 				0B8C56D40F28627F000502E1 /* HTTPHeaderMap.cpp in Sources */,

Modified: trunk/Source/WebCore/html/HTMLElement.cpp (175719 => 175720)


--- trunk/Source/WebCore/html/HTMLElement.cpp	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/html/HTMLElement.cpp	2014-11-06 23:17:32 UTC (rev 175720)
@@ -51,7 +51,7 @@
 #include "HTMLTemplateElement.h"
 #include "HTMLTextFormControlElement.h"
 #include "NodeTraversal.h"
-#include "RenderLineBreak.h"
+#include "RenderElement.h"
 #include "ScriptController.h"
 #include "Settings.h"
 #include "StyleProperties.h"
@@ -855,8 +855,6 @@
 
 RenderPtr<RenderElement> HTMLElement::createElementRenderer(PassRef<RenderStyle> style)
 {
-    if (hasTagName(wbrTag))
-        return createRenderer<RenderLineBreak>(*this, WTF::move(style));
     return RenderElement::createFor(*this, WTF::move(style));
 }
 

Modified: trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp (175719 => 175720)


--- trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp	2014-11-06 23:17:32 UTC (rev 175720)
@@ -109,4 +109,5 @@
 #include "HTMLTrackElement.cpp"
 #include "HTMLUListElement.cpp"
 #include "HTMLVideoElement.cpp"
+#include "HTMLWBRElement.cpp"
 

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (175719 => 175720)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2014-11-06 23:17:32 UTC (rev 175720)
@@ -135,6 +135,6 @@
 ul interfaceName=HTMLUListElement
 var interfaceName=HTMLElement
 video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, customTypeHelper
-wbr interfaceName=HTMLElement
+wbr interfaceName=HTMLWBRElement, JSInterfaceName=HTMLElement
 xmp interfaceName=HTMLPreElement
 noscript interfaceName=HTMLElement

Added: trunk/Source/WebCore/html/HTMLWBRElement.cpp (0 => 175720)


--- trunk/Source/WebCore/html/HTMLWBRElement.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLWBRElement.cpp	2014-11-06 23:17:32 UTC (rev 175720)
@@ -0,0 +1,52 @@
+/*
+ * 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 "HTMLWBRElement.h"
+
+#include "HTMLNames.h"
+#include "RenderLineBreak.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+PassRefPtr<HTMLWBRElement> HTMLWBRElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(new HTMLWBRElement(tagName, document));
+}
+
+HTMLWBRElement::HTMLWBRElement(const QualifiedName& tagName, Document& document)
+    : HTMLElement(tagName, document)
+{
+    ASSERT(hasTagName(wbrTag));
+}
+
+RenderPtr<RenderElement> HTMLWBRElement::createElementRenderer(PassRef<RenderStyle> style)
+{
+    return createRenderer<RenderLineBreak>(*this, WTF::move(style));
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/HTMLWBRElement.h (0 => 175720)


--- trunk/Source/WebCore/html/HTMLWBRElement.h	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLWBRElement.h	2014-11-06 23:17:32 UTC (rev 175720)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+#ifndef HTMLWBRElement_h
+#define HTMLWBRElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLWBRElement final : public HTMLElement {
+public:
+    static PassRefPtr<HTMLWBRElement> create(const QualifiedName&, Document&);
+
+private:
+    HTMLWBRElement(const QualifiedName&, Document&);
+
+    virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
+};
+
+} // namespace WebCore
+
+#endif // HTMLWBRElement_h
+

Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (175719 => 175720)


--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2014-11-06 23:06:03 UTC (rev 175719)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2014-11-06 23:17:32 UTC (rev 175720)
@@ -24,6 +24,7 @@
 
 #include "Document.h"
 #include "HTMLElement.h"
+#include "HTMLWBRElement.h"
 #include "InlineElementBox.h"
 #include "LogicalSelectionOffsetCaches.h"
 #include "RenderBlock.h"
@@ -43,7 +44,7 @@
     : RenderBoxModelObject(element, WTF::move(style), 0)
     , m_inlineBoxWrapper(nullptr)
     , m_cachedLineHeight(invalidLineHeight)
-    , m_isWBR(element.hasTagName(HTMLNames::wbrTag))
+    , m_isWBR(is<HTMLWBRElement>(element))
 {
     setIsLineBreak();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to