New issue
Advanced search Search tips

Issue 726912 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Provide a local root traversal function

Project Member Reported by dcheng@chromium.org, May 26 2017

Issue description

SendOrientationChangeEvent() only sends events to the frame and immediate local children: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp?rcl=756189476715f0585dc70426f734a46be74d585e&l=520

So if a frame, child, and grandchild are all local frames, the grandchild won't get the orientation change event.

(We should probably audit other calls to FrameTree::NextSibling() as well: some of these are recursive, so it's OK, but others are not)
 

Comment 1 by lfg@chromium.org, May 30 2017

This is actually correct, the OnOrientationChange event is dispatched to every local root: https://cs.chromium.org/chromium/src/content/renderer/render_widget.cc?l=1941

So the grandchild will receive the event via a separate message (though it'll be asynchronous, not sure if this matters).

Comment 2 by creis@chromium.org, May 30 2017

Owner: lfg@chromium.org
Status: Assigned (was: Available)
As dcheng@ noted in the meeting today, it sounds like this would matter for nested same-process frames.  lfg@ said he could take a look.  (Thanks!)

Comment 3 by lfg@chromium.org, May 30 2017

Ah, sorry, I misunderstood Daniel's point, I thought he was referencing a A-B-A case.

However, for the A(1)-A(2)-A(3) case, I think the code is also correct:

  HeapVector<Member<LocalFrame>> frames;
  frames.push_back(GetFrame()); // root frame A(1) gets added here to frames[0]
  for (size_t i = 0; i < frames.size(); i++) {
    for (Frame* child = frames[i]->Tree().FirstChild(); child;
         child = child->Tree().NextSibling()) {
      if (child->IsLocalFrame())
        frames.push_back(ToLocalFrame(child)); // A(2) gets added while iterating over A[1]'s children; now frames.size() is bigger. A(2)'s children will be iterated over in the next iteration of the outer for loop, where we add A(3) to the array.
    }
  }

Comment 4 by kenrb@chromium.org, May 31 2017

This looks correct to me also.

Comment 5 by dcheng@chromium.org, May 31 2017

Labels: -Pri-1 Pri-2
Summary: Provide a local root traversal function (was: screen orientation events don't dispatch to every frame in OOPIF)
We probably need something a bit clearer to iterate over just things in the local root. I misread the code. =)

I've retitled the bug accordingly; one (simple) solution is to just use TraverseNext(), but we could consider specializing a LocalFrame version for traversing local roots.

Comment 6 by lfg@chromium.org, May 31 2017

I agree with you, I'll work on improving this interface.

Comment 7 by lfg@chromium.org, Jun 16 2017

Components: -Blink>ScreenOrientation
Status: Started (was: Assigned)

Comment 8 by lfg@chromium.org, Sep 26 2017

Status: WontFix (was: Started)
Marking as WontFix. Unsure whether its worth adding this API given there's only a single use-case. WIP CL: https://chromium-review.googlesource.com/c/chromium/src/+/538258

Sign in to add a comment