summaryrefslogtreecommitdiffstats
path: root/parser/html/nsHtml5TreeBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parser/html/nsHtml5TreeBuilder.cpp')
-rw-r--r--parser/html/nsHtml5TreeBuilder.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp
index 26db77865f..9ef9a519f7 100644
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -100,6 +100,18 @@ static const char* const QUIRKY_PUBLIC_IDS_DATA[] = {
"-//webtechs//dtd mozilla html//"};
staticJArray<const char*, int32_t> nsHtml5TreeBuilder::QUIRKY_PUBLIC_IDS = {
QUIRKY_PUBLIC_IDS_DATA, MOZ_ARRAY_LENGTH(QUIRKY_PUBLIC_IDS_DATA)};
+void nsHtml5TreeBuilder::setKeepBuffer(bool keepBuffer) {
+ this->keepBuffer = keepBuffer;
+}
+
+bool nsHtml5TreeBuilder::dropBufferIfLongerThan(int32_t length) {
+ if (charBuffer.length > length) {
+ charBuffer = nullptr;
+ return true;
+ }
+ return false;
+}
+
void nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) {
tokenizer = self;
stackNodes = jArray<nsHtml5StackNode*, int32_t>::newJArray(64);
@@ -118,7 +130,9 @@ void nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) {
headPointer = nullptr;
start(fragment);
charBufferLen = 0;
- charBuffer = nullptr;
+ if (!keepBuffer) {
+ charBuffer = nullptr;
+ }
framesetOk = true;
if (fragment) {
nsIContentHandle* elt;
@@ -652,7 +666,9 @@ void nsHtml5TreeBuilder::endTokenization() {
stackNodesIdx = 0;
stackNodes = nullptr;
}
- charBuffer = nullptr;
+ if (!keepBuffer) {
+ charBuffer = nullptr;
+ }
end();
}