summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-01 19:07:38 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-01 19:08:31 +0200
commit8766e49a7c3a28f2851bcc84b5532e26b14f2db0 (patch)
treea76b6f8855f52a2725e6c27f730260c97467057a /Libraries
parent517cf65c998b63eb9c9c40e5128e896569e8a4ab (diff)
downloadserenity-8766e49a7c3a28f2851bcc84b5532e26b14f2db0.zip
LibWeb+Browser: Use the new HTML parser by default
You can still run the old parser with "br -O", but the new one is good enough to be the default parser now. We'll fix issues as we go and eventually remove the old one completely. :^)
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibWeb/PageView.cpp13
-rw-r--r--Libraries/LibWeb/PageView.h4
-rw-r--r--Libraries/LibWeb/Parser/HTMLDocumentParser.cpp2
3 files changed, 9 insertions, 10 deletions
diff --git a/Libraries/LibWeb/PageView.cpp b/Libraries/LibWeb/PageView.cpp
index 88304be1b5..02af758924 100644
--- a/Libraries/LibWeb/PageView.cpp
+++ b/Libraries/LibWeb/PageView.cpp
@@ -44,9 +44,9 @@
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Frame.h>
-#include <LibWeb/PageView.h>
#include <LibWeb/Layout/LayoutDocument.h>
#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/PageView.h>
#include <LibWeb/Parser/HTMLDocumentParser.h>
#include <LibWeb/Parser/HTMLParser.h>
#include <LibWeb/RenderingContext.h>
@@ -443,12 +443,11 @@ RefPtr<Document> PageView::create_document_from_mime_type(const ByteBuffer& data
if (mime_type == "text/gemini")
return create_gemini_document(data, url);
if (mime_type == "text/html") {
- if (m_use_new_parser) {
- HTMLDocumentParser parser(data, encoding);
- parser.run(url);
- return parser.document();
- }
- return parse_html_document(data, url, encoding);
+ if (m_use_old_parser)
+ return parse_html_document(data, url, encoding);
+ HTMLDocumentParser parser(data, encoding);
+ parser.run(url);
+ return parser.document();
}
return nullptr;
}
diff --git a/Libraries/LibWeb/PageView.h b/Libraries/LibWeb/PageView.h
index 200e12ea05..4151448e4e 100644
--- a/Libraries/LibWeb/PageView.h
+++ b/Libraries/LibWeb/PageView.h
@@ -40,7 +40,7 @@ public:
virtual ~PageView() override;
// FIXME: Remove this once the new parser is ready.
- void set_use_new_parser(bool use_new_parser) { m_use_new_parser = use_new_parser; }
+ void set_use_old_parser(bool use_old_parser) { m_use_old_parser = use_old_parser; }
Document* document();
const Document* document() const;
@@ -99,7 +99,7 @@ private:
bool m_should_show_line_box_borders { false };
bool m_in_mouse_selection { false };
- bool m_use_new_parser { false };
+ bool m_use_old_parser { false };
};
}
diff --git a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp
index 773b34454f..cd25d9d470 100644
--- a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp
+++ b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define PARSER_DEBUG
+//#define PARSER_DEBUG
#include <AK/Utf32View.h>
#include <LibWeb/DOM/Comment.h>