text-box-trim: Handle the start side's inline box

0. Store the first non-empty inline box's edge in
   PhysicalLineBoxFragment, as intrinsic_metrics_, to allow block box
   to trim itself.
1. The first non-empty inline box will by be moved by the trimming
   unit

See the doc for more details.
https://docs.google.com/document/d/1eT0xEOrfVI3RhZ6goJLW1yOWHXLBq2tzAYrHe3NIiO8/edit#bookmark=id.pkbu9w2ipp14

Bug: 40254880
Change-Id: I0f127e078b4fc4c2bf477c16812dc060adc9c390
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5367205
Reviewed-by: Koji Ishii <kojii@chromium.org>
Commit-Queue: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290487}
diff --git a/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-001.html b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-001.html
index 2cbf1c2..14429b1 100644
--- a/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-001.html
+++ b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-001.html
@@ -15,6 +15,6 @@
 </style>
 
 <div class ="div-parent"">
-  <div id="d1"></div>
+
   <div id="d2">Testline1<br>Testline2<br>Testline3</div>
 </div>
diff --git a/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002-ref.html b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002-ref.html
new file mode 100644
index 0000000..8c10a80
--- /dev/null
+++ b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Reference for trimming block-boxes at their first/last formatted lines</title>
+<link rel="help" href="https://drafts.csswg.org/css-inline-3/#leading-trim">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+
+<style>
+.div-parent {
+  outline: 1px solid orange;
+  font-family: Ahem;
+  font-size: 20px;
+  line-height: 1;
+  writing-mode:vertical-lr;
+}
+</style>
+<div class ="div-parent">
+  Test<br><br>
+</div>
diff --git a/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002.html b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002.html
new file mode 100644
index 0000000..fdf5b71
--- /dev/null
+++ b/css/css-inline/text-box-trim/text-box-trim-half-leading-block-box-002.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>Tests block boxes's edges are trimmed at text-over/text-under baselines of their first/last formatted lines</title>
+<link rel="help" href="https://drafts.csswg.org/css-inline-3/#leading-trim">
+<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
+<link rel="match" href="text-box-trim-half-leading-block-box-002-ref.html">
+
+<style>
+.div-parent {
+  outline: 1px solid orange;
+  font-family: Ahem;
+  font-size: 20px;
+  line-height: 3;
+  writing-mode:vertical-lr;
+}
+</style>
+
+<div class ="div-parent" style="text-box-trim:start">Test</div>