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

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

Issue 1332823002: Introduce firstEphemeralRangeOf(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: simplify firstRangeOf Created 5 years, 3 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
« no previous file with comments | « no previous file | Source/core/editing/VisibleSelection.h » ('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) 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 return createRange(compositionEphemeralRange()); 357 return createRange(compositionEphemeralRange());
358 } 358 }
359 359
360 PlainTextRange InputMethodController::getSelectionOffsets() const 360 PlainTextRange InputMethodController::getSelectionOffsets() const
361 { 361 {
362 RefPtrWillBeRawPtr<Range> range = firstRangeOf(frame().selection().selection ()); 362 EphemeralRange range = firstEphemeralRangeOf(frame().selection().selection() );
363 if (!range) 363 if (range.isNull())
364 return PlainTextRange(); 364 return PlainTextRange();
365 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope RootNode(); 365 ContainerNode* editable = frame().selection().rootEditableElementOrTreeScope RootNode();
366 ASSERT(editable); 366 ASSERT(editable);
367 return PlainTextRange::create(*editable, *range.get()); 367 return PlainTextRange::create(*editable, range);
368 } 368 }
369 369
370 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets) 370 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets)
371 { 371 {
372 if (selectionOffsets.isNull()) 372 if (selectionOffsets.isNull())
373 return false; 373 return false;
374 Element* rootEditableElement = frame().selection().rootEditableElement(); 374 Element* rootEditableElement = frame().selection().rootEditableElement();
375 if (!rootEditableElement) 375 if (!rootEditableElement)
376 return false; 376 return false;
377 377
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 TypingCommand::deleteSelection(*frame().document()); 419 TypingCommand::deleteSelection(*frame().document());
420 } 420 }
421 421
422 DEFINE_TRACE(InputMethodController) 422 DEFINE_TRACE(InputMethodController)
423 { 423 {
424 visitor->trace(m_frame); 424 visitor->trace(m_frame);
425 visitor->trace(m_compositionNode); 425 visitor->trace(m_compositionNode);
426 } 426 }
427 427
428 } // namespace blink 428 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698