Skip to content
Permalink
Browse files
2010-08-24 Adam Barth <abarth@webkit.org>
        Reviewed by Eric Seidel.

        Delete LegacyHTMLTreeBuilder
        https://bugs.webkit.org/show_bug.cgi?id=44554

        There were some free functions in LegacyHTMLTreeBuilder that needed a
        new home.  I've put them in HTMLTreeBuilder, but they'll probably need
        a better home eventually.

        * Android.mk:
        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * dom/Document.cpp:
        (WebCore::shouldCreateImplicitHead):
        * dom/DocumentParser.h:
        * dom/ScriptableDocumentParser.h:
        * html/HTMLConstructionSite.cpp:
        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElement::removedFromTree):
        * html/HTMLInputElement.cpp:
        * html/HTMLMeterElement.cpp:
        * html/HTMLProgressElement.cpp:
        * html/HTMLTreeBuilder.cpp:
        (WebCore::serializeForNumberType):
        (WebCore::parseToDoubleForNumberType):
        * html/HTMLTreeBuilder.h:
        * html/HTMLViewSourceParser.h:
        * html/LegacyHTMLTreeBuilder.cpp: Removed.
        * html/LegacyHTMLTreeBuilder.h: Removed.
        * html/StepRange.cpp:
        * html/ValidityState.cpp:
        * rendering/RenderSlider.cpp:


Canonical link: https://commits.webkit.org/56720@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Adam Barth committed Aug 24, 2010
1 parent 66fb782 commit 49785f71036e997e75029f5318b94cbaac8db1fb
Showing 24 changed files with 121 additions and 2,141 deletions.
@@ -281,7 +281,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
html/HTMLImageLoader.cpp \
html/HTMLNameCollection.cpp \
html/HTMLOptionsCollection.cpp \
html/LegacyHTMLTreeBuilder.cpp \
html/HTMLParserErrorCodes.cpp \
html/HTMLParserScheduler.cpp \
html/HTMLTableRowsCollection.cpp \
@@ -1025,7 +1025,6 @@ SET(WebCore_SOURCES
html/HTMLOptionsCollection.cpp
html/HTMLParagraphElement.cpp
html/HTMLParamElement.cpp
html/LegacyHTMLTreeBuilder.cpp
html/HTMLParserErrorCodes.cpp
html/HTMLParserScheduler.cpp
html/HTMLPlugInElement.cpp
@@ -1,3 +1,42 @@
2010-08-24 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Delete LegacyHTMLTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=44554

There were some free functions in LegacyHTMLTreeBuilder that needed a
new home. I've put them in HTMLTreeBuilder, but they'll probably need
a better home eventually.

* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::shouldCreateImplicitHead):
* dom/DocumentParser.h:
* dom/ScriptableDocumentParser.h:
* html/HTMLConstructionSite.cpp:
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::removedFromTree):
* html/HTMLInputElement.cpp:
* html/HTMLMeterElement.cpp:
* html/HTMLProgressElement.cpp:
* html/HTMLTreeBuilder.cpp:
(WebCore::serializeForNumberType):
(WebCore::parseToDoubleForNumberType):
* html/HTMLTreeBuilder.h:
* html/HTMLViewSourceParser.h:
* html/LegacyHTMLTreeBuilder.cpp: Removed.
* html/LegacyHTMLTreeBuilder.h: Removed.
* html/StepRange.cpp:
* html/ValidityState.cpp:
* rendering/RenderSlider.cpp:

