Title: [129818] branches/chromium/1229/Source/WebCore/rendering/RenderText.cpp
Revision
129818
Author
le...@chromium.org
Date
2012-09-27 16:51:47 -0700 (Thu, 27 Sep 2012)

Log Message

Merge 129814 - REGRESSION(r129186): Pressing enter at the end of a line deletes the line
https://bugs.webkit.org/show_bug.cgi?id=97763

Reviewed by Ryosuke Niwa.

r129186 exposed incorrect behavior in RenderText whereby RenderText's lines were
dirtied but the renderer wasn't marked for layout. Rich text editing in GMail exposed
this behavior. RenderText::setTextWithOffset is called with a text string identical
to the current text. It still dirties lines, then calls setText, which has a check
for the case when the strings are the same and returns early and doesn't mark us as
needing layout.

This change adds the same early bailing logic in setText to setTextWithOffset, but
forces setText to work its magic whenever we dirty lines there (and avoid double-
checking that the strings are equal).

* rendering/RenderText.cpp:
(WebCore::RenderText::setTextWithOffset):


TBR=le...@chromium.org
Review URL: https://codereview.chromium.org/10993072

Modified Paths

Diff

Modified: branches/chromium/1229/Source/WebCore/rendering/RenderText.cpp (129817 => 129818)


--- branches/chromium/1229/Source/WebCore/rendering/RenderText.cpp	2012-09-27 23:39:09 UTC (rev 129817)
+++ branches/chromium/1229/Source/WebCore/rendering/RenderText.cpp	2012-09-27 23:51:47 UTC (rev 129818)
@@ -1253,6 +1253,9 @@
 
 void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force)
 {
+    if (!force && equal(m_text.impl(), text.get()))
+        return;
+
     unsigned oldLen = textLength();
     unsigned newLen = text->length();
     int delta = newLen - oldLen;
@@ -1324,7 +1327,7 @@
     }
 
     m_linesDirty = dirtiedLines;
-    setText(text, force);
+    setText(text, force || dirtiedLines);
 }
 
 void RenderText::transformText()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to