2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
29 #include "Arguments.h"
30 #include "WebCoreArgumentCoders.h"
32 using namespace WebCore;
36 WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Modifiers modifiers, double timestamp)
37 : WebEvent(type, modifiers, timestamp)
38 , m_position(position)
39 , m_globalPosition(globalPosition)
41 , m_wheelTicks(wheelTicks)
42 , m_granularity(granularity)
43 , m_directionInvertedFromDevice(false)
46 , m_hasPreciseScrollingDeltas(false)
50 ASSERT(isWheelEventType(type));
54 WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, bool directionInvertedFromDevice, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, Modifiers modifiers, double timestamp)
55 : WebEvent(type, modifiers, timestamp)
56 , m_position(position)
57 , m_globalPosition(globalPosition)
59 , m_wheelTicks(wheelTicks)
60 , m_granularity(granularity)
61 , m_directionInvertedFromDevice(directionInvertedFromDevice)
63 , m_momentumPhase(momentumPhase)
64 , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
65 , m_scrollCount(scrollCount)
66 , m_unacceleratedScrollingDelta(unacceleratedScrollingDelta)
68 ASSERT(isWheelEventType(type));
72 void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
74 WebEvent::encode(encoder);
76 encoder->encode(m_position);
77 encoder->encode(m_globalPosition);
78 encoder->encode(m_delta);
79 encoder->encode(m_wheelTicks);
80 encoder->encode(m_granularity);
81 encoder->encode(m_directionInvertedFromDevice);
83 encoder->encode(m_phase);
84 encoder->encode(m_momentumPhase);
85 encoder->encode(m_hasPreciseScrollingDeltas);
86 encoder->encode(m_scrollCount);
87 encoder->encode(m_unacceleratedScrollingDelta);
91 bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t)
93 if (!WebEvent::decode(decoder, t))
95 if (!decoder->decode(t.m_position))
97 if (!decoder->decode(t.m_globalPosition))
99 if (!decoder->decode(t.m_delta))
101 if (!decoder->decode(t.m_wheelTicks))
103 if (!decoder->decode(t.m_granularity))
105 if (!decoder->decode(t.m_directionInvertedFromDevice))
108 if (!decoder->decode(t.m_phase))
110 if (!decoder->decode(t.m_momentumPhase))
112 if (!decoder->decode(t.m_hasPreciseScrollingDeltas))
114 if (!decoder->decode(t.m_scrollCount))
116 if (!decoder->decode(t.m_unacceleratedScrollingDelta))
122 bool WebWheelEvent::isWheelEventType(Type type)
124 return type == Wheel;
127 } // namespace WebKit