Skip to content

Commit 71ad05b

Browse files
committed
[Ruby] Do not apply annotation overhang when ruby-overhang is none
https://bugs.webkit.org/show_bug.cgi?id=278893 Reviewed by Antti Koivisto. * Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp: (WebCore::Layout::RubyFormattingContext::applyRubyOverhang): Canonical link: https://commits.webkit.org/283005@main
1 parent 798529e commit 71ad05b

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<meta charset="UTF-8">
3+
<title>Tests for ruby-overhang: none</title>
4+
<link rel="stylesheet" href="/fonts/ahem.css">
5+
<style>
6+
div {
7+
font: 16px/5 Ahem;
8+
}
9+
span {
10+
color: transparent;
11+
font-size: 8px; /* annotation -> 50% */
12+
}
13+
</style>
14+
<div>X<span>XXX</span>X</div>
15+
<div>X<span>XXXX</span>X</div>
16+
<div>X<span>XXXX</span>X</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<meta charset="UTF-8">
3+
<title>Tests for ruby-overhang: none</title>
4+
<link rel="stylesheet" href="/fonts/ahem.css">
5+
<style>
6+
div {
7+
font: 16px/5 Ahem;
8+
}
9+
span {
10+
color: transparent;
11+
font-size: 8px; /* annotation -> 50% */
12+
}
13+
</style>
14+
<div>X<span>XXX</span>X</div>
15+
<div>X<span>XXXX</span>X</div>
16+
<div>X<span>XXXX</span>X</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<meta charset="UTF-8">
3+
<title>Tests for ruby-overhang: none</title>
4+
<link rel="help" href="https://drafts.csswg.org/css-ruby-1/#ruby-overhang">
5+
<link rel="match" href="ruby-overhang-ref.html">
6+
<link rel="stylesheet" href="/fonts/ahem.css">
7+
<style>
8+
div {
9+
font: 16px/5 Ahem;
10+
}
11+
ruby, rt {
12+
color: transparent;
13+
}
14+
</style>
15+
<div>X<ruby>X<rt>XXXX</rt></ruby>X</div>
16+
<div>X<ruby style="ruby-overhang: none">X<rt>XXXX</rt></ruby>X</div>
17+
<div style="ruby-overhang: none">X<ruby>X<rt>XXXX</rt></ruby>X</div>

Source/WebCore/layout/formattingContexts/inline/ruby/RubyFormattingContext.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ void RubyFormattingContext::applyRubyOverhang(InlineFormattingContext& parentFor
619619
auto& rubyBaseLayoutBox = displayBoxes[rubyBaseStart].layoutBox();
620620
ASSERT(rubyBaseLayoutBox.isRubyBase());
621621
ASSERT(hasInterlinearAnnotation(rubyBaseLayoutBox));
622+
if (rubyBaseLayoutBox.style().rubyOverhang() == RubyOverhang::None)
623+
continue;
622624

623625
auto beforeOverhang = overhangForAnnotationBefore(rubyBaseLayoutBox, rubyBaseStart, displayBoxes, lineLogicalHeight, parentFormattingContext);
624626
auto afterOverhang = overhangForAnnotationAfter(rubyBaseLayoutBox, { rubyBaseStart, startEndPair.end() }, displayBoxes, lineLogicalHeight, parentFormattingContext);

0 commit comments

Comments
 (0)