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

Side by Side Diff: sky/engine/core/editing/InputMethodController.cpp

Issue 865383003: Consolidate callers to scheduleVisualUpdate. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/editing/FrameSelection.cpp ('k') | sky/engine/core/frame/FrameView.cpp » ('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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 m_customCompositionUnderlines = underlines; 299 m_customCompositionUnderlines = underlines;
300 size_t numUnderlines = m_customCompositionUnderlines.size(); 300 size_t numUnderlines = m_customCompositionUnderlines.size();
301 for (size_t i = 0; i < numUnderlines; ++i) { 301 for (size_t i = 0; i < numUnderlines; ++i) {
302 m_customCompositionUnderlines[i].startOffset += baseOffset; 302 m_customCompositionUnderlines[i].startOffset += baseOffset;
303 m_customCompositionUnderlines[i].endOffset += baseOffset; 303 m_customCompositionUnderlines[i].endOffset += baseOffset;
304 } 304 }
305 305
306 // TODO(ojan): What was this for? Do we need it in sky since we 306 // TODO(ojan): What was this for? Do we need it in sky since we
307 // don't need to support legacy IMEs? 307 // don't need to support legacy IMEs?
308 if (baseNode->renderer()) 308 if (baseNode->renderer())
309 baseNode->renderer()->scheduleVisualUpdate(); 309 baseNode->document().scheduleVisualUpdate();
310 310
311 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ; 311 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ;
312 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset); 312 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
313 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba seNode, start, baseNode, end); 313 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba seNode, start, baseNode, end);
314 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered); 314 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered);
315 } 315 }
316 } 316 }
317 } 317 }
318 318
319 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) 319 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd)
(...skipping 17 matching lines...) Expand all
337 m_customCompositionUnderlines = underlines; 337 m_customCompositionUnderlines = underlines;
338 size_t numUnderlines = m_customCompositionUnderlines.size(); 338 size_t numUnderlines = m_customCompositionUnderlines.size();
339 for (size_t i = 0; i < numUnderlines; ++i) { 339 for (size_t i = 0; i < numUnderlines; ++i) {
340 m_customCompositionUnderlines[i].startOffset += m_compositionStart; 340 m_customCompositionUnderlines[i].startOffset += m_compositionStart;
341 m_customCompositionUnderlines[i].endOffset += m_compositionStart; 341 m_customCompositionUnderlines[i].endOffset += m_compositionStart;
342 } 342 }
343 343
344 // TODO(ojan): What was this for? Do we need it in sky since we 344 // TODO(ojan): What was this for? Do we need it in sky since we
345 // don't need to support legacy IMEs? 345 // don't need to support legacy IMEs?
346 if (baseNode->renderer()) 346 if (baseNode->renderer())
347 baseNode->renderer()->scheduleVisualUpdate(); 347 baseNode->document().scheduleVisualUpdate();
348 348
349 return; 349 return;
350 } 350 }
351 351
352 Editor::RevealSelectionScope revealSelectionScope(&editor()); 352 Editor::RevealSelectionScope revealSelectionScope(&editor());
353 SelectionOffsetsScope selectionOffsetsScope(this); 353 SelectionOffsetsScope selectionOffsetsScope(this);
354 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); 354 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd));
355 setComposition(m_frame.selectedText(), underlines, 0, 0); 355 setComposition(m_frame.selectedText(), underlines, 0, 0);
356 } 356 }
357 357
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) 423 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after)))
424 return; 424 return;
425 if (before == 0) 425 if (before == 0)
426 break; 426 break;
427 ++before; 427 ++before;
428 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start())); 428 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start()));
429 TypingCommand::deleteSelection(*m_frame.document()); 429 TypingCommand::deleteSelection(*m_frame.document());
430 } 430 }
431 431
432 } // namespace blink 432 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/editing/FrameSelection.cpp ('k') | sky/engine/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698