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

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

Issue 478433002: Avoid RenderObject::paintInvalidationForWholeRenderer() if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: TestExpectations 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/dom/DocumentMarkerController.cpp ('k') | Source/core/html/HTMLCanvasElement.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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 m_compositionNode = toText(baseNode); 298 m_compositionNode = toText(baseNode);
299 m_compositionStart = baseOffset; 299 m_compositionStart = baseOffset;
300 m_compositionEnd = extentOffset; 300 m_compositionEnd = extentOffset;
301 m_customCompositionUnderlines = underlines; 301 m_customCompositionUnderlines = underlines;
302 size_t numUnderlines = m_customCompositionUnderlines.size(); 302 size_t numUnderlines = m_customCompositionUnderlines.size();
303 for (size_t i = 0; i < numUnderlines; ++i) { 303 for (size_t i = 0; i < numUnderlines; ++i) {
304 m_customCompositionUnderlines[i].startOffset += baseOffset; 304 m_customCompositionUnderlines[i].startOffset += baseOffset;
305 m_customCompositionUnderlines[i].endOffset += baseOffset; 305 m_customCompositionUnderlines[i].endOffset += baseOffset;
306 } 306 }
307 if (baseNode->renderer()) 307 if (baseNode->renderer())
308 baseNode->renderer()->paintInvalidationForWholeRenderer(); 308 baseNode->renderer()->setShouldDoFullPaintInvalidation(true);
309 309
310 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ; 310 unsigned start = std::min(baseOffset + selectionStart, extentOffset) ;
311 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset); 311 unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
312 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->do cument(), baseNode, start, baseNode, end); 312 RefPtrWillBeRawPtr<Range> selectedRange = Range::create(baseNode->do cument(), baseNode, start, baseNode, end);
313 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered); 313 m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM , FrameSelection::NonDirectional, NotUserTriggered);
314 } 314 }
315 } 315 }
316 } 316 }
317 317
318 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) 318 void InputMethodController::setCompositionFromExistingText(const Vector<Composit ionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd)
(...skipping 14 matching lines...) Expand all
333 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo sitionEnd).createRange(*editable); 333 RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compo sitionEnd).createRange(*editable);
334 m_compositionStart = range->startOffset(); 334 m_compositionStart = range->startOffset();
335 m_compositionEnd = range->endOffset(); 335 m_compositionEnd = range->endOffset();
336 m_customCompositionUnderlines = underlines; 336 m_customCompositionUnderlines = underlines;
337 size_t numUnderlines = m_customCompositionUnderlines.size(); 337 size_t numUnderlines = m_customCompositionUnderlines.size();
338 for (size_t i = 0; i < numUnderlines; ++i) { 338 for (size_t i = 0; i < numUnderlines; ++i) {
339 m_customCompositionUnderlines[i].startOffset += m_compositionStart; 339 m_customCompositionUnderlines[i].startOffset += m_compositionStart;
340 m_customCompositionUnderlines[i].endOffset += m_compositionStart; 340 m_customCompositionUnderlines[i].endOffset += m_compositionStart;
341 } 341 }
342 if (baseNode->renderer()) 342 if (baseNode->renderer())
343 baseNode->renderer()->paintInvalidationForWholeRenderer(); 343 baseNode->renderer()->setShouldDoFullPaintInvalidation(true);
344 return; 344 return;
345 } 345 }
346 346
347 Editor::RevealSelectionScope revealSelectionScope(&editor()); 347 Editor::RevealSelectionScope revealSelectionScope(&editor());
348 SelectionOffsetsScope selectionOffsetsScope(this); 348 SelectionOffsetsScope selectionOffsetsScope(this);
349 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); 349 setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd));
350 setComposition(m_frame.selectedText(), underlines, 0, 0); 350 setComposition(m_frame.selectedText(), underlines, 0, 0);
351 } 351 }
352 352
353 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const 353 PassRefPtrWillBeRawPtr<Range> InputMethodController::compositionRange() const
(...skipping 64 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/dom/DocumentMarkerController.cpp ('k') | Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698