Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: Source/core/events/CompositionEvent.cpp

Issue 1162853002: Remove IME API from Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove interface in WebWidgets.h Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/CompositionEvent.h ('k') | Source/core/events/CompositionEvent.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. 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 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 * 24 *
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/events/CompositionEvent.h" 28 #include "core/events/CompositionEvent.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 CompositionEvent::CompositionEvent() 32 CompositionEvent::CompositionEvent()
33 : m_activeSegmentStart(0)
34 , m_activeSegmentEnd(0)
35 { 33 {
36 initializeSegments();
37 } 34 }
38 35
39 CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtrWillBeRaw Ptr<AbstractView> view, const String& data, const Vector<CompositionUnderline>& underlines) 36 CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtrWillBeRaw Ptr<AbstractView> view, const String& data)
40 : UIEvent(type, true, true, view, 0) 37 : UIEvent(type, true, true, view, 0)
41 , m_data(data) 38 , m_data(data)
42 , m_activeSegmentStart(0)
43 , m_activeSegmentEnd(0)
44 { 39 {
45 initializeSegments(&underlines);
46 } 40 }
47 41
48 CompositionEvent::CompositionEvent(const AtomicString& type, const CompositionEv entInit& initializer) 42 CompositionEvent::CompositionEvent(const AtomicString& type, const CompositionEv entInit& initializer)
49 : UIEvent(type, initializer) 43 : UIEvent(type, initializer)
50 , m_activeSegmentStart(0)
51 , m_activeSegmentEnd(0)
52 { 44 {
53 if (initializer.hasData()) 45 if (initializer.hasData())
54 m_data = initializer.data(); 46 m_data = initializer.data();
55 initializeSegments();
56 } 47 }
57 48
58 CompositionEvent::~CompositionEvent() 49 CompositionEvent::~CompositionEvent()
59 { 50 {
60 } 51 }
61 52
62 void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBu bble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data) 53 void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBu bble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, const String& data)
63 { 54 {
64 if (dispatched()) 55 if (dispatched())
65 return; 56 return;
66 57
67 initUIEvent(type, canBubble, cancelable, view, 0); 58 initUIEvent(type, canBubble, cancelable, view, 0);
68 59
69 m_data = data; 60 m_data = data;
70 initializeSegments();
71 }
72
73 void CompositionEvent::initializeSegments(const Vector<CompositionUnderline>* un derlines)
74 {
75 m_activeSegmentStart = 0;
76 m_activeSegmentEnd = m_data.length();
77
78 if (!underlines || !underlines->size()) {
79 m_segments.append(0);
80 return;
81 }
82
83 for (const auto& underline : *underlines) {
84 if (underline.thick) {
85 m_activeSegmentStart = underline.startOffset;
86 m_activeSegmentEnd = underline.endOffset;
87 break;
88 }
89 }
90
91 for (const auto& underline : *underlines)
92 m_segments.append(underline.startOffset);
93 } 61 }
94 62
95 const AtomicString& CompositionEvent::interfaceName() const 63 const AtomicString& CompositionEvent::interfaceName() const
96 { 64 {
97 return EventNames::CompositionEvent; 65 return EventNames::CompositionEvent;
98 } 66 }
99 67
100 DEFINE_TRACE(CompositionEvent) 68 DEFINE_TRACE(CompositionEvent)
101 { 69 {
102 UIEvent::trace(visitor); 70 UIEvent::trace(visitor);
103 } 71 }
104 72
105 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/CompositionEvent.h ('k') | Source/core/events/CompositionEvent.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698