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

Side by Side Diff: third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp

Issue 2826373002: Move CompositionUnderlineVectorBuilder.* from web/ -> core/editing/. (Closed)
Patch Set: Change CompositionUnderlineVectorBuilder to have an explicit method to build a Vector, rather than … Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/WebInputMethodControllerImpl.h" 5 #include "web/WebInputMethodControllerImpl.h"
6 6
7 #include "core/InputTypeNames.h" 7 #include "core/InputTypeNames.h"
8 #include "core/dom/DocumentUserGestureToken.h" 8 #include "core/dom/DocumentUserGestureToken.h"
9 #include "core/editing/CompositionUnderlineVectorBuilder.h"
9 #include "core/editing/EditingUtilities.h" 10 #include "core/editing/EditingUtilities.h"
10 #include "core/editing/Editor.h" 11 #include "core/editing/Editor.h"
11 #include "core/editing/EphemeralRange.h" 12 #include "core/editing/EphemeralRange.h"
12 #include "core/editing/FrameSelection.h" 13 #include "core/editing/FrameSelection.h"
13 #include "core/editing/InputMethodController.h" 14 #include "core/editing/InputMethodController.h"
14 #include "core/editing/PlainTextRange.h" 15 #include "core/editing/PlainTextRange.h"
15 #include "core/frame/LocalFrame.h" 16 #include "core/frame/LocalFrame.h"
16 #include "core/page/FocusController.h" 17 #include "core/page/FocusController.h"
17 #include "core/page/Page.h" 18 #include "core/page/Page.h"
18 #include "platform/UserGestureIndicator.h" 19 #include "platform/UserGestureIndicator.h"
19 #include "public/platform/WebString.h" 20 #include "public/platform/WebString.h"
20 #include "public/web/WebPlugin.h" 21 #include "public/web/WebPlugin.h"
21 #include "public/web/WebRange.h" 22 #include "public/web/WebRange.h"
22 #include "web/CompositionUnderlineVectorBuilder.h"
23 #include "web/WebLocalFrameImpl.h" 23 #include "web/WebLocalFrameImpl.h"
24 #include "web/WebPluginContainerImpl.h" 24 #include "web/WebPluginContainerImpl.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 WebInputMethodControllerImpl::WebInputMethodControllerImpl( 28 WebInputMethodControllerImpl::WebInputMethodControllerImpl(
29 WebLocalFrameImpl* web_local_frame) 29 WebLocalFrameImpl* web_local_frame)
30 : web_local_frame_(web_local_frame) {} 30 : web_local_frame_(web_local_frame) {}
31 31
32 WebInputMethodControllerImpl::~WebInputMethodControllerImpl() {} 32 WebInputMethodControllerImpl::~WebInputMethodControllerImpl() {}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 UserGestureIndicator gesture_indicator(DocumentUserGestureToken::Create( 80 UserGestureIndicator gesture_indicator(DocumentUserGestureToken::Create(
81 GetFrame()->GetDocument(), UserGestureToken::kNewGesture)); 81 GetFrame()->GetDocument(), UserGestureToken::kNewGesture));
82 82
83 // When the range of composition underlines overlap with the range between 83 // When the range of composition underlines overlap with the range between
84 // selectionStart and selectionEnd, WebKit somehow won't paint the selection 84 // selectionStart and selectionEnd, WebKit somehow won't paint the selection
85 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp). 85 // at all (see InlineTextBox::paint() function in InlineTextBox.cpp).
86 // But the selection range actually takes effect. 86 // But the selection range actually takes effect.
87 GetInputMethodController().SetComposition( 87 GetInputMethodController().SetComposition(
88 String(text), CompositionUnderlineVectorBuilder(underlines), 88 String(text), CompositionUnderlineVectorBuilder::Build(underlines),
89 selection_start, selection_end); 89 selection_start, selection_end);
90 90
91 return text.IsEmpty() || GetInputMethodController().HasComposition(); 91 return text.IsEmpty() || GetInputMethodController().HasComposition();
92 } 92 }
93 93
94 bool WebInputMethodControllerImpl::FinishComposingText( 94 bool WebInputMethodControllerImpl::FinishComposingText(
95 ConfirmCompositionBehavior selection_behavior) { 95 ConfirmCompositionBehavior selection_behavior) {
96 // TODO(ekaramad): Here and in other IME calls we should expect the 96 // TODO(ekaramad): Here and in other IME calls we should expect the
97 // call to be made when our frame is focused. This, however, is not the case 97 // call to be made when our frame is focused. This, however, is not the case
98 // all the time. For instance, resetInputMethod call on RenderViewImpl could 98 // all the time. For instance, resetInputMethod call on RenderViewImpl could
(...skipping 29 matching lines...) Expand all
128 128
129 // Select the range to be replaced with the composition later. 129 // Select the range to be replaced with the composition later.
130 if (!replacement_range.IsNull()) 130 if (!replacement_range.IsNull())
131 web_local_frame_->SelectRange(replacement_range); 131 web_local_frame_->SelectRange(replacement_range);
132 132
133 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 133 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
134 // needs to be audited. See http://crbug.com/590369 for more details. 134 // needs to be audited. See http://crbug.com/590369 for more details.
135 GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 135 GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
136 136
137 return GetInputMethodController().CommitText( 137 return GetInputMethodController().CommitText(
138 text, CompositionUnderlineVectorBuilder(underlines), 138 text, CompositionUnderlineVectorBuilder::Build(underlines),
139 relative_caret_position); 139 relative_caret_position);
140 } 140 }
141 141
142 WebTextInputInfo WebInputMethodControllerImpl::TextInputInfo() { 142 WebTextInputInfo WebInputMethodControllerImpl::TextInputInfo() {
143 return GetFrame()->GetInputMethodController().TextInputInfo(); 143 return GetFrame()->GetInputMethodController().TextInputInfo();
144 } 144 }
145 145
146 WebTextInputType WebInputMethodControllerImpl::TextInputType() { 146 WebTextInputType WebInputMethodControllerImpl::TextInputType() {
147 return GetFrame()->GetInputMethodController().TextInputType(); 147 return GetFrame()->GetInputMethodController().TextInputType();
148 } 148 }
(...skipping 10 matching lines...) Expand all
159 WebPlugin* WebInputMethodControllerImpl::FocusedPluginIfInputMethodSupported() 159 WebPlugin* WebInputMethodControllerImpl::FocusedPluginIfInputMethodSupported()
160 const { 160 const {
161 WebPluginContainerImpl* container = 161 WebPluginContainerImpl* container =
162 WebLocalFrameImpl::CurrentPluginContainer(GetFrame()); 162 WebLocalFrameImpl::CurrentPluginContainer(GetFrame());
163 if (container && container->SupportsInputMethod()) 163 if (container && container->SupportsInputMethod())
164 return container->Plugin(); 164 return container->Plugin();
165 return nullptr; 165 return nullptr;
166 } 166 }
167 167
168 } // namespace blink 168 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698