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

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

Issue 420103002: Use tighter typing in editing: FormatBlockCommand / FrameSelection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Keep body change out Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (start >= end) 360 if (start >= end)
361 return nullptr; 361 return nullptr;
362 return Range::create(m_compositionNode->document(), m_compositionNode.get(), start, m_compositionNode.get(), end); 362 return Range::create(m_compositionNode->document(), m_compositionNode.get(), start, m_compositionNode.get(), end);
363 } 363 }
364 364
365 PlainTextRange InputMethodController::getSelectionOffsets() const 365 PlainTextRange InputMethodController::getSelectionOffsets() const
366 { 366 {
367 RefPtrWillBeRawPtr<Range> range = m_frame.selection().selection().firstRange (); 367 RefPtrWillBeRawPtr<Range> range = m_frame.selection().selection().firstRange ();
368 if (!range) 368 if (!range)
369 return PlainTextRange(); 369 return PlainTextRange();
370 Node* editable = m_frame.selection().rootEditableElementOrTreeScopeRootNode( ); 370 ContainerNode* editable = m_frame.selection().rootEditableElementOrTreeScope RootNode();
371 ASSERT(editable); 371 ASSERT(editable);
372 return PlainTextRange::create(*editable, *range.get()); 372 return PlainTextRange::create(*editable, *range.get());
373 } 373 }
374 374
375 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets) 375 bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO ffsets)
376 { 376 {
377 if (selectionOffsets.isNull()) 377 if (selectionOffsets.isNull())
378 return false; 378 return false;
379 Element* rootEditableElement = m_frame.selection().rootEditableElement(); 379 Element* rootEditableElement = m_frame.selection().rootEditableElement();
380 if (!rootEditableElement) 380 if (!rootEditableElement)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) 418 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after)))
419 return; 419 return;
420 if (before == 0) 420 if (before == 0)
421 break; 421 break;
422 ++before; 422 ++before;
423 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start())); 423 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start()));
424 TypingCommand::deleteSelection(*m_frame.document()); 424 TypingCommand::deleteSelection(*m_frame.document());
425 } 425 }
426 426
427 } // namespace blink 427 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698