Set the end position on the placeholder BidiRun properly.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2016 23:24:59 +0000 (23:24 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2016 23:24:59 +0000 (23:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158958

Reviewed by Myles C. Maxfield.
rdar://problem/26609266

The second paramenter for BidiRun indicates the end position and not the length of the run.
This was regressed at r102875 where only the start position was changed from 0 to pos.

Source/WebCore:

Test: fast/text/international/bidi-style-in-isolate-crash.html

* rendering/InlineIterator.h:
(WebCore::addPlaceholderRunForIsolatedInline):

LayoutTests:

* fast/text/international/bidi-style-in-isolate-crash-expected.txt: Added.
* fast/text/international/bidi-style-in-isolate-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202251 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/international/bidi-style-in-isolate-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/international/bidi-style-in-isolate-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineIterator.h

index dfa7b87..84077ce 100644 (file)
@@ -1,3 +1,17 @@
+2016-06-20  Zalan Bujtas  <zalan@apple.com>
+
+        Set the end position on the placeholder BidiRun properly.
+        https://bugs.webkit.org/show_bug.cgi?id=158958
+
+        Reviewed by Myles C. Maxfield.
+        rdar://problem/26609266
+
+        The second paramenter for BidiRun indicates the end position and not the length of the run.
+        This was regressed at r102875 where only the start position was changed from 0 to pos.
+
+        * fast/text/international/bidi-style-in-isolate-crash-expected.txt: Added.
+        * fast/text/international/bidi-style-in-isolate-crash.html: Added.
+
 2016-06-20  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         A composition underline is placed to wrong position in RTL
diff --git a/LayoutTests/fast/text/international/bidi-style-in-isolate-crash-expected.txt b/LayoutTests/fast/text/international/bidi-style-in-isolate-crash-expected.txt
new file mode 100644 (file)
index 0000000..b59b3e9
--- /dev/null
@@ -0,0 +1,2 @@
+PASS if no crash or ASSERT. f
+
diff --git a/LayoutTests/fast/text/international/bidi-style-in-isolate-crash.html b/LayoutTests/fast/text/international/bidi-style-in-isolate-crash.html
new file mode 100644 (file)
index 0000000..6bf6013
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we can layout isolates properly</title>
+<style>
+body { 
+    width: 10px; 
+    text-align: right; 
+}
+q, br { 
+    unicode-bidi: -webkit-isolate-override; 
+}
+</style>
+</head>
+<body>
+PASS if no crash or ASSERT.
+<q>
+f
+ f<br></q>
+</body>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</html>
index 72f790c..22b54e1 100644 (file)
@@ -1,3 +1,19 @@
+2016-06-20  Zalan Bujtas  <zalan@apple.com>
+
+        Set the end position on the placeholder BidiRun properly.
+        https://bugs.webkit.org/show_bug.cgi?id=158958
+
+        Reviewed by Myles C. Maxfield.
+        rdar://problem/26609266
+
+        The second paramenter for BidiRun indicates the end position and not the length of the run.
+        This was regressed at r102875 where only the start position was changed from 0 to pos.
+
+        Test: fast/text/international/bidi-style-in-isolate-crash.html
+
+        * rendering/InlineIterator.h:
+        (WebCore::addPlaceholderRunForIsolatedInline):
+
 2016-06-20  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         A composition underline is placed to wrong position in RTL
index a11152f..2e5291a 100644 (file)
@@ -493,7 +493,7 @@ static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter)
 // of BidiResolver which knows nothing about RenderObjects.
 static inline void addPlaceholderRunForIsolatedInline(InlineBidiResolver& resolver, RenderObject& obj, unsigned pos, RenderElement& root)
 {
-    std::unique_ptr<BidiRun> isolatedRun = std::make_unique<BidiRun>(pos, 0, obj, resolver.context(), resolver.dir());
+    std::unique_ptr<BidiRun> isolatedRun = std::make_unique<BidiRun>(pos, pos, obj, resolver.context(), resolver.dir());
     // FIXME: isolatedRuns() could be a hash of object->run and then we could cheaply
     // ASSERT here that we didn't create multiple objects for the same inline.
     resolver.setWhitespaceCollapsingTransitionForIsolatedRun(*isolatedRun, resolver.whitespaceCollapsingState().currentTransition());