[baseline] Fix major/minor assignment within rtl contexts.

Previously we incorrectly assigned items to the major/minor groups
within an RTL context.

Updates code to a writing-mode switch, with an explicit branch.

Change-Id: Ib8e05b90e3d5b1ff57a9cf0c99ece885a3dd28c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3888600
Reviewed-by: David Grogan <dgrogan@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1045463}
diff --git a/css/css-grid/alignment/grid-justify-baseline-001-ref.html b/css/css-grid/alignment/grid-justify-baseline-001-ref.html
new file mode 100644
index 0000000..17a59d6
--- /dev/null
+++ b/css/css-grid/alignment/grid-justify-baseline-001-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<div style="display: grid; width: 100px; height: 100px; background: gray;">
+  <div style="writing-mode: vertical-rl; background: cyan; justify-self: end; direction: rtl;">one<br>two</div>
+  <div style="writing-mode: vertical-lr; font-size: 30px; background: lime; justify-self: start; direction: rtl;">one<br>two</div>
+</div>
diff --git a/css/css-grid/alignment/grid-justify-baseline-001.html b/css/css-grid/alignment/grid-justify-baseline-001.html
new file mode 100644
index 0000000..959767b
--- /dev/null
+++ b/css/css-grid/alignment/grid-justify-baseline-001.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-sharing-group">
+<link rel="match" href="grid-justify-baseline-001-ref.html">
+<div style="display: grid; width: 100px; height: 100px; direction: rtl; justify-items: baseline; background: gray;">
+  <div style="writing-mode: vertical-rl; background: cyan;">one<br>two</div>
+  <div style="writing-mode: vertical-lr; font-size: 30px; background: lime;">one<br>two</div>
+</div>