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

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

Issue 1299873002: ALL-IN-ONE Introduce enum class TextAffinity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T18:08:52 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
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/Position.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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 for (auto& underline : m_customCompositionUnderlines) { 292 for (auto& underline : m_customCompositionUnderlines) {
293 underline.startOffset += baseOffset; 293 underline.startOffset += baseOffset;
294 underline.endOffset += baseOffset; 294 underline.endOffset += baseOffset;
295 } 295 }
296 if (baseNode->layoutObject()) 296 if (baseNode->layoutObject())
297 baseNode->layoutObject()->setShouldDoFullPaintInvalidation(); 297 baseNode->layoutObject()->setShouldDoFullPaintInvalidation();
298 298
299 unsigned start = std::min(baseOffset + selectionStart, extentOffset); 299 unsigned start = std::min(baseOffset + selectionStart, extentOffset);
300 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf fset); 300 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOf fset);
301 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document() , baseNode, start, baseNode, end); 301 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->document() , baseNode, start, baseNode, end);
302 frame().selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, FrameS election::NonDirectional, NotUserTriggered); 302 frame().selection().setSelectedRange(selectedRange.get(), TextAffinity::Down stream, FrameSelection::NonDirectional, NotUserTriggered);
303 } 303 }
304 304
305 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) 305 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd)
306 { 306 {
307 Element* editable = frame().selection().rootEditableElement(); 307 Element* editable = frame().selection().rootEditableElement();
308 Position base = frame().selection().base().downstream(); 308 Position base = frame().selection().base().downstream();
309 Node* baseNode = base.anchorNode(); 309 Node* baseNode = base.anchorNode();
310 if (baseNode && editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) { 310 if (baseNode && editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) {
311 m_compositionNode = nullptr; 311 m_compositionNode = nullptr;
312 m_customCompositionUnderlines.clear(); 312 m_customCompositionUnderlines.clear();
(...skipping 109 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
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/Position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698