Index: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
index 7fdceb563e02fc978e8b27d8013257a931985c6e..902af0ea546eccf37ed8a945f018c81f9b3855cc 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp |
@@ -529,21 +529,24 @@ void LocalDOMWindow::Reset() { |
void LocalDOMWindow::SendOrientationChangeEvent() { |
ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); |
- ASSERT(GetFrame()->IsMainFrame()); |
+ DCHECK(GetFrame()->IsLocalRoot()); |
// Before dispatching the event, build a list of all frames in the page |
// to send the event to, to mitigate side effects from event handlers |
// potentially interfering with others. |
- HeapVector<Member<Frame>> frames; |
- for (Frame* f = GetFrame(); f; f = f->Tree().TraverseNext()) |
- frames.push_back(f); |
- |
- for (size_t i = 0; i < frames.size(); ++i) { |
- if (!frames[i]->IsLocalFrame()) |
- continue; |
- ToLocalFrame(frames[i].Get()) |
- ->DomWindow() |
- ->DispatchEvent(Event::Create(EventTypeNames::orientationchange)); |
+ HeapVector<Member<LocalFrame>> frames; |
+ frames.push_back(GetFrame()); |
+ 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)); |
+ } |
+ } |
haraken
2017/04/25 12:35:39
What is this change for? Does TraverseNext not tra
lfg
2017/04/25 15:44:31
The problem with TraverseNext is that it traverses
|
+ |
+ for (LocalFrame* frame : frames) { |
+ frame->DomWindow()->DispatchEvent( |
haraken
2017/04/25 16:21:02
Nit: We should have renamed DomWindow to DOMWindow
|
+ Event::Create(EventTypeNames::orientationchange)); |
mlamouri (slow - plz ping)
2017/04/25 11:06:47
Note that screen orientation has two parts. One of
haraken
2017/04/25 12:35:39
Yeah , I'd also prefer not adding feature-specific
lfg
2017/04/25 15:44:31
Yes, this change is basically aligning LocalDOMWin
haraken
2017/04/25 16:21:02
Can we clean up the code a bit more so that we don
|
} |
} |