Commit 939af248 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Rename CheckIfBodyStylesheetAdded to reflect intent.

The method checks if the parser should be paused when a parser blocking
stylesheet is added. That is currently for sheets in body, but that is
not the only case with BlockHTMLParserOnStyleSheets enabled.

Bug: 891767
Change-Id: I9597ed2072ad18ba4552b4b6bc98cca8b85c8e68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023788Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735827}
parent f4e19f78
...@@ -265,7 +265,7 @@ bool HTMLDocumentParser::IsParsingFragment() const { ...@@ -265,7 +265,7 @@ bool HTMLDocumentParser::IsParsingFragment() const {
} }
void HTMLDocumentParser::PumpTokenizerIfPossible() { void HTMLDocumentParser::PumpTokenizerIfPossible() {
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
if (IsStopped() || IsPaused()) if (IsStopped() || IsPaused())
return; return;
...@@ -281,7 +281,7 @@ void HTMLDocumentParser::ResumeParsingAfterYield() { ...@@ -281,7 +281,7 @@ void HTMLDocumentParser::ResumeParsingAfterYield() {
DCHECK(ShouldUseThreading()); DCHECK(ShouldUseThreading());
DCHECK(have_background_parser_); DCHECK(have_background_parser_);
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
if (IsStopped() || IsPaused()) if (IsStopped() || IsPaused())
return; return;
...@@ -297,7 +297,7 @@ void HTMLDocumentParser::RunScriptsForPausedTreeBuilder() { ...@@ -297,7 +297,7 @@ void HTMLDocumentParser::RunScriptsForPausedTreeBuilder() {
// We will not have a scriptRunner when parsing a DocumentFragment. // We will not have a scriptRunner when parsing a DocumentFragment.
if (script_runner_) if (script_runner_)
script_runner_->ProcessScriptElement(script_element, script_start_position); script_runner_->ProcessScriptElement(script_element, script_start_position);
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
} }
bool HTMLDocumentParser::CanTakeNextToken() { bool HTMLDocumentParser::CanTakeNextToken() {
...@@ -597,7 +597,7 @@ void HTMLDocumentParser::PumpPendingSpeculations() { ...@@ -597,7 +597,7 @@ void HTMLDocumentParser::PumpPendingSpeculations() {
// IsScheduledForUnpause() may be set here as a result of // IsScheduledForUnpause() may be set here as a result of
// ProcessTokenizedChunkFromBackgroundParser running arbitrary javascript // ProcessTokenizedChunkFromBackgroundParser running arbitrary javascript
// which invokes nested event loops. (e.g. inspector breakpoints) // which invokes nested event loops. (e.g. inspector breakpoints)
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
if (!IsParsing() || IsPaused() || IsScheduledForUnpause()) if (!IsParsing() || IsPaused() || IsScheduledForUnpause())
break; break;
...@@ -689,7 +689,7 @@ void HTMLDocumentParser::ConstructTreeFromHTMLToken() { ...@@ -689,7 +689,7 @@ void HTMLDocumentParser::ConstructTreeFromHTMLToken() {
Token().Clear(); Token().Clear();
tree_builder_->ConstructTree(&atomic_token); tree_builder_->ConstructTree(&atomic_token);
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
// FIXME: ConstructTree may synchronously cause Document to be detached. // FIXME: ConstructTree may synchronously cause Document to be detached.
if (!token_) if (!token_)
...@@ -706,7 +706,7 @@ void HTMLDocumentParser::ConstructTreeFromCompactHTMLToken( ...@@ -706,7 +706,7 @@ void HTMLDocumentParser::ConstructTreeFromCompactHTMLToken(
DCHECK(!GetDocument()->IsPrefetchOnly()); DCHECK(!GetDocument()->IsPrefetchOnly());
AtomicHTMLToken token(compact_token); AtomicHTMLToken token(compact_token);
tree_builder_->ConstructTree(&token); tree_builder_->ConstructTree(&token);
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
} }
bool HTMLDocumentParser::HasInsertionPoint() { bool HTMLDocumentParser::HasInsertionPoint() {
...@@ -1002,7 +1002,7 @@ void HTMLDocumentParser::ResumeParsingAfterPause() { ...@@ -1002,7 +1002,7 @@ void HTMLDocumentParser::ResumeParsingAfterPause() {
DCHECK(!IsExecutingScript()); DCHECK(!IsExecutingScript());
DCHECK(!IsPaused()); DCHECK(!IsPaused());
CheckIfBodyStylesheetAdded(); CheckIfBlockingStylesheetAdded();
if (IsStopped() || IsPaused()) if (IsStopped() || IsPaused())
return; return;
...@@ -1091,7 +1091,7 @@ void HTMLDocumentParser::DidLoadAllPendingParserBlockingStylesheets() { ...@@ -1091,7 +1091,7 @@ void HTMLDocumentParser::DidLoadAllPendingParserBlockingStylesheets() {
added_pending_parser_blocking_stylesheet_ = false; added_pending_parser_blocking_stylesheet_ = false;
} }
void HTMLDocumentParser::CheckIfBodyStylesheetAdded() { void HTMLDocumentParser::CheckIfBlockingStylesheetAdded() {
if (added_pending_parser_blocking_stylesheet_) { if (added_pending_parser_blocking_stylesheet_) {
added_pending_parser_blocking_stylesheet_ = false; added_pending_parser_blocking_stylesheet_ = false;
is_waiting_for_stylesheets_ = true; is_waiting_for_stylesheets_ = true;
......
...@@ -155,7 +155,7 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser, ...@@ -155,7 +155,7 @@ class CORE_EXPORT HTMLDocumentParser : public ScriptableDocumentParser,
void ExecuteScriptsWaitingForResources() final; void ExecuteScriptsWaitingForResources() final;
void DidAddPendingParserBlockingStylesheet() final; void DidAddPendingParserBlockingStylesheet() final;
void DidLoadAllPendingParserBlockingStylesheets() final; void DidLoadAllPendingParserBlockingStylesheets() final;
void CheckIfBodyStylesheetAdded(); void CheckIfBlockingStylesheetAdded();
void DocumentElementAvailable() override; void DocumentElementAvailable() override;
// HTMLParserScriptRunnerHost // HTMLParserScriptRunnerHost
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment