| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 | 61 |
| 62 if (m_element) { | 62 if (m_element) { |
| 63 if (m_element->document() != target->document()) { | 63 if (m_element->document() != target->document()) { |
| 64 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); | 64 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); | 67 enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); |
| 68 m_element = target; | 68 m_element = target; |
| 69 } else if (m_page->chrome()->client()->requestPointerLock()) { | 69 } else if (m_page->chrome().client()->requestPointerLock()) { |
| 70 m_lockPending = true; | 70 m_lockPending = true; |
| 71 m_element = target; | 71 m_element = target; |
| 72 } else { | 72 } else { |
| 73 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); | 73 enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void PointerLockController::requestPointerUnlock() | 77 void PointerLockController::requestPointerUnlock() |
| 78 { | 78 { |
| 79 return m_page->chrome()->client()->requestPointerUnlock(); | 79 return m_page->chrome().client()->requestPointerUnlock(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void PointerLockController::elementRemoved(Element* element) | 82 void PointerLockController::elementRemoved(Element* element) |
| 83 { | 83 { |
| 84 if (m_element == element) { | 84 if (m_element == element) { |
| 85 m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); | 85 m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); |
| 86 // Set element null immediately to block any future interaction with it | 86 // Set element null immediately to block any future interaction with it |
| 87 // including mouse events received before the unlock completes. | 87 // including mouse events received before the unlock completes. |
| 88 clearElement(); | 88 clearElement(); |
| 89 requestPointerUnlock(); | 89 requestPointerUnlock(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 enqueueEvent(type, element->document()); | 151 enqueueEvent(type, element->document()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) | 154 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) |
| 155 { | 155 { |
| 156 if (document) | 156 if (document) |
| 157 document->enqueueDocumentEvent(Event::create(type, true, false)); | 157 document->enqueueDocumentEvent(Event::create(type, true, false)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace WebCore | 160 } // namespace WebCore |
| OLD | NEW |