Commit c14be4a3 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Remove usage of ExecutionContextLifecycleObserver::GetFrame() in ScreenOrientationController

Change-Id: I557b2aa89ec0a737e1d5b315b3d06fe12148b778
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500271
Commit-Queue: Nate Chapin <japhet@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Nate Chapin <japhet@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821027}
parent 172bca0e
......@@ -103,15 +103,15 @@ void ScreenOrientationController::UpdateOrientation() {
DCHECK(orientation_);
DCHECK(GetPage());
ChromeClient& chrome_client = GetPage()->GetChromeClient();
ScreenInfo screen_info = chrome_client.GetScreenInfo(*GetFrame());
LocalFrame& frame = *DomWindow()->GetFrame();
ScreenInfo screen_info = chrome_client.GetScreenInfo(frame);
mojom::blink::ScreenOrientation orientation_type =
screen_info.orientation_type;
if (orientation_type == mojom::blink::ScreenOrientation::kUndefined) {
// The embedder could not provide us with an orientation, deduce it
// ourselves.
orientation_type =
ComputeOrientation(chrome_client.GetScreenInfo(*GetFrame()).rect,
screen_info.orientation_angle);
orientation_type = ComputeOrientation(
chrome_client.GetScreenInfo(frame).rect, screen_info.orientation_angle);
}
DCHECK(orientation_type != mojom::blink::ScreenOrientation::kUndefined);
......@@ -132,15 +132,16 @@ void ScreenOrientationController::PageVisibilityChanged() {
// The orientation type and angle are tied in a way that if the angle has
// changed, the type must have changed.
LocalFrame& frame = *DomWindow()->GetFrame();
uint16_t current_angle =
GetPage()->GetChromeClient().GetScreenInfo(*GetFrame()).orientation_angle;
GetPage()->GetChromeClient().GetScreenInfo(frame).orientation_angle;
// FIXME: sendOrientationChangeEvent() currently send an event all the
// children of the frame, so it should only be called on the frame on
// top of the tree. We would need the embedder to call
// sendOrientationChangeEvent on every WebFrame part of a WebView to be
// able to remove this.
if (GetFrame() == GetFrame()->LocalFrameRoot() &&
if (&frame == frame.LocalFrameRoot() &&
orientation_->angle() != current_angle)
NotifyOrientationChanged();
}
......@@ -150,8 +151,8 @@ void ScreenOrientationController::NotifyOrientationChanged() {
// current frame as it will prevent side effects from the change event
// handlers.
HeapVector<Member<LocalFrame>> frames;
for (Frame* frame = GetFrame(); frame;
frame = frame->Tree().TraverseNext(GetFrame())) {
for (Frame* frame = DomWindow()->GetFrame(); frame;
frame = frame->Tree().TraverseNext(DomWindow()->GetFrame())) {
if (auto* local_frame = DynamicTo<LocalFrame>(frame))
frames.push_back(local_frame);
}
......
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