Skip to content

Commit

Permalink
[Ruby] Do not apply annotation overhang when ruby-overhang is none
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alanbaradlay committed Aug 31, 2024
1 parent 798529e commit 71ad05b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Tests for ruby-overhang: none</title>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
div {
font: 16px/5 Ahem;
}
span {
color: transparent;
font-size: 8px; /* annotation -> 50% */
}
</style>
<div>X<span>XXX</span>X</div>
<div>X<span>XXXX</span>X</div>
<div>X<span>XXXX</span>X</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Tests for ruby-overhang: none</title>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
div {
font: 16px/5 Ahem;
}
span {
color: transparent;
font-size: 8px; /* annotation -> 50% */
}
</style>
<div>X<span>XXX</span>X</div>
<div>X<span>XXXX</span>X</div>
<div>X<span>XXXX</span>X</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Tests for ruby-overhang: none</title>
<link rel="help" href="https://drafts.csswg.org/css-ruby-1/#ruby-overhang">
<link rel="match" href="ruby-overhang-ref.html">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
div {
font: 16px/5 Ahem;
}
ruby, rt {
color: transparent;
}
</style>
<div>X<ruby>X<rt>XXXX</rt></ruby>X</div>
<div>X<ruby style="ruby-overhang: none">X<rt>XXXX</rt></ruby>X</div>
<div style="ruby-overhang: none">X<ruby>X<rt>XXXX</rt></ruby>X</div>
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ void RubyFormattingContext::applyRubyOverhang(InlineFormattingContext& parentFor
auto& rubyBaseLayoutBox = displayBoxes[rubyBaseStart].layoutBox();
ASSERT(rubyBaseLayoutBox.isRubyBase());
ASSERT(hasInterlinearAnnotation(rubyBaseLayoutBox));
if (rubyBaseLayoutBox.style().rubyOverhang() == RubyOverhang::None)
continue;

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

0 comments on commit 71ad05b

Please sign in to comment.