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() { ...@@ -103,15 +103,15 @@ void ScreenOrientationController::UpdateOrientation() {
DCHECK(orientation_); DCHECK(orientation_);
DCHECK(GetPage()); DCHECK(GetPage());
ChromeClient& chrome_client = GetPage()->GetChromeClient(); 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 = mojom::blink::ScreenOrientation orientation_type =
screen_info.orientation_type; screen_info.orientation_type;
if (orientation_type == mojom::blink::ScreenOrientation::kUndefined) { if (orientation_type == mojom::blink::ScreenOrientation::kUndefined) {
// The embedder could not provide us with an orientation, deduce it // The embedder could not provide us with an orientation, deduce it
// ourselves. // ourselves.
orientation_type = orientation_type = ComputeOrientation(
ComputeOrientation(chrome_client.GetScreenInfo(*GetFrame()).rect, chrome_client.GetScreenInfo(frame).rect, screen_info.orientation_angle);
screen_info.orientation_angle);
} }
DCHECK(orientation_type != mojom::blink::ScreenOrientation::kUndefined); DCHECK(orientation_type != mojom::blink::ScreenOrientation::kUndefined);
...@@ -132,15 +132,16 @@ void ScreenOrientationController::PageVisibilityChanged() { ...@@ -132,15 +132,16 @@ void ScreenOrientationController::PageVisibilityChanged() {
// The orientation type and angle are tied in a way that if the angle has // The orientation type and angle are tied in a way that if the angle has
// changed, the type must have changed. // changed, the type must have changed.
LocalFrame& frame = *DomWindow()->GetFrame();
uint16_t current_angle = uint16_t current_angle =
GetPage()->GetChromeClient().GetScreenInfo(*GetFrame()).orientation_angle; GetPage()->GetChromeClient().GetScreenInfo(frame).orientation_angle;
// FIXME: sendOrientationChangeEvent() currently send an event all the // FIXME: sendOrientationChangeEvent() currently send an event all the
// children of the frame, so it should only be called on the frame on // 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 // top of the tree. We would need the embedder to call
// sendOrientationChangeEvent on every WebFrame part of a WebView to be // sendOrientationChangeEvent on every WebFrame part of a WebView to be
// able to remove this. // able to remove this.
if (GetFrame() == GetFrame()->LocalFrameRoot() && if (&frame == frame.LocalFrameRoot() &&
orientation_->angle() != current_angle) orientation_->angle() != current_angle)
NotifyOrientationChanged(); NotifyOrientationChanged();
} }
...@@ -150,8 +151,8 @@ void ScreenOrientationController::NotifyOrientationChanged() { ...@@ -150,8 +151,8 @@ void ScreenOrientationController::NotifyOrientationChanged() {
// current frame as it will prevent side effects from the change event // current frame as it will prevent side effects from the change event
// handlers. // handlers.
HeapVector<Member<LocalFrame>> frames; HeapVector<Member<LocalFrame>> frames;
for (Frame* frame = GetFrame(); frame; for (Frame* frame = DomWindow()->GetFrame(); frame;
frame = frame->Tree().TraverseNext(GetFrame())) { frame = frame->Tree().TraverseNext(DomWindow()->GetFrame())) {
if (auto* local_frame = DynamicTo<LocalFrame>(frame)) if (auto* local_frame = DynamicTo<LocalFrame>(frame))
frames.push_back(local_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