Skip to content

Commit

Permalink
[LayoutNG] Fix first-line baseline when 'overflow' is not 'visible'
Browse files Browse the repository at this point in the history
This patch fixes first-line baseline when the 'overflow'
property is other than 'visible'.

CSS2 states that:
  The baseline of an 'inline-block' is the baseline of its
  last line box in the normal flow, unless it has either no
  in-flow line boxes or if its 'overflow' property has a
  computed value other than 'visible', in which case the
  baseline is the bottom margin edge.
https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align

This rule should apply only to 'inline-block', but it was
incorrectly applied to first-line baseline as well.

This patch fixes incorrect alignment in the comment lines of
Gerrit code review site.

Bug: 636993
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I49ffd8c050f384765c61c5678a431fa74492356d
Reviewed-on: https://chromium-review.googlesource.com/1140336
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576294}
  • Loading branch information
kojiishi authored and chromium-wpt-export-bot committed Jul 19, 2018
1 parent e26d876 commit 2b76cf7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
31 changes: 31 additions & 0 deletions css/css-flexbox/align-items-baseline-overflow-non-visible.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<title>A block with 'overflow: hidden' should produce normal baseline</title>
<link rel="author" title="Koji Ishii" href="kojii@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-baselines">
<link rel="match" href="reference/align-items-baseline-overflow-non-visible-ref.html">
<style>
.flex {
display: flex;
align-items: baseline;
}
.overflow {
overflow: hidden;
height: 2em;
}
</style>

<body>
<!--
CSS2 states that:
The baseline of an 'inline-block' is the baseline of its last line box in
the normal flow, unless it has either no in-flow line boxes or if its
'overflow' property has a computed value other than 'visible', in which case
the baseline is the bottom margin edge.
https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align
This rule should apply only to 'inline-block', and not to normal block.
-->
<div class="flex">
<span>XX</span>
<div><div class="overflow">YY</div></div>
</div>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<style>
.flex {
display: flex;
align-items: baseline;
}
</style>

<body>
<div class="flex">
<span>XX</span>
<div><div>YY</div></div>
</div>
</body>

0 comments on commit 2b76cf7

Please sign in to comment.