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

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 { 49 {
50 } 50 }
51 51
52 InputMethodController::SelectionOffsetsScope::~SelectionOffsetsScope() 52 InputMethodController::SelectionOffsetsScope::~SelectionOffsetsScope()
53 { 53 {
54 m_inputMethodController->setSelectionOffsets(m_offsets); 54 m_inputMethodController->setSelectionOffsets(m_offsets);
55 } 55 }
56 56
57 // ---------------------------- 57 // ----------------------------
58 58
59 PassOwnPtrWillBeRawPtr<InputMethodController> InputMethodController::create(Loca lFrame& frame) 59 RawPtr<InputMethodController> InputMethodController::create(LocalFrame& frame)
60 { 60 {
61 return adoptPtrWillBeNoop(new InputMethodController(frame)); 61 return new InputMethodController(frame);
62 } 62 }
63 63
64 InputMethodController::InputMethodController(LocalFrame& frame) 64 InputMethodController::InputMethodController(LocalFrame& frame)
65 : m_frame(&frame) 65 : m_frame(&frame)
66 , m_isDirty(false) 66 , m_isDirty(false)
67 , m_hasComposition(false) 67 , m_hasComposition(false)
68 { 68 {
69 } 69 }
70 70
71 InputMethodController::~InputMethodController() 71 InputMethodController::~InputMethodController()
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 static void dispatchCompositionEndEvent(LocalFrame& frame, const String& text) 125 static void dispatchCompositionEndEvent(LocalFrame& frame, const String& text)
126 { 126 {
127 // We should send this event before sending a TextEvent as written in 127 // We should send this event before sending a TextEvent as written in
128 // Section 6.2.2 and 6.2.3 of the DOM Event specification. 128 // Section 6.2.2 and 6.2.3 of the DOM Event specification.
129 Element* target = frame.document()->focusedElement(); 129 Element* target = frame.document()->focusedElement();
130 if (!target) 130 if (!target)
131 return; 131 return;
132 132
133 RefPtrWillBeRawPtr<CompositionEvent> event = 133 RawPtr<CompositionEvent> event =
134 CompositionEvent::create(EventTypeNames::compositionend, frame.domWindow (), text); 134 CompositionEvent::create(EventTypeNames::compositionend, frame.domWindow (), text);
135 target->dispatchEvent(event); 135 target->dispatchEvent(event);
136 } 136 }
137 137
138 bool InputMethodController::confirmComposition(const String& text) 138 bool InputMethodController::confirmComposition(const String& text)
139 { 139 {
140 if (!hasComposition()) 140 if (!hasComposition())
141 return false; 141 return false;
142 142
143 Editor::RevealSelectionScope revealSelectionScope(&editor()); 143 Editor::RevealSelectionScope revealSelectionScope(&editor());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // a new composition node, i.e. 254 // a new composition node, i.e.
255 // !hasComposition() && !text.isEmpty(). 255 // !hasComposition() && !text.isEmpty().
256 // Sending a compositionupdate event at this time ensures that at lea st one 256 // Sending a compositionupdate event at this time ensures that at lea st one
257 // compositionupdate event is dispatched. 257 // compositionupdate event is dispatched.
258 // 2. Updating the existing composition node. 258 // 2. Updating the existing composition node.
259 // Send a compositionupdate event when this function updates the exis ting composition 259 // Send a compositionupdate event when this function updates the exis ting composition
260 // node, i.e. hasComposition() && !text.isEmpty(). 260 // node, i.e. hasComposition() && !text.isEmpty().
261 // 3. Canceling the ongoing composition. 261 // 3. Canceling the ongoing composition.
262 // Send a compositionend event when function deletes the existing com position node, i.e. 262 // Send a compositionend event when function deletes the existing com position node, i.e.
263 // !hasComposition() && test.isEmpty(). 263 // !hasComposition() && test.isEmpty().
264 RefPtrWillBeRawPtr<CompositionEvent> event = nullptr; 264 RawPtr<CompositionEvent> event = nullptr;
265 if (!hasComposition()) { 265 if (!hasComposition()) {
266 // We should send a compositionstart event only when the given text is not empty because this 266 // We should send a compositionstart event only when the given text is not empty because this
267 // function doesn't create a composition node when the text is empty . 267 // function doesn't create a composition node when the text is empty .
268 if (!text.isEmpty()) { 268 if (!text.isEmpty()) {
269 target->dispatchEvent(CompositionEvent::create(EventTypeNames::c ompositionstart, frame().domWindow(), frame().selectedText())); 269 target->dispatchEvent(CompositionEvent::create(EventTypeNames::c ompositionstart, frame().domWindow(), frame().selectedText()));
270 event = CompositionEvent::create(EventTypeNames::compositionupda te, frame().domWindow(), text); 270 event = CompositionEvent::create(EventTypeNames::compositionupda te, frame().domWindow(), text);
271 } 271 }
272 } else { 272 } else {
273 if (!text.isEmpty()) 273 if (!text.isEmpty())
274 event = CompositionEvent::create(EventTypeNames::compositionupda te, frame().domWindow(), text); 274 event = CompositionEvent::create(EventTypeNames::compositionupda te, frame().domWindow(), text);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (!m_compositionRange) 314 if (!m_compositionRange)
315 m_compositionRange = Range::create(baseNode->document()); 315 m_compositionRange = Range::create(baseNode->document());
316 m_compositionRange->setStart(baseNode, baseOffset); 316 m_compositionRange->setStart(baseNode, baseOffset);
317 m_compositionRange->setEnd(baseNode, extentOffset); 317 m_compositionRange->setEnd(baseNode, extentOffset);
318 318
319 if (baseNode->layoutObject()) 319 if (baseNode->layoutObject())
320 baseNode->layoutObject()->setShouldDoFullPaintInvalidation(); 320 baseNode->layoutObject()->setShouldDoFullPaintInvalidation();
321 321
322 unsigned start = std::min(baseOffset + selectionStart, extentOffset); 322 unsigned start = std::min(baseOffset + selectionStart, extentOffset);
323 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf fset); 323 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf fset);
324 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document() , baseNode, start, baseNode, end); 324 RawPtr<Range> selectedRange = Range::create(baseNode->document(), baseNode, start, baseNode, end);
325 frame().selection().setSelectedRange(selectedRange.get(), TextAffinity::Down stream, SelectionDirectionalMode::NonDirectional, NotUserTriggered); 325 frame().selection().setSelectedRange(selectedRange.get(), TextAffinity::Down stream, SelectionDirectionalMode::NonDirectional, NotUserTriggered);
326 326
327 if (underlines.isEmpty()) { 327 if (underlines.isEmpty()) {
328 frame().document()->markers().addCompositionMarker(m_compositionRange->s tartPosition(), m_compositionRange->endPosition(), Color::black, false, LayoutTh eme::theme().platformDefaultCompositionBackgroundColor()); 328 frame().document()->markers().addCompositionMarker(m_compositionRange->s tartPosition(), m_compositionRange->endPosition(), Color::black, false, LayoutTh eme::theme().platformDefaultCompositionBackgroundColor());
329 return; 329 return;
330 } 330 }
331 for (const auto& underline : underlines) { 331 for (const auto& underline : underlines) {
332 unsigned underlineStart = baseOffset + underline.startOffset; 332 unsigned underlineStart = baseOffset + underline.startOffset;
333 unsigned underlineEnd = baseOffset + underline.endOffset; 333 unsigned underlineEnd = baseOffset + underline.endOffset;
334 EphemeralRange ephemeralLineRange = EphemeralRange(Position(baseNode, un derlineStart), Position(baseNode, underlineEnd)); 334 EphemeralRange ephemeralLineRange = EphemeralRange(Position(baseNode, un derlineStart), Position(baseNode, underlineEnd));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 m_compositionRange->setEnd(range.endPosition()); 374 m_compositionRange->setEnd(range.endPosition());
375 } 375 }
376 376
377 EphemeralRange InputMethodController::compositionEphemeralRange() const 377 EphemeralRange InputMethodController::compositionEphemeralRange() const
378 { 378 {
379 if (!hasComposition()) 379 if (!hasComposition())
380 return EphemeralRange(); 380 return EphemeralRange();
381 return EphemeralRange(m_compositionRange.get()); 381 return EphemeralRange(m_compositionRange.get());
382 } 382 }
383 383
384 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const 384 RawPtr<Range> InputMethodController::compositionRange() const
385 { 385 {
386 return hasComposition() ? m_compositionRange : nullptr; 386 return hasComposition() ? m_compositionRange : nullptr;
387 } 387 }
388 388
389 String InputMethodController::composingText() const 389 String InputMethodController::composingText() const
390 { 390 {
391 return plainText(compositionEphemeralRange(), TextIteratorEmitsOriginalText) ; 391 return plainText(compositionEphemeralRange(), TextIteratorEmitsOriginalText) ;
392 } 392 }
393 393
394 PlainTextRange InputMethodController::getSelectionOffsets() const 394 PlainTextRange InputMethodController::getSelectionOffsets() const
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 TypingCommand::deleteSelection(*frame().document()); 453 TypingCommand::deleteSelection(*frame().document());
454 } 454 }
455 455
456 DEFINE_TRACE(InputMethodController) 456 DEFINE_TRACE(InputMethodController)
457 { 457 {
458 visitor->trace(m_frame); 458 visitor->trace(m_frame);
459 visitor->trace(m_compositionRange); 459 visitor->trace(m_compositionRange);
460 } 460 }
461 461
462 } // namespace blink 462 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698