Commit 7aac40cb authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

ExecutionContext post-migration cleaniup - core/layout/

While migrating ExecutionContext to LocalDOMWindow, several helpers
were introduced on Document (From(), DynamicFrom(),
ToExecutionContext()). This CL removes usage of these types from this
directory.

From() and DynamicFrom() are replaced with the standard
downcast helpers for LocalDOMWindow. ToExecutionContext() is replaced
with a direct path to the LocalDOMWindow, or Node::GetExecutionContext(),
or Document::GetExecutionContext(), whichever is most direct from the
callsite.

Bug: 1029822
Change-Id: I83d37613caac05b54db3e7ca9e31c9bb9036e64e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106805Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751536}
parent ee530378
......@@ -54,7 +54,7 @@ TEST_F(LayoutBlockTest, WidthAvailableToChildrenChanged) {
150 - list_box->VerticalScrollbarWidth());
DummyExceptionStateForTesting exception_state;
list_element->style()->setCSSText(GetDocument().ToExecutionContext(),
list_element->style()->setCSSText(GetDocument().GetExecutionContext(),
"width:150px;height:100px;",
exception_state);
ASSERT_FALSE(exception_state.HadException());
......
......@@ -59,8 +59,9 @@ bool LayoutWorklet::NeedsToCreateGlobalScope() {
WorkletGlobalScopeProxy* LayoutWorklet::CreateGlobalScope() {
DCHECK(NeedsToCreateGlobalScope());
return MakeGarbageCollected<LayoutWorkletGlobalScopeProxy>(
Document::From(GetExecutionContext())->GetFrame(), ModuleResponsesMap(),
pending_layout_registry_, GetNumberOfGlobalScopes() + 1);
To<LocalDOMWindow>(GetExecutionContext())->GetFrame(),
ModuleResponsesMap(), pending_layout_registry_,
GetNumberOfGlobalScopes() + 1);
}
} // namespace blink
......@@ -104,7 +104,7 @@ void LayoutWorkletGlobalScope::registerLayout(
Vector<AtomicString> custom_invalidation_properties;
if (!V8ObjectParser::ParseCSSPropertyList(
current_context, GetFrame()->GetDocument()->ToExecutionContext(),
current_context, GetFrame()->DomWindow(),
layout_ctor->CallbackObject(), "inputProperties",
&native_invalidation_properties, &custom_invalidation_properties,
&exception_state))
......@@ -114,7 +114,7 @@ void LayoutWorkletGlobalScope::registerLayout(
Vector<AtomicString> child_custom_invalidation_properties;
if (!V8ObjectParser::ParseCSSPropertyList(
current_context, GetFrame()->GetDocument()->ToExecutionContext(),
current_context, GetFrame()->DomWindow(),
layout_ctor->CallbackObject(), "childInputProperties",
&child_native_invalidation_properties,
&child_custom_invalidation_properties, &exception_state))
......@@ -145,8 +145,7 @@ void LayoutWorkletGlobalScope::registerLayout(
child_custom_invalidation_properties);
layout_definitions_.Set(name, definition);
LayoutWorklet* layout_worklet =
LayoutWorklet::From(*GetFrame()->GetDocument()->domWindow());
LayoutWorklet* layout_worklet = LayoutWorklet::From(*GetFrame()->DomWindow());
LayoutWorklet::DocumentDefinitionMap* document_definition_map =
layout_worklet->GetDocumentDefinitionMap();
if (document_definition_map->Contains(name)) {
......
......@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/loader/worker_fetch_context.h"
......@@ -49,7 +50,7 @@ LayoutWorkletGlobalScopeProxy::LayoutWorkletGlobalScopeProxy(
nullptr /* worker_clients */,
frame->Client()->CreateWorkerContentSettingsClient(),
document->GetSecurityContext().AddressSpace(),
OriginTrialContext::GetTokens(document->ToExecutionContext()).get(),
OriginTrialContext::GetTokens(frame->DomWindow()).get(),
base::UnguessableToken::Create(), nullptr /* worker_settings */,
kV8CacheOptionsDefault, module_responses_map,
mojo::NullRemote() /* browser_interface_broker */,
......
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