Title: [102118] trunk/Source/WebCore
Revision
102118
Author
commit-qu...@webkit.org
Date
2011-12-06 03:24:03 -0800 (Tue, 06 Dec 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=73889
TextCheckingParagraph::offsetTo should not have a side effect.

Patch by Shinya Kawanaka <shin...@google.com> on 2011-12-06
Reviewed by Hajime Morita.

Since TextCheckingParagraph::offsetTo had a side effect, its cache often became inconsistent.
This is likely to cause a bug when changing SpellChecker and Editor.

No new tests. Covered by existing tests.

* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingParagraph::offsetTo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102117 => 102118)


--- trunk/Source/WebCore/ChangeLog	2011-12-06 11:20:54 UTC (rev 102117)
+++ trunk/Source/WebCore/ChangeLog	2011-12-06 11:24:03 UTC (rev 102118)
@@ -1,3 +1,18 @@
+2011-12-06  Shinya Kawanaka  <shin...@google.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=73889
+        TextCheckingParagraph::offsetTo should not have a side effect.
+
+        Reviewed by Hajime Morita.
+
+        Since TextCheckingParagraph::offsetTo had a side effect, its cache often became inconsistent.
+        This is likely to cause a bug when changing SpellChecker and Editor.
+
+        No new tests. Covered by existing tests.
+
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::TextCheckingParagraph::offsetTo):
+
 2011-12-06  Eric Penner  <epen...@google.com>
 
         [chromium] Set texture limits as multiples of viewport size instead of hardcoded values

Modified: trunk/Source/WebCore/editing/TextCheckingHelper.cpp (102117 => 102118)


--- trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2011-12-06 11:20:54 UTC (rev 102117)
+++ trunk/Source/WebCore/editing/TextCheckingHelper.cpp	2011-12-06 11:24:03 UTC (rev 102118)
@@ -157,7 +157,7 @@
 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionCode& ec) const
 {
     ASSERT(m_checkingRange);
-    RefPtr<Range> range = offsetAsRange();
+    RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION);
     range->setEnd(position.containerNode(), position.computeOffsetInContainerNode(), ec);
     if (ec)
         return 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to