Index: Source/core/frame/LocalFrame.cpp |
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp |
index 7d801447ee086cc95ec36cf16c02b687e1f3008b..366b8f016ab3270992d0c20a59aa0c703e6113e9 100644 |
--- a/Source/core/frame/LocalFrame.cpp |
+++ b/Source/core/frame/LocalFrame.cpp |
@@ -159,6 +159,30 @@ |
} |
} |
+void LocalFrame::sendOrientationChangeEvent() |
+{ |
+ if (!RuntimeEnabledFeatures::orientationEventEnabled() && !RuntimeEnabledFeatures::screenOrientationEnabled()) |
+ return; |
+ |
+ if (page()->visibilityState() != PageVisibilityStateVisible) |
+ return; |
+ |
+ LocalDOMWindow* window = domWindow(); |
+ if (!window) |
+ return; |
+ window->dispatchEvent(Event::create(EventTypeNames::orientationchange)); |
+ |
+ // Notify subframes. |
+ Vector<RefPtr<LocalFrame> > childFrames; |
+ for (Frame* child = tree().firstChild(); child; child = child->tree().nextSibling()) { |
+ if (child->isLocalFrame()) |
+ childFrames.append(toLocalFrame(child)); |
+ } |
+ |
+ for (size_t i = 0; i < childFrames.size(); ++i) |
+ childFrames[i]->sendOrientationChangeEvent(); |
+} |
+ |
void LocalFrame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio) |
{ |
// In setting printing, we should not validate resources already cached for the document. |