1. 05 Sep, 2012 1 commit
    • scheib@chromium.org's avatar
      webkitPointerLockElement returns null when pointer lock request is pending. · 575ba7c7
      scheib@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=91186
      
      Reviewed by Dimitri Glazkov.
      
      Source/WebCore:
      
      Script should wait for a pointerlockchange event before detecting
      if it has acquired lock. However, if a script attempted to poll
      pointerLockElement it could be confused when lock was still pending.
      This change ensures that if lock is not yet acquired then
      pointerLockElement will return null.
      
      Test: pointer-lock/pointerlockelement-null-when-pending.html
      
      * dom/Document.cpp:
      (WebCore::Document::webkitPointerLockElement):
      * page/PointerLockController.cpp:
      (WebCore::PointerLockController::requestPointerLock):
      (WebCore::PointerLockController::elementRemoved):
      (WebCore::PointerLockController::documentDetached):
      (WebCore::PointerLockController::lockPending):
      (WebCore):
      (WebCore::PointerLockController::didAcquirePointerLock):
      (WebCore::PointerLockController::didNotAcquirePointerLock):
      (WebCore::PointerLockController::didLosePointerLock):
      (WebCore::PointerLockController::clearElement):
      * page/PointerLockController.h:
      (PointerLockController):
      
      LayoutTests:
      
      * pointer-lock/locked-element-iframe-removed-from-dom-expected.txt:
      * pointer-lock/locked-element-iframe-removed-from-dom.html:
           Updated to reflect new behavior of null returned when lock is pending.
      * pointer-lock/pointerlockelement-null-when-pending-expected.txt: Added.
      * pointer-lock/pointerlockelement-null-when-pending.html: Added.
           New test specifically for testing null return when lock is pending.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      575ba7c7
  2. 23 Jul, 2012 1 commit
    • scheib@chromium.org's avatar
      webkitFullscreenElement, webkitCurrentFullScreenElement,... · e31007f1
      scheib@chromium.org authored
      webkitFullscreenElement, webkitCurrentFullScreenElement, webkitPointerLockElement block cross origin access.
      https://bugs.webkit.org/show_bug.cgi?id=91892
      
      Reviewed by Adam Barth.
      
      Source/WebCore:
      
      PointerLockElement only returned when requested from the document that owns it.
      
      Tests: http/tests/fullscreen/fullscreenelement-different-origin.html
             http/tests/fullscreen/fullscreenelement-same-origin.html
             http/tests/pointer-lock/pointerlockelement-different-origin.html
             http/tests/pointer-lock/pointerlockelement-same-origin.html
      
      * dom/Document.cpp:
      (WebCore::Document::webkitPointerLockElement):
      
      LayoutTests:
      
      Tests verifying the behavior of accessing
      webkitFullscreenElement, webkitCurrentFullScreenElement, webkitPointerLockElement
      from different origins.
      
      * http/tests/fullscreen/fullscreenelement-different-origin-expected.txt: Added.
      * http/tests/fullscreen/fullscreenelement-different-origin.html: Added.
      * http/tests/fullscreen/fullscreenelement-same-origin-expected.txt: Added.
      * http/tests/fullscreen/fullscreenelement-same-origin.html: Added.
      * http/tests/pointer-lock/pointerlockelement-different-origin-expected.txt: Added.
      * http/tests/pointer-lock/pointerlockelement-different-origin.html: Added.
      * http/tests/pointer-lock/pointerlockelement-same-origin-expected.txt: Added.
      * http/tests/pointer-lock/pointerlockelement-same-origin.html: Added.
      * http/tests/resources/pointer-lock/iframe-common.js: Added.
      (thisFileName):
      (window.onmessage):
      * http/tests/resources/pointer-lock/inner-iframe.html: Added.
      * http/tests/resources/pointer-lock/pointer-lock-test-harness.js:
      (runOnKeyPress.keypressHandler):
      * pointer-lock/locked-element-iframe-removed-from-dom-expected.txt:
      * pointer-lock/locked-element-iframe-removed-from-dom.html:
      * pointer-lock/locked-element-removed-from-dom-expected.txt:
      * pointer-lock/locked-element-removed-from-dom.html:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e31007f1
  3. 13 Jul, 2012 1 commit
    • scheib@chromium.org's avatar
      Pointer Lock handles disconnected DOM elements · fd0b8a9b
      scheib@chromium.org authored
      https://bugs.webkit.org/show_bug.cgi?id=77029
      
      Reviewed by Adrienne Walker.
      
      Source/WebCore:
      
      Pointer Lock Controller now checks when elements or documents are
      removed, and unlocks if the target element is being removed.
      
      Tests: pointer-lock/locked-element-iframe-removed-from-dom.html
             pointer-lock/locked-element-removed-from-dom.html
      
      * dom/Document.cpp:
      (WebCore::Document::detach):
      * dom/Element.cpp:
      (WebCore::Element::removedFrom):
      (WebCore::Element::webkitRequestPointerLock):
      * page/PointerLockController.cpp:
      (WebCore::PointerLockController::requestPointerLock):
      (WebCore::PointerLockController::elementRemoved):
      (WebCore):
      (WebCore::PointerLockController::documentDetached):
      (WebCore::PointerLockController::didLosePointerLock):
      (WebCore::PointerLockController::enqueueEvent):
      * page/PointerLockController.h:
      (WebCore):
      (PointerLockController):
      
      LayoutTests:
      
      Two new tests that verify pointer lock is released when the target
      is removed from the document.
      
      * pointer-lock/locked-element-iframe-removed-from-dom-expected.txt: Added.
      * pointer-lock/locked-element-iframe-removed-from-dom.html: Added.
      * pointer-lock/locked-element-removed-from-dom-expected.txt: Added.
      * pointer-lock/locked-element-removed-from-dom.html: Added.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      fd0b8a9b