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

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

Issue 297003003: Emit object replacement char to IME (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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/TextIterator.h ('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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 , m_hasEmitted(false) 258 , m_hasEmitted(false)
259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions) 259 , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCh aractersBetweenAllVisiblePositions)
260 , m_entersTextControls(behavior & TextIteratorEntersTextControls) 260 , m_entersTextControls(behavior & TextIteratorEntersTextControls)
261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText) 261 , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText)
262 , m_handledFirstLetter(false) 262 , m_handledFirstLetter(false)
263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility) 263 , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls) 264 , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls)
265 , m_shouldStop(false) 265 , m_shouldStop(false)
266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText) 266 , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText)
267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) 267 , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots)
268 , m_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar)
268 { 269 {
269 if (range) 270 if (range)
270 initialize(range->startPosition(), range->endPosition()); 271 initialize(range->startPosition(), range->endPosition());
271 } 272 }
272 273
273 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior) 274 TextIterator::TextIterator(const Position& start, const Position& end, TextItera torBehaviorFlags behavior)
274 : m_startContainer(0) 275 : m_startContainer(0)
275 , m_startOffset(0) 276 , m_startOffset(0)
276 , m_endContainer(0) 277 , m_endContainer(0)
277 , m_endOffset(0) 278 , m_endOffset(0)
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 776
776 bool TextIterator::handleReplacedElement() 777 bool TextIterator::handleReplacedElement()
777 { 778 {
778 if (m_fullyClippedStack.top()) 779 if (m_fullyClippedStack.top())
779 return false; 780 return false;
780 781
781 RenderObject* renderer = m_node->renderer(); 782 RenderObject* renderer = m_node->renderer();
782 if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility) 783 if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
783 return false; 784 return false;
784 785
786 if (m_entersTextControls && renderer->isTextControl()) {
787 // The shadow tree should be already visited.
788 return true;
789 }
790
791 if (m_emitsReplacementChar || true) {
aurimas (slooooooooow) 2014/05/22 21:43:40 "A || true" is true for any value for A, right?
guohui 2014/05/22 22:00:37 Absolutely right, i hardcoded to true for testing
792 emitCharacter(objectReplacementCharacter, m_node->parentNode(), m_node, 0, 1);
793 return true;
794 }
795
785 if (m_lastTextNodeEndedWithCollapsedSpace) { 796 if (m_lastTextNodeEndedWithCollapsedSpace) {
786 emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1); 797 emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1);
787 return false; 798 return false;
788 } 799 }
789 800
790 if (m_entersTextControls && renderer->isTextControl()) {
791 // The shadow tree should be already visited.
792 return true;
793 }
794
795 m_hasEmitted = true; 801 m_hasEmitted = true;
796 802
797 if (m_emitsCharactersBetweenAllVisiblePositions) { 803 if (m_emitsCharactersBetweenAllVisiblePositions) {
798 // We want replaced elements to behave like punctuation for boundary 804 // We want replaced elements to behave like punctuation for boundary
799 // finding, and to simply take up space for the selection preservation 805 // finding, and to simply take up space for the selection preservation
800 // code in moveParagraphs, so we use a comma. 806 // code in moveParagraphs, so we use a comma.
801 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); 807 emitCharacter(',', m_node->parentNode(), m_node, 0, 1);
802 return true; 808 return true;
803 } 809 }
804 810
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 resultEnd = collapseTo; 2201 resultEnd = collapseTo;
2196 return; 2202 return;
2197 } 2203 }
2198 } 2204 }
2199 2205
2200 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); 2206 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText);
2201 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); 2207 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd);
2202 } 2208 }
2203 2209
2204 } 2210 }
OLDNEW
« no previous file with comments | « Source/core/editing/TextIterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698