Ignore contiguous composition event.
[framework/web/webkit-efl.git] / Source / WebKit2 / Shared / WebPopupItem.cpp
1 /*
2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25
26 #include "config.h"
27
28 #include "WebPopupItem.h"
29
30 #include "ArgumentCoders.h"
31 #include "Arguments.h"
32
33 using namespace WebCore;
34
35 namespace WebKit {
36
37 WebPopupItem::WebPopupItem()
38     : m_type(Item)
39     , m_textDirection(LTR)
40     , m_hasTextDirectionOverride(false)
41     , m_isEnabled(true)
42     , m_isSelected(false)
43 {
44 }
45
46 WebPopupItem::WebPopupItem(Type type)
47     : m_type(type)
48     , m_textDirection(LTR)
49     , m_hasTextDirectionOverride(false)
50     , m_isEnabled(true)
51     , m_isLabel(false)
52     , m_isSelected(false)
53 {
54 }
55
56 WebPopupItem::WebPopupItem(Type type, const String& text, TextDirection textDirection, bool hasTextDirectionOverride, const String& toolTip, const String& accessibilityText, bool isEnabled, bool isLabel, bool isSelected)
57     : m_type(type)
58     , m_text(text)
59     , m_textDirection(textDirection)
60     , m_hasTextDirectionOverride(hasTextDirectionOverride)
61     , m_toolTip(toolTip)
62     , m_accessibilityText(accessibilityText)
63     , m_isEnabled(isEnabled)
64     , m_isLabel(isLabel)
65     , m_isSelected(isSelected)
66 {
67 }
68
69 void WebPopupItem::encode(CoreIPC::ArgumentEncoder* encoder) const
70 {
71     encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), m_text, static_cast<uint64_t>(m_textDirection), m_hasTextDirectionOverride, m_toolTip, m_accessibilityText, m_isEnabled, m_isLabel));
72     encoder->encode(CoreIPC::In(m_isSelected));
73 }
74
75 bool WebPopupItem::decode(CoreIPC::ArgumentDecoder* decoder, WebPopupItem& item)
76 {
77     uint32_t type;
78     String text;
79     uint64_t textDirection;
80     bool hasTextDirectionOverride;
81     String toolTip;
82     String accessibilityText;
83     bool isEnabled;
84     bool isLabel;
85     bool isSelected;
86
87     if (!decoder->decode(CoreIPC::Out(type, text, textDirection, hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel)))
88         return false;
89
90     if (!decoder->decode(CoreIPC::Out(isSelected)))
91         return false;
92
93     item = WebPopupItem(static_cast<Type>(type), text, static_cast<TextDirection>(textDirection), hasTextDirectionOverride, toolTip, accessibilityText, isEnabled, isLabel, isSelected);
94     return true;
95 }
96
97 } // namespace WebKit