Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 #endif | 511 #endif |
| 512 | 512 |
| 513 resetLocation(); | 513 resetLocation(); |
| 514 | 514 |
| 515 LocalDOMWindow::notifyContextDestroyed(); | 515 LocalDOMWindow::notifyContextDestroyed(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void LocalDOMWindow::sendOrientationChangeEvent() | 518 void LocalDOMWindow::sendOrientationChangeEvent() |
| 519 { | 519 { |
| 520 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); | 520 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); |
| 521 ASSERT(frame()->isMainFrame()); | |
| 521 | 522 |
| 522 // Before dispatching the event, build a list of the child frames to | 523 // Before dispatching the event, build a list of all frames in the page |
| 523 // also send the event to, to mitigate side effects from event handlers | 524 // to send the event to, to mitigate side effects from event handlers |
| 524 // potentially interfering with others. | 525 // potentially interfering with others. |
| 525 WillBeHeapVector<RefPtrWillBeMember<Frame>> childFrames; | 526 WillBeHeapVector<RefPtrWillBeMember<Frame>> frames; |
| 526 for (Frame* child = frame()->tree().firstChild(); child; child = child->tree ().nextSibling()) { | 527 for (Frame* f = frame(); f; f = f->tree().traverseNext()) |
| 527 childFrames.append(child); | 528 frames.append(f); |
| 528 } | |
| 529 | 529 |
| 530 dispatchEvent(Event::create(EventTypeNames::orientationchange)); | 530 for (size_t i = 0; i < frames.size(); ++i) { |
| 531 | 531 if (!frames[i]->isLocalFrame()) |
| 532 for (size_t i = 0; i < childFrames.size(); ++i) { | |
| 533 if (!childFrames[i]->isLocalFrame()) | |
| 534 continue; | 532 continue; |
| 535 toLocalFrame(childFrames[i].get())->localDOMWindow()->sendOrientationCha ngeEvent(); | 533 toLocalFrame(frames[i].get())->localDOMWindow()->dispatchEvent(Event::cr eate(EventTypeNames::orientationchange)); |
|
dcheng
2015/06/10 17:46:12
Out of curiosity, what happens when we try to disp
esprehn
2015/06/11 01:57:12
That works fine, for example in script I can do:
| |
| 536 } | 534 } |
| 537 } | 535 } |
| 538 | 536 |
| 539 int LocalDOMWindow::orientation() const | 537 int LocalDOMWindow::orientation() const |
| 540 { | 538 { |
| 541 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); | 539 ASSERT(RuntimeEnabledFeatures::orientationEventEnabled()); |
| 542 | 540 |
| 543 if (!frame() || !frame()->host()) | 541 if (!frame() || !frame()->host()) |
| 544 return 0; | 542 return 0; |
| 545 | 543 |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1513 DOMWindow::trace(visitor); | 1511 DOMWindow::trace(visitor); |
| 1514 DOMWindowLifecycleNotifier::trace(visitor); | 1512 DOMWindowLifecycleNotifier::trace(visitor); |
| 1515 } | 1513 } |
| 1516 | 1514 |
| 1517 LocalFrame* LocalDOMWindow::frame() const | 1515 LocalFrame* LocalDOMWindow::frame() const |
| 1518 { | 1516 { |
| 1519 return m_frameObserver->frame(); | 1517 return m_frameObserver->frame(); |
| 1520 } | 1518 } |
| 1521 | 1519 |
| 1522 } // namespace blink | 1520 } // namespace blink |
| OLD | NEW |