| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void PointerLockController::didNotAcquirePointerLock() | 118 void PointerLockController::didNotAcquirePointerLock() |
| 119 { | 119 { |
| 120 enqueueEvent(EventTypeNames::webkitpointerlockerror, m_element.get()); | 120 enqueueEvent(EventTypeNames::webkitpointerlockerror, m_element.get()); |
| 121 clearElement(); | 121 clearElement(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void PointerLockController::didLosePointerLock() | 124 void PointerLockController::didLosePointerLock() |
| 125 { | 125 { |
| 126 enqueueEvent(EventTypeNames::webkitpointerlockchange, m_element ? &m_element
->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get()); | 126 enqueueEvent(EventTypeNames::webkitpointerlockchange, m_element ? &m_element
->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get()); |
| 127 clearElement(); | 127 clearElement(); |
| 128 m_documentOfRemovedElementWhileWaitingForUnlock = 0; | 128 m_documentOfRemovedElementWhileWaitingForUnlock = nullptr; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void PointerLockController::dispatchLockedMouseEvent(const PlatformMouseEvent& e
vent, const AtomicString& eventType) | 131 void PointerLockController::dispatchLockedMouseEvent(const PlatformMouseEvent& e
vent, const AtomicString& eventType) |
| 132 { | 132 { |
| 133 if (!m_element || !m_element->document().frame()) | 133 if (!m_element || !m_element->document().frame()) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 m_element->dispatchMouseEvent(event, eventType, event.clickCount()); | 136 m_element->dispatchMouseEvent(event, eventType, event.clickCount()); |
| 137 | 137 |
| 138 // Create click events | 138 // Create click events |
| 139 if (eventType == EventTypeNames::mouseup) | 139 if (eventType == EventTypeNames::mouseup) |
| 140 m_element->dispatchMouseEvent(event, EventTypeNames::click, event.clickC
ount()); | 140 m_element->dispatchMouseEvent(event, EventTypeNames::click, event.clickC
ount()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void PointerLockController::clearElement() | 143 void PointerLockController::clearElement() |
| 144 { | 144 { |
| 145 m_lockPending = false; | 145 m_lockPending = false; |
| 146 m_element = 0; | 146 m_element = nullptr; |
| 147 } | 147 } |
| 148 | 148 |
| 149 void PointerLockController::enqueueEvent(const AtomicString& type, Element* elem
ent) | 149 void PointerLockController::enqueueEvent(const AtomicString& type, Element* elem
ent) |
| 150 { | 150 { |
| 151 if (element) | 151 if (element) |
| 152 enqueueEvent(type, &element->document()); | 152 enqueueEvent(type, &element->document()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) | 155 void PointerLockController::enqueueEvent(const AtomicString& type, Document* doc
ument) |
| 156 { | 156 { |
| 157 if (document && document->domWindow()) | 157 if (document && document->domWindow()) |
| 158 document->domWindow()->enqueueDocumentEvent(Event::create(type)); | 158 document->domWindow()->enqueueDocumentEvent(Event::create(type)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace WebCore | 161 } // namespace WebCore |
| OLD | NEW |