Title: [164763] trunk/Source/WebCore
Revision
164763
Author
mmaxfi...@apple.com
Date
2014-02-26 17:26:36 -0800 (Wed, 26 Feb 2014)

Log Message

Ranges given to createMarkupInternal might not be canonicalized
https://bugs.webkit.org/show_bug.cgi?id=129408

Reviewed by Ryosuke Niwa.

When WebKit clients (such as Mail) call WKWebArchiveCreateFromRange() with a range,
that range is not necessarily canonicalized. Therefore, comparing it for equality
with a canonicalized range might return a false negative. Instead, we should compare
canonicalized ranges.

No new tests because this codepath will only be reached via SPI.

* editing/markup.cpp:
(WebCore::createMarkupInternal):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164762 => 164763)


--- trunk/Source/WebCore/ChangeLog	2014-02-27 01:21:49 UTC (rev 164762)
+++ trunk/Source/WebCore/ChangeLog	2014-02-27 01:26:36 UTC (rev 164763)
@@ -1,3 +1,20 @@
+2014-02-26  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Ranges given to createMarkupInternal might not be canonicalized
+        https://bugs.webkit.org/show_bug.cgi?id=129408
+
+        Reviewed by Ryosuke Niwa.
+
+        When WebKit clients (such as Mail) call WKWebArchiveCreateFromRange() with a range,
+        that range is not necessarily canonicalized. Therefore, comparing it for equality
+        with a canonicalized range might return a false negative. Instead, we should compare
+        canonicalized ranges.
+
+        No new tests because this codepath will only be reached via SPI.
+
+        * editing/markup.cpp:
+        (WebCore::createMarkupInternal):
+
 2014-02-26  Enrica Casucci  <enr...@apple.com>
 
         [iOS WebKit2] Form controls handling: implement date and time controls.

Modified: trunk/Source/WebCore/editing/markup.cpp (164762 => 164763)


--- trunk/Source/WebCore/editing/markup.cpp	2014-02-27 01:21:49 UTC (rev 164762)
+++ trunk/Source/WebCore/editing/markup.cpp	2014-02-27 01:26:36 UTC (rev 164763)
@@ -571,7 +571,8 @@
     Node* body = enclosingNodeWithTag(firstPositionInNode(commonAncestor), bodyTag);
     Node* fullySelectedRoot = 0;
     // FIXME: Do this for all fully selected blocks, not just the body.
-    if (body && areRangesEqual(VisibleSelection::selectionFromContentsOfNode(body).toNormalizedRange().get(), &range))
+    if (body && VisiblePosition(firstPositionInNode(body)) == VisiblePosition(range.startPosition())
+        && VisiblePosition(lastPositionInNode(body)) == VisiblePosition(range.endPosition()))
         fullySelectedRoot = body;
     Node* specialCommonAncestor = highestAncestorToWrapMarkup(&updatedRange, shouldAnnotate);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to