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