2010-08-24 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.
@@ -1509,8 +1509,6 @@ webcore_sources += \
WebCore/html/HTMLParagraphElement.h \
WebCore/html/HTMLParamElement.cpp \
WebCore/html/HTMLParamElement.h \
WebCore/html/LegacyHTMLTreeBuilder.cpp \
WebCore/html/LegacyHTMLTreeBuilder.h \
WebCore/html/HTMLParserErrorCodes.cpp \
WebCore/html/HTMLParserErrorCodes.h \
WebCore/html/HTMLParserQuirks.h \
@@ -1675,8 +1675,6 @@
'html/HTMLParagraphElement.h',
'html/HTMLParamElement.cpp',
'html/HTMLParamElement.h',
'html/LegacyHTMLTreeBuilder.cpp',
'html/LegacyHTMLTreeBuilder.h',
'html/HTMLParserErrorCodes.cpp',
'html/HTMLParserErrorCodes.h',
'html/HTMLParserScheduler.cpp',
@@ -719,7 +719,6 @@ SOURCES += \
html/HTMLOptionsCollection.cpp \
html/HTMLParagraphElement.cpp \
html/HTMLParamElement.cpp \
html/LegacyHTMLTreeBuilder.cpp \
html/HTMLParserErrorCodes.cpp \
html/HTMLParserScheduler.cpp \
html/HTMLPlugInElement.cpp \
@@ -1493,7 +1492,6 @@ HEADERS += \
html/HTMLParagraphElement.h \
html/HTMLParamElement.h \
html/HTMLParserErrorCodes.h \
html/LegacyHTMLTreeBuilder.h \
html/HTMLPlugInElement.h \
html/HTMLPlugInImageElement.h \
html/HTMLPreElement.h \
@@ -41720,14 +41720,6 @@
RelativePath="..\html\LabelsNodeList.h"
>
</File>
<File
RelativePath="..\html\LegacyHTMLTreeBuilder.cpp"
>
</File>
<File
RelativePath="..\html\LegacyHTMLTreeBuilder.h"
>
</File>
<File
RelativePath="..\html\MediaError.h"
>
@@ -1100,7 +1100,7 @@
5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
512DD8E30D91E2B4000F89EE /* SharedBufferCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512DD8E20D91E2B4000F89EE /* SharedBufferCF.cpp */; };
512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512DD8EA0D91E6AF000F89EE /* LegacyWebArchive.cpp */; };
512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8EB0D91E6AF000F89EE /* LegacyWebArchive.h */; settings = {ATTRIBUTES = (Private, ); }; };
512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8EB0D91E6AF000F89EE /* LegacyWebArchive.h */; settings = {ATTRIBUTES = (Private, ); }; };
512DD8F60D91E6AF000F89EE /* Archive.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8EC0D91E6AF000F89EE /* Archive.h */; settings = {ATTRIBUTES = (Private, ); }; };
512DD8F70D91E6AF000F89EE /* ArchiveResourceCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512DD8ED0D91E6AF000F89EE /* ArchiveResourceCollection.cpp */; };
512DD8F80D91E6AF000F89EE /* ArchiveResourceCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8EE0D91E6AF000F89EE /* ArchiveResourceCollection.h */; };
@@ -2656,7 +2656,6 @@
93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; };
93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F198E608245E59001E9ABC /* HTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23F02DE4396018635CA /* HTMLElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F198EF08245E59001E9ABC /* LegacyHTMLTreeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */; };
93F198F608245E59001E9ABC /* TextResourceDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D27902DE43D7018635CA /* TextResourceDecoder.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F1991808245E59001E9ABC /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30402DE4476018635CA /* Range.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F1992108245E59001E9ABC /* XMLDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* XMLDocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2685,7 +2684,6 @@
93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587855502DE375901EA4122 /* WebCoreViewFactory.m */; };
93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; };
93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.cpp */; };
93F19A9B08245E59001E9ABC /* LegacyHTMLTreeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */; };
93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */; };
93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; };
93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLDocumentParser.cpp */; };
@@ -11155,8 +11153,6 @@
F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D23E02DE4396018635CA /* HTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D23F02DE4396018635CA /* HTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyHTMLTreeBuilder.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = LegacyHTMLTreeBuilder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextResourceDecoder.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D27902DE43D7018635CA /* TextResourceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TextResourceDecoder.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D30302DE4476018635CA /* Range.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Range.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -14335,8 +14331,6 @@
B0149E7C11A4B21500196A7B /* ImageResizerThread.h */,
A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */,
A456FA2511AD4A830020B420 /* LabelsNodeList.h */,
F523D25002DE4396018635CA /* LegacyHTMLTreeBuilder.cpp */,
F523D25102DE4396018635CA /* LegacyHTMLTreeBuilder.h */,
E446139B0CD6331000FADA75 /* MediaError.h */,
E446139C0CD6331000FADA75 /* MediaError.idl */,
A5AFB34D115151A700B045CB /* StepRange.cpp */,
@@ -19452,8 +19446,7 @@
A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */,
85EC9AFB0A71A2C600EEEAED /* Language.h in Headers */,
2D9066070BE141D400956998 /* LayoutState.h in Headers */,
93F198EF08245E59001E9ABC /* LegacyHTMLTreeBuilder.h in Headers */,
512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */,
512DD8F50D91E6AF000F89EE /* LegacyWebArchive.h in Headers */,
BCE65BEB0EACDF16007E4533 /* Length.h in Headers */,
BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */,
BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */,
@@ -22030,7 +22023,6 @@
A456FA2611AD4A830020B420 /* LabelsNodeList.cpp in Sources */,
9352084509BD43B900F2038D /* Language.mm in Sources */,
2D9066060BE141D400956998 /* LayoutState.cpp in Sources */,
93F19A9B08245E59001E9ABC /* LegacyHTMLTreeBuilder.cpp in Sources */,
512DD8F40D91E6AF000F89EE /* LegacyWebArchive.cpp in Sources */,
51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */,
BCE65BEA0EACDF16007E4533 /* Length.cpp in Sources */,
@@ -89,7 +89,6 @@
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "KeyboardEvent.h"
#include "LegacyHTMLTreeBuilder.h"
#include "Logging.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
@@ -1923,6 +1922,26 @@ void Document::close()
}
}

// FIXME: These settings probably don't work anymore. We should either remove
// them or make them work properly.
#ifdef BUILDING_ON_LEOPARD
static bool shouldCreateImplicitHead(Document* document)
{
ASSERT(document);
Settings* settings = document->page() ? document->page()->settings() : 0;
return settings ? !settings->needsLeopardMailQuirks() : true;
}
#elif defined(BUILDING_ON_TIGER)
static bool shouldCreateImplicitHead(Document* document)
{
ASSERT(document);
Settings* settings = document->page() ? document->page()->settings() : 0;
return settings ? !settings->needsTigerMailQuirks() : true;
}
#else
inline bool shouldCreateImplicitHead(Document*) { return true; }
#endif

void Document::implicitClose()
{
// If we're in the middle of recalcStyle, we need to defer the close until the style information is accurate and all elements are re-attached.
@@ -30,7 +30,6 @@ namespace WebCore {

class Document;
class DocumentWriter;
class LegacyHTMLTreeBuilder;
class SegmentedString;
class ScriptableDocumentParser;

@@ -61,10 +60,6 @@ class DocumentParser : public RefCounted<DocumentParser> {
// used to implements it.
virtual bool processingData() const { return false; }

// FIXME: Exposed for HTMLFormControlElement::removedFromTree. HTML DOM
// code should not need to reach into implementation details of the parser.
virtual LegacyHTMLTreeBuilder* htmlTreeBuilder() const { return 0; }

Document* document() const { return m_document; }

// Document is expected to detach the parser before releasing its ref.
@@ -52,9 +52,6 @@ class ScriptableDocumentParser : public DecodedDataDocumentParser {
XSSAuditor* xssAuditor() const { return m_xssAuditor; }
void setXSSAuditor(XSSAuditor* auditor) { m_xssAuditor = auditor; }

// Exposed for LegacyHTMLTreeBuilder::reportErrorToConsole
virtual bool processingContentWrittenByScript() const { return false; }

protected:
ScriptableDocumentParser(Document*, bool viewSourceMode = false);

@@ -39,7 +39,6 @@
#include "HTMLScriptElement.h"
#include "HTMLToken.h"
#include "HTMLTokenizer.h"
#include "LegacyHTMLTreeBuilder.h"
#include "LocalizedStrings.h"
#if ENABLE(MATHML)
#include "MathMLNames.h"
@@ -39,7 +39,6 @@
#include "HTMLFormElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "LegacyHTMLTreeBuilder.h"
#include "LabelsNodeList.h"
#include "Page.h"
#include "RenderBox.h"
@@ -173,11 +172,7 @@ void HTMLFormControlElement::removedFromTree(bool deep)
{
// If the form and element are both in the same tree, preserve the connection to the form.
// Otherwise, null out our form and remove ourselves from the form's list of elements.
LegacyHTMLTreeBuilder* treeBuilder = 0;
if (DocumentParser* parser = document()->parser())
treeBuilder = parser->htmlTreeBuilder();

if (m_form && !(treeBuilder && treeBuilder->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) {
if (m_form && findRoot(this) != findRoot(m_form)) {
m_form->removeFormElement(this);
m_form = 0;
}
@@ -50,7 +50,7 @@
#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
#include "LegacyHTMLTreeBuilder.h"
#include "HTMLTreeBuilder.h"
#include "KeyboardEvent.h"
#include "LocalizedStrings.h"
#include "MouseEvent.h"
@@ -28,7 +28,7 @@
#include "FormDataList.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "LegacyHTMLTreeBuilder.h"
#include "HTMLTreeBuilder.h"
#include "RenderMeter.h"
#include <wtf/StdLibExtras.h>

@@ -28,7 +28,7 @@
#include "FormDataList.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "LegacyHTMLTreeBuilder.h"
#include "HTMLTreeBuilder.h"
#include "RenderProgress.h"
#include <wtf/StdLibExtras.h>

@@ -49,6 +49,9 @@
#include "XLinkNames.h"
#include "XMLNSNames.h"
#include "XMLNames.h"
// FIXME: Remove this include once we find a home for the free functions that
// are using it.
#include <wtf/dtoa.h>
#include <wtf/UnusedParam.h>

namespace WebCore {
@@ -2842,4 +2845,42 @@ bool HTMLTreeBuilder::pluginsEnabled(Frame* frame)
return frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin);
}

// FIXME: Move this function to a more appropriate place.
String serializeForNumberType(double number)
{
// According to HTML5, "the best representation of the number n as a floating
// point number" is a string produced by applying ToString() to n.
DtoaBuffer buffer;
unsigned length;
doubleToStringInJavaScriptFormat(number, buffer, &length);
return String(buffer, length);
}

// FIXME: Move this function to a more appropriate place.
bool parseToDoubleForNumberType(const String& src, double* out)
{
// See HTML5 2.4.4.3 `Real numbers.'

if (src.isEmpty())
return false;
// String::toDouble() accepts leading + \t \n \v \f \r and SPACE, which are invalid in HTML5.
// So, check the first character.
if (src[0] != '-' && (src[0] < '0' || src[0] > '9'))
return false;

bool valid = false;
double value = src.toDouble(&valid);
if (!valid)
return false;
// NaN and Infinity are not valid numbers according to the standard.
if (!isfinite(value))
return false;
// -0 -> 0
if (!value)
value = 0;
if (out)
*out = value;
return true;
}

}
@@ -255,6 +255,18 @@ class HTMLTreeBuilder : public Noncopyable {
int m_lastScriptElementStartLine;
};

// FIXME: Move these functions to a more appropriate place.

// Converts the specified string to a floating number.
// If the conversion fails, the return value is false. Take care that leading
// or trailing unnecessary characters make failures. This returns false for an
// empty string input.
// The double* parameter may be 0.
bool parseToDoubleForNumberType(const String&, double*);
// Converts the specified number to a string. This is an implementation of
// HTML5's "algorithm to convert a number to a string" for NUMBER/RANGE types.
String serializeForNumberType(double);

}

#endif
@@ -39,7 +39,6 @@ class HTMLTokenizer;
class HTMLScriptRunner;
class HTMLTreeBuilder;
class HTMLPreloadScanner;
class LegacyHTMLTreeBuilder;
class ScriptController;
class ScriptSourceCode;

0 comments on commit 49785f7

Please sign in to comment.