| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (m_element) { | 61 if (m_element) { |
| 62 if (m_element->document() != target->document()) { | 62 if (m_element->document() != target->document()) { |
| 63 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); | 63 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); | 66 enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); |
| 67 m_element = target; | 67 m_element = target; |
| 68 } else if (m_page->chrome().client()->requestPointerLock()) { | 68 } else if (m_page->chrome().client().requestPointerLock()) { |
| 69 m_lockPending = true; | 69 m_lockPending = true; |
| 70 m_element = target; | 70 m_element = target; |
| 71 } else { | 71 } else { |
| 72 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); | 72 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void PointerLockController::requestPointerUnlock() | 76 void PointerLockController::requestPointerUnlock() |
| 77 { | 77 { |
| 78 return m_page->chrome().client()->requestPointerUnlock(); | 78 return m_page->chrome().client().requestPointerUnlock(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void PointerLockController::elementRemoved(Element* element) | 81 void PointerLockController::elementRemoved(Element* element) |
| 82 { | 82 { |
| 83 if (m_element == element) { | 83 if (m_element == element) { |
| 84 m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); | 84 m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); |
| 85 // Set element null immediately to block any future interaction with it | 85 // Set element null immediately to block any future interaction with it |
| 86 // including mouse events received before the unlock completes. | 86 // including mouse events received before the unlock completes. |
| 87 clearElement(); | 87 clearElement(); |
| 88 requestPointerUnlock(); | 88 requestPointerUnlock(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 enqueueEvent(type, element->document()); | 150 enqueueEvent(type, element->document()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) | 153 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) |
| 154 { | 154 { |
| 155 if (document) | 155 if (document) |
| 156 document->enqueueDocumentEvent(Event::create(type, true, false)); | 156 document->enqueueDocumentEvent(Event::create(type, true, false)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace WebCore | 159 } // namespace WebCore |
| OLD | NEW |