OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 // we're done. | 1141 // we're done. |
1142 if (m_doingDragAndDrop) | 1142 if (m_doingDragAndDrop) |
1143 return true; | 1143 return true; |
1144 | 1144 |
1145 if (m_ignoreInputEvents) | 1145 if (m_ignoreInputEvents) |
1146 return true; | 1146 return true; |
1147 | 1147 |
1148 m_currentInputEvent = &inputEvent; | 1148 m_currentInputEvent = &inputEvent; |
1149 | 1149 |
1150 if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.t
ype)) { | 1150 if (m_mouseCaptureNode.get() && WebInputEvent::isMouseEventType(inputEvent.t
ype)) { |
1151 const int mouseButtonModifierMask = WebInputEvent::LeftButtonDown | WebI
nputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown; | 1151 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. |
1152 if (inputEvent.type == WebInputEvent::MouseDown || | 1152 RefPtr<Node> node = m_mouseCaptureNode; |
1153 (inputEvent.modifiers & mouseButtonModifierMask) == 0) { | 1153 |
1154 // It's possible the mouse was released and we didn't get the "up" | 1154 // Not all platforms call mouseCaptureLost() directly. |
1155 // message. This can happen if a dialog pops up while the mouse is | 1155 if (inputEvent.type == WebInputEvent::MouseUp) |
1156 // held, for example. This will leave us "stuck" in capture mode. | |
1157 // If we get a new mouse down message or any other mouse message | |
1158 // where no "down" flags are set, we know the user is no longer | |
1159 // dragging and we can release the capture and fall through to the | |
1160 // regular event processing. | |
1161 mouseCaptureLost(); | 1156 mouseCaptureLost(); |
1162 } else { | |
1163 // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | |
1164 RefPtr<Node> node = m_mouseCaptureNode; | |
1165 | 1157 |
1166 // Not all platforms call mouseCaptureLost() directly. | 1158 AtomicString eventType; |
1167 if (inputEvent.type == WebInputEvent::MouseUp) | 1159 switch (inputEvent.type) { |
1168 mouseCaptureLost(); | 1160 case WebInputEvent::MouseMove: |
| 1161 eventType = eventNames().mousemoveEvent; |
| 1162 break; |
| 1163 case WebInputEvent::MouseLeave: |
| 1164 eventType = eventNames().mouseoutEvent; |
| 1165 break; |
| 1166 case WebInputEvent::MouseDown: |
| 1167 eventType = eventNames().mousedownEvent; |
| 1168 break; |
| 1169 case WebInputEvent::MouseUp: |
| 1170 eventType = eventNames().mouseupEvent; |
| 1171 break; |
| 1172 default: |
| 1173 ASSERT_NOT_REACHED(); |
| 1174 } |
1169 | 1175 |
1170 AtomicString eventType; | 1176 node->dispatchMouseEvent( |
1171 switch (inputEvent.type) { | 1177 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *static_ca
st<const WebMouseEvent*>(&inputEvent)), |
1172 case WebInputEvent::MouseMove: | 1178 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->clickCo
unt); |
1173 eventType = eventNames().mousemoveEvent; | 1179 m_currentInputEvent = 0; |
1174 break; | 1180 return true; |
1175 case WebInputEvent::MouseLeave: | |
1176 eventType = eventNames().mouseoutEvent; | |
1177 break; | |
1178 case WebInputEvent::MouseDown: | |
1179 eventType = eventNames().mousedownEvent; | |
1180 break; | |
1181 case WebInputEvent::MouseUp: | |
1182 eventType = eventNames().mouseupEvent; | |
1183 break; | |
1184 default: | |
1185 ASSERT_NOT_REACHED(); | |
1186 } | |
1187 | |
1188 node->dispatchMouseEvent( | |
1189 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), *stati
c_cast<const WebMouseEvent*>(&inputEvent)), | |
1190 eventType, static_cast<const WebMouseEvent*>(&inputEvent)->cli
ckCount); | |
1191 m_currentInputEvent = 0; | |
1192 return true; | |
1193 } | |
1194 } | 1181 } |
1195 | 1182 |
1196 bool handled = true; | 1183 bool handled = true; |
1197 | 1184 |
1198 // FIXME: WebKit seems to always return false on mouse events processing | 1185 // FIXME: WebKit seems to always return false on mouse events processing |
1199 // methods. For now we'll assume it has processed them (as we are only | 1186 // methods. For now we'll assume it has processed them (as we are only |
1200 // interested in whether keyboard events are processed). | 1187 // interested in whether keyboard events are processed). |
1201 switch (inputEvent.type) { | 1188 switch (inputEvent.type) { |
1202 case WebInputEvent::MouseMove: | 1189 case WebInputEvent::MouseMove: |
1203 mouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); | 1190 mouseMove(*static_cast<const WebMouseEvent*>(&inputEvent)); |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getComp
ositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyTo
HostWindow); | 2494 m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getComp
ositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyTo
HostWindow); |
2508 if (m_temporaryOnscreenGraphicsContext3D) | 2495 if (m_temporaryOnscreenGraphicsContext3D) |
2509 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.wid
th), std::max(1, m_size.height)); | 2496 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.wid
th), std::max(1, m_size.height)); |
2510 return GraphicsContext3DInternal::extractWebGraphicsContext3D(m_temporar
yOnscreenGraphicsContext3D.get()); | 2497 return GraphicsContext3DInternal::extractWebGraphicsContext3D(m_temporar
yOnscreenGraphicsContext3D.get()); |
2511 } | 2498 } |
2512 #endif | 2499 #endif |
2513 return 0; | 2500 return 0; |
2514 } | 2501 } |
2515 | 2502 |
2516 } // namespace WebKit | 2503 } // namespace WebKit |
OLD | NEW |