Commit 3a2bdd51 authored by Daniel Vogelheim's avatar Daniel Vogelheim Committed by Commit Bot

Disambiguate [ScriptElementBase|Element]::TextFromChildren()

ScriptElementBase::TextFromChildren() is distinct from, but always
delegates to Element::TextFromChildren(). This CL disambiguates both.

This is preparation for crrev.com/1924523, which would add additional
checks which only make sense for script elements, and hence would apply only
to the ScriptElementBase cases.

This CL should be a functional no-op.

Bug: 1026549
Change-Id: I7cbdec29b45d2cbede37db81f4632881c2888b55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929830
Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722946}
parent 4da7576b
......@@ -201,8 +201,8 @@ String HTMLScriptElement::ImportanceAttributeValue() const {
return FastGetAttribute(html_names::kImportanceAttr);
}
String HTMLScriptElement::TextFromChildren() {
return Element::TextFromChildren();
String HTMLScriptElement::ChildTextContent() {
return TextFromChildren();
}
bool HTMLScriptElement::AsyncAttributeValue() const {
......
......@@ -85,7 +85,7 @@ class CORE_EXPORT HTMLScriptElement final : public HTMLElement,
String IntegrityAttributeValue() const override;
String ReferrerPolicyAttributeValue() const override;
String ImportanceAttributeValue() const override;
String TextFromChildren() override;
String ChildTextContent() override;
bool AsyncAttributeValue() const override;
bool DeferAttributeValue() const override;
bool HasSourceAttribute() const override;
......
......@@ -38,7 +38,7 @@ class MockScriptElementBase : public GarbageCollected<MockScriptElementBase>,
MOCK_CONST_METHOD0(SourceAttributeValue, String());
MOCK_CONST_METHOD0(TypeAttributeValue, String());
MOCK_METHOD0(TextFromChildren, String());
MOCK_METHOD0(ChildTextContent, String());
MOCK_CONST_METHOD0(HasSourceAttribute, bool());
MOCK_CONST_METHOD0(IsConnected, bool());
MOCK_CONST_METHOD0(HasChildren, bool());
......
......@@ -52,7 +52,7 @@ class CORE_EXPORT ScriptElementBase : public GarbageCollectedMixin {
virtual String ReferrerPolicyAttributeValue() const = 0;
virtual String ImportanceAttributeValue() const = 0;
virtual String TextFromChildren() = 0;
virtual String ChildTextContent() = 0;
virtual bool HasSourceAttribute() const = 0;
virtual bool IsConnected() const = 0;
virtual bool HasChildren() const = 0;
......
......@@ -289,7 +289,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
non_blocking_ = true;
// <spec step="4">Let source text be the element's child text content.</spec>
const String source_text = element_->TextFromChildren();
const String source_text = element_->ChildTextContent();
// <spec step="5">If the element has no src attribute, and source text is the
// empty string, then return. The script is not executed.</spec>
......@@ -387,7 +387,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
if (!element_->HasSourceAttribute() &&
!element_->AllowInlineScriptForCSP(element_->GetNonceForElement(),
position.line_,
element_->TextFromChildren())) {
element_->ChildTextContent())) {
return false;
}
......@@ -611,7 +611,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
// <spec step="24.1">Let src be the value of the element's src
// attribute.</spec>
//
// This step is done later as ScriptElementBase::TextFromChildren():
// This step is done later as ScriptElementBase::ChildTextContent():
// - in ScriptLoader::PrepareScript() (Step 26, 6th Clause),
// - in HTMLParserScriptRunner::ProcessScriptElementInternal()
// (Duplicated code of Step 26, 6th Clause),
......@@ -634,7 +634,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
// parse result, given source text, base URL and settings object. [spec
// text]
PendingImportMap* pending_import_map = PendingImportMap::CreateInline(
*element_, element_->TextFromChildren(), base_url);
*element_, element_->ChildTextContent(), base_url);
// Because we currently support inline import maps only, the pending
// import map is ready immediately and thus we call `register an import
......@@ -662,7 +662,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
}
prepared_pending_script_ = ClassicPendingScript::CreateInline(
element_, position, base_url, element_->TextFromChildren(),
element_, position, base_url, element_->ChildTextContent(),
script_location_type, options);
// <spec step="25.2.A.2">Set the script's script to script.</spec>
......@@ -690,7 +690,7 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
// be the result of creating a JavaScript module script using source
// text, settings object, base URL, and options.</spec>
ModuleScript* module_script = JSModuleScript::Create(
ParkableString(element_->TextFromChildren().Impl()), nullptr,
ParkableString(element_->ChildTextContent().Impl()), nullptr,
ScriptSourceLocationType::kInline, modulator, source_url, base_url,
options, position);
......
......@@ -107,8 +107,8 @@ String SVGScriptElement::TypeAttributeValue() const {
return getAttribute(svg_names::kTypeAttr).GetString();
}
String SVGScriptElement::TextFromChildren() {
return Element::TextFromChildren();
String SVGScriptElement::ChildTextContent() {
return TextFromChildren();
}
bool SVGScriptElement::HasSourceAttribute() const {
......
......@@ -81,7 +81,7 @@ class SVGScriptElement final : public SVGElement,
bool NomoduleAttributeValue() const override { return false; }
String SourceAttributeValue() const override;
String TypeAttributeValue() const override;
String TextFromChildren() override;
String ChildTextContent() override;
bool HasSourceAttribute() const override;
bool IsConnected() const override;
bool HasChildren() const override;
......
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