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

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

Issue 1315543002: Introduce createRange(const EphemeralRange&) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 unsigned start = std::min(m_compositionStart, length); 348 unsigned start = std::min(m_compositionStart, length);
349 unsigned end = std::min(std::max(start, m_compositionEnd), length); 349 unsigned end = std::min(std::max(start, m_compositionEnd), length);
350 if (start >= end) 350 if (start >= end)
351 return EphemeralRange(); 351 return EphemeralRange();
352 return EphemeralRange(Position(m_compositionNode.get(), start), Position(m_c ompositionNode.get(), end)); 352 return EphemeralRange(Position(m_compositionNode.get(), start), Position(m_c ompositionNode.get(), end));
353 } 353 }
354 354
355 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const 355 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const
356 { 356 {
357 const EphemeralRange range = compositionEphemeralRange(); 357 const EphemeralRange range = compositionEphemeralRange();
358 if (range.isNull()) 358 if (range.isNull())
tkent 2015/08/24 09:38:05 We can remove these two lines.
yosin_UTC9 2015/08/24 13:19:22 Done.
359 return nullptr; 359 return nullptr;
360 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); 360 return createRange(range);
361 } 361 }
362 362
363 PlainTextRange InputMethodController::getSelectionOffsets() const 363 PlainTextRange InputMethodController::getSelectionOffsets() const
364 { 364 {
365 RefPtrWillBeRawPtr<Range> range = frame().selection().selection().firstRange (); 365 RefPtrWillBeRawPtr<Range> range = frame().selection().selection().firstRange ();
366 if (!range) 366 if (!range)
367 return PlainTextRange(); 367 return PlainTextRange();
368 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope RootNode(); 368 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope RootNode();
369 ASSERT(editable); 369 ASSERT(editable);
370 return PlainTextRange::create(*editable, *range.get()); 370 return PlainTextRange::create(*editable, *range.get());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 TypingCommand::deleteSelection(*frame().document()); 422 TypingCommand::deleteSelection(*frame().document());
423 } 423 }
424 424
425 DEFINE_TRACE(InputMethodController) 425 DEFINE_TRACE(InputMethodController)
426 { 426 {
427 visitor->trace(m_frame); 427 visitor->trace(m_frame);
428 visitor->trace(m_compositionNode); 428 visitor->trace(m_compositionNode);
429 } 429 }
430 430
431 } // namespace blink 431 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698