Run script segmenter for each bidi run

Instead of running the script segmenter on the full node text, we group
the items that have the same bidi level.

NGInlineItemSegments::ComputeSegments should not shrink segment. It then
becomes a one line loop. So this patch removes it and inline the code.

Bug: 1054512
Change-Id: I2d721b511a5c04046670c5e756b56c3f7d67431d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129240
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757323}
diff --git a/css/CSS2/text/bidi-flag-emoji-ref.html b/css/CSS2/text/bidi-flag-emoji-ref.html
new file mode 100644
index 0000000..84585a2
--- /dev/null
+++ b/css/CSS2/text/bidi-flag-emoji-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<body>
+  <div>לום<span style="unicode-bidi: isolate">🇱🇮</span></div>
+</body>
+
diff --git a/css/CSS2/text/bidi-flag-emoji.html b/css/CSS2/text/bidi-flag-emoji.html
new file mode 100644
index 0000000..a184db2
--- /dev/null
+++ b/css/CSS2/text/bidi-flag-emoji.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Correct support of emoji flag following rtl run</title>
+<link rel="help" href="https://drafts.csswg.org/css2/visuren.html">
+<link rel="match" href="bidi-flag-emoji-ref.html">
+<body>
+  <div>לום🇱🇮</div>
+</body>
+