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