summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h
index d9ed1eee15a..d944e6aaeb9 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h
+++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_box_fragment.h
@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_BOX_FRAGMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_NG_BOX_FRAGMENT_H_
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/ng/ng_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
@@ -28,7 +29,14 @@ class CORE_EXPORT NGBoxFragment final : public NGFragment {
}
LayoutUnit FirstBaselineOrSynthesize() const {
- return FirstBaseline().value_or(BlockSize());
+ if (auto first_baseline = FirstBaseline())
+ return *first_baseline;
+
+ // TODO(layout-dev): See |NGBoxFragment::BaselineOrSynthesize()|.
+ if (writing_direction_.GetWritingMode() == WritingMode::kHorizontalTb)
+ return BlockSize();
+
+ return BlockSize() / 2;
}
// Returns the baseline for this fragment wrt. the parent writing mode. Will
@@ -48,7 +56,16 @@ class CORE_EXPORT NGBoxFragment final : public NGFragment {
}
LayoutUnit BaselineOrSynthesize() const {
- return Baseline().value_or(BlockSize());
+ if (auto baseline = Baseline())
+ return *baseline;
+
+ // TODO(layout-dev): With a vertical writing-mode, and "text-orientation:
+ // sideways" we should also synthesize using the block-end border edge. We
+ // need to pass in the text-orientation (or just parent style) to do this.
+ if (writing_direction_.GetWritingMode() == WritingMode::kHorizontalTb)
+ return BlockSize();
+
+ return BlockSize() / 2;
}
// Compute baseline metrics (ascent/descent) for this box.