| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
| 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 * * Redistributions of source code must retain the above copyright | 7 * * 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 * * Redistributions in binary form must reproduce the above copyright | 9 * * 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 15 matching lines...) Expand all Loading... |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "core/dom/Touch.h" | 28 #include "core/dom/Touch.h" |
| 29 | 29 |
| 30 #include "core/frame/FrameView.h" | 30 #include "core/frame/FrameView.h" |
| 31 #include "core/frame/LocalFrame.h" | 31 #include "core/frame/LocalFrame.h" |
| 32 #include "platform/geometry/FloatPoint.h" | 32 #include "platform/geometry/FloatPoint.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 static FloatPoint contentsOffset(LocalFrame* frame) | |
| 37 { | |
| 38 if (!frame) | |
| 39 return FloatPoint(); | |
| 40 FrameView* frameView = frame->view(); | |
| 41 if (!frameView) | |
| 42 return FloatPoint(); | |
| 43 float scale = 1.0f / frame->pageZoomFactor(); | |
| 44 return FloatPoint(frameView->scrollPosition()).scaledBy(scale); | |
| 45 } | |
| 46 | |
| 47 Touch::Touch(LocalFrame* frame, EventTarget* target, unsigned identifier, const
FloatPoint& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float
rotationAngle, float force) | 36 Touch::Touch(LocalFrame* frame, EventTarget* target, unsigned identifier, const
FloatPoint& screenPos, const FloatPoint& pagePos, const FloatSize& radius, float
rotationAngle, float force) |
| 48 : m_target(target) | 37 : m_target(target) |
| 49 , m_identifier(identifier) | 38 , m_identifier(identifier) |
| 50 , m_clientPos(pagePos - contentsOffset(frame)) | 39 , m_clientPos(pagePos) |
| 51 , m_screenPos(screenPos) | 40 , m_screenPos(screenPos) |
| 52 , m_pagePos(pagePos) | 41 , m_pagePos(pagePos) |
| 53 , m_radius(radius) | 42 , m_radius(radius) |
| 54 , m_rotationAngle(rotationAngle) | 43 , m_rotationAngle(rotationAngle) |
| 55 , m_force(force) | 44 , m_force(force) |
| 56 { | 45 { |
| 57 ScriptWrappable::init(this); | 46 ScriptWrappable::init(this); |
| 58 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; | 47 float scaleFactor = frame ? frame->pageZoomFactor() : 1.0f; |
| 59 m_absoluteLocation = roundedLayoutPoint(pagePos.scaledBy(scaleFactor)); | 48 m_absoluteLocation = roundedLayoutPoint(pagePos.scaledBy(scaleFactor)); |
| 60 } | 49 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 { | 66 { |
| 78 return adoptRefWillBeNoop(new Touch(eventTarget, m_identifier, m_clientPos,
m_screenPos, m_pagePos, m_radius, m_rotationAngle, m_force, m_absoluteLocation))
; | 67 return adoptRefWillBeNoop(new Touch(eventTarget, m_identifier, m_clientPos,
m_screenPos, m_pagePos, m_radius, m_rotationAngle, m_force, m_absoluteLocation))
; |
| 79 } | 68 } |
| 80 | 69 |
| 81 void Touch::trace(Visitor* visitor) | 70 void Touch::trace(Visitor* visitor) |
| 82 { | 71 { |
| 83 visitor->trace(m_target); | 72 visitor->trace(m_target); |
| 84 } | 73 } |
| 85 | 74 |
| 86 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |