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

Unified 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: add unit test 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 60dc3cb6d24ddcf2b0778fa03d1f8b8ab3e65d53..78e7ba2b84c868d7bfd50c37489ba3acab4e5439 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -265,6 +265,7 @@ TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio
, m_shouldStop(false)
, m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText)
, m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots)
+ , m_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar)
{
if (range)
initialize(range->startPosition(), range->endPosition());
@@ -295,6 +296,7 @@ TextIterator::TextIterator(const Position& start, const Position& end, TextItera
, m_shouldStop(false)
, m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText)
, m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots)
+ , m_emitsReplacementChar(behavior & TextIteratorEmitsReplacementChar)
{
initialize(start, end);
}
@@ -782,16 +784,21 @@ bool TextIterator::handleReplacedElement()
if (renderer->style()->visibility() != VISIBLE && !m_ignoresStyleVisibility)
return false;
- if (m_lastTextNodeEndedWithCollapsedSpace) {
- emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1);
- return false;
- }
-
if (m_entersTextControls && renderer->isTextControl()) {
leviw_travelin_and_unemployed 2014/05/27 23:33:45 Why are you pulling this up above the m_lastTextNo
guohui 2014/05/28 01:17:06 actually it was not clear to me why this was not u
Yuta Kitamura 2014/05/28 07:36:07 Text control case does seem like a bug, but I thin
guohui 2014/05/28 13:19:12 reverted, we'd better fix the text control case in
guohui 2014/05/28 13:32:39 Correction: when m_lastTextNodeEndedWithCollapsed
// The shadow tree should be already visited.
return true;
}
+ if (m_emitsReplacementChar) {
+ emitCharacter(objectReplacementCharacter, m_node->parentNode(), m_node, 0, 1);
+ return true;
+ }
+
+ if (m_lastTextNodeEndedWithCollapsedSpace) {
+ emitCharacter(' ', m_lastTextNode->parentNode(), m_lastTextNode, 1, 1);
+ return false;
+ }
+
m_hasEmitted = true;
if (m_emitsCharactersBetweenAllVisiblePositions) {

Powered by Google App Engine
This is Rietveld 408576698