Commit 61a97364 authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

Pass CreateElementFlags directly to ScriptLoader initialization

R=hiroshige@chromium.org, kouhei@chromium.org

Bug: 1086507
Change-Id: I4cc1401de2c642d24aab0f4bd6efd94eda18fe65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2213820
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772266}
parent 456503b8
......@@ -47,8 +47,7 @@ HTMLScriptElement::HTMLScriptElement(Document& document,
const CreateElementFlags flags)
: HTMLElement(html_names::kScriptTag, document),
children_changed_by_api_(false),
loader_(InitializeScriptLoader(flags.IsCreatedByParser(),
flags.WasAlreadyStarted())) {}
loader_(InitializeScriptLoader(flags)) {}
const AttrNameToTrustedType& HTMLScriptElement::GetCheckedAttributeTypes()
const {
......
......@@ -19,10 +19,9 @@ ScriptLoader* ScriptLoaderFromElement(Element* element) {
return script_loader;
}
ScriptLoader* ScriptElementBase::InitializeScriptLoader(bool parser_inserted,
bool already_started) {
return MakeGarbageCollected<ScriptLoader>(this, parser_inserted,
already_started);
ScriptLoader* ScriptElementBase::InitializeScriptLoader(
CreateElementFlags flags) {
return MakeGarbageCollected<ScriptLoader>(this, flags);
}
} // namespace blink
......@@ -22,6 +22,7 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_SCRIPT_ELEMENT_BASE_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/create_element_flags.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
......@@ -99,8 +100,7 @@ class CORE_EXPORT ScriptElementBase : public GarbageCollectedMixin {
virtual Type GetScriptElementType() = 0;
protected:
ScriptLoader* InitializeScriptLoader(bool parser_inserted,
bool already_started);
ScriptLoader* InitializeScriptLoader(CreateElementFlags);
virtual ScriptLoader* Loader() const = 0;
};
......
......@@ -75,8 +75,7 @@
namespace blink {
ScriptLoader::ScriptLoader(ScriptElementBase* element,
bool parser_inserted,
bool already_started)
const CreateElementFlags flags)
: element_(element),
will_be_parser_executed_(false),
will_execute_when_document_finished_parsing_(false),
......@@ -88,10 +87,10 @@ ScriptLoader::ScriptLoader(ScriptElementBase* element,
// TODO(hiroshige): Cloning is implemented together with
// {HTML,SVG}ScriptElement::cloneElementWithoutAttributesAndChildren().
// Clean up these later.
if (already_started)
if (flags.WasAlreadyStarted())
already_started_ = true;
if (parser_inserted) {
if (flags.IsCreatedByParser()) {
// <spec href="https://html.spec.whatwg.org/C/#parser-inserted">... It is
// set by the HTML parser and the XML parser on script elements they insert
// ...</spec>
......
......@@ -53,7 +53,7 @@ class CORE_EXPORT ScriptLoader final : public GarbageCollected<ScriptLoader>,
USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader);
public:
ScriptLoader(ScriptElementBase*, bool created_by_parser, bool is_evaluated);
ScriptLoader(ScriptElementBase*, const CreateElementFlags);
~ScriptLoader() override;
void Trace(Visitor*) const override;
const char* NameInHeapSnapshot() const override { return "ScriptLoader"; }
......
......@@ -37,8 +37,7 @@ SVGScriptElement::SVGScriptElement(Document& document,
const CreateElementFlags flags)
: SVGElement(svg_names::kScriptTag, document),
SVGURIReference(this),
loader_(InitializeScriptLoader(flags.IsCreatedByParser(),
flags.WasAlreadyStarted())) {}
loader_(InitializeScriptLoader(flags)) {}
void SVGScriptElement::ParseAttribute(
const AttributeModificationParams& params) {
......
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