| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return TransformWebTouchEvent(frameScale(frameViewBase), | 194 return TransformWebTouchEvent(frameScale(frameViewBase), |
| 195 frameTranslation(frameViewBase), event); | 195 frameTranslation(frameViewBase), event); |
| 196 } | 196 } |
| 197 | 197 |
| 198 WebMouseEventBuilder::WebMouseEventBuilder(const FrameViewBase* frameViewBase, | 198 WebMouseEventBuilder::WebMouseEventBuilder(const FrameViewBase* frameViewBase, |
| 199 const LayoutItem layoutItem, | 199 const LayoutItem layoutItem, |
| 200 const MouseEvent& event) { | 200 const MouseEvent& event) { |
| 201 if (event.nativeEvent()) { | 201 if (event.nativeEvent()) { |
| 202 *static_cast<WebMouseEvent*>(this) = | 202 *static_cast<WebMouseEvent*>(this) = |
| 203 event.nativeEvent()->flattenTransform(); | 203 event.nativeEvent()->flattenTransform(); |
| 204 WebFloatPoint absoluteRootFrameLocation = positionInRootFrame(); | 204 WebFloatPoint absoluteLocation = positionInRootFrame(); |
| 205 |
| 206 FrameView* view = frameViewBase ? toFrameView(frameViewBase->parent()) : 0; |
| 207 |
| 208 // Translate the root frame position to content coordinates. |
| 209 if (view) { |
| 210 absoluteLocation = view->rootFrameToContents(absoluteLocation); |
| 211 } |
| 212 |
| 205 IntPoint localPoint = roundedIntPoint( | 213 IntPoint localPoint = roundedIntPoint( |
| 206 layoutItem.absoluteToLocal(absoluteRootFrameLocation, UseTransforms)); | 214 layoutItem.absoluteToLocal(absoluteLocation, UseTransforms)); |
| 207 x = localPoint.x(); | 215 x = localPoint.x(); |
| 208 y = localPoint.y(); | 216 y = localPoint.y(); |
| 209 return; | 217 return; |
| 210 } | 218 } |
| 211 | 219 |
| 212 // Code below here can be removed once OOPIF ships. | 220 // Code below here can be removed once OOPIF ships. |
| 213 // OOPIF will prevent synthetic events being dispatched into | 221 // OOPIF will prevent synthetic events being dispatched into |
| 214 // other frames; but for now we allow the fallback to generate | 222 // other frames; but for now we allow the fallback to generate |
| 215 // WebMouseEvents from synthetic events. | 223 // WebMouseEvents from synthetic events. |
| 216 if (event.type() == EventTypeNames::mousemove) | 224 if (event.type() == EventTypeNames::mousemove) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 Vector<WebTouchEvent> result; | 378 Vector<WebTouchEvent> result; |
| 371 for (const auto& event : coalescedEvents) { | 379 for (const auto& event : coalescedEvents) { |
| 372 DCHECK(WebInputEvent::isTouchEventType(event->type())); | 380 DCHECK(WebInputEvent::isTouchEventType(event->type())); |
| 373 result.push_back(TransformWebTouchEvent( | 381 result.push_back(TransformWebTouchEvent( |
| 374 scale, translation, static_cast<const WebTouchEvent&>(*event))); | 382 scale, translation, static_cast<const WebTouchEvent&>(*event))); |
| 375 } | 383 } |
| 376 return result; | 384 return result; |
| 377 } | 385 } |
| 378 | 386 |
| 379 } // namespace blink | 387 } // namespace blink |
| OLD | NEW |