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

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

Issue 791023006: Delete invalidateTreeIfNeeded. (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
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (baseNode && baseNode == extentNode && baseNode->isTextNode() && base Offset + text.length() == extentOffset) { 295 if (baseNode && baseNode == extentNode && baseNode->isTextNode() && base Offset + text.length() == extentOffset) {
296 m_compositionNode = toText(baseNode); 296 m_compositionNode = toText(baseNode);
297 m_compositionStart = baseOffset; 297 m_compositionStart = baseOffset;
298 m_compositionEnd = extentOffset; 298 m_compositionEnd = extentOffset;
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 if (baseNode->renderer())
306 baseNode->renderer()->setShouldDoFullPaintInvalidation(true);
307 305
308 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ; 306 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ;
309 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset); 307 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
310 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba seNode, start, baseNode, end); 308 RefPtr<Range> selectedRange = Range::create(baseNode->document(), ba seNode, start, baseNode, end);
311 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered); 309 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered);
312 } 310 }
313 } 311 }
314 } 312 }
315 313
316 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) 314 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd)
(...skipping 13 matching lines...) Expand all
330 m_compositionNode = toText(baseNode); 328 m_compositionNode = toText(baseNode);
331 RefPtr<Range> range = PlainTextRange(compositionStart, compositionEnd).c reateRange(*editable); 329 RefPtr<Range> range = PlainTextRange(compositionStart, compositionEnd).c reateRange(*editable);
332 m_compositionStart = range->startOffset(); 330 m_compositionStart = range->startOffset();
333 m_compositionEnd = range->endOffset(); 331 m_compositionEnd = range->endOffset();
334 m_customCompositionUnderlines = underlines; 332 m_customCompositionUnderlines = underlines;
335 size_t numUnderlines = m_customCompositionUnderlines.size(); 333 size_t numUnderlines = m_customCompositionUnderlines.size();
336 for (size_t i = 0; i < numUnderlines; ++i) { 334 for (size_t i = 0; i < numUnderlines; ++i) {
337 m_customCompositionUnderlines[i].startOffset += m_compositionStart; 335 m_customCompositionUnderlines[i].startOffset += m_compositionStart;
338 m_customCompositionUnderlines[i].endOffset += m_compositionStart; 336 m_customCompositionUnderlines[i].endOffset += m_compositionStart;
339 } 337 }
340 if (baseNode->renderer())
341 baseNode->renderer()->setShouldDoFullPaintInvalidation(true);
342 return; 338 return;
343 } 339 }
344 340
345 Editor::RevealSelectionScope revealSelectionScope(&editor()); 341 Editor::RevealSelectionScope revealSelectionScope(&editor());
346 SelectionOffsetsScope selectionOffsetsScope(this); 342 SelectionOffsetsScope selectionOffsetsScope(this);
347 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); 343 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd));
348 setComposition(m_frame.selectedText(), underlines, 0, 0); 344 setComposition(m_frame.selectedText(), underlines, 0, 0);
349 } 345 }
350 346
351 PassRefPtr<Range> InputMethodController::compositionRange() const 347 PassRefPtr<Range> InputMethodController::compositionRange() const
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after))) 412 if (!setSelectionOffsets(PlainTextRange(std::max(static_cast<int>(select ionOffsets.start()) - before, 0), selectionOffsets.end() + after)))
417 return; 413 return;
418 if (before == 0) 414 if (before == 0)
419 break; 415 break;
420 ++before; 416 ++before;
421 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start())); 417 } while (m_frame.selection().start() == m_frame.selection().end() && before <= static_cast<int>(selectionOffsets.start()));
422 TypingCommand::deleteSelection(*m_frame.document()); 418 TypingCommand::deleteSelection(*m_frame.document());
423 } 419 }
424 420
425 } // namespace blink 421 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698