Title: [289189] trunk/Source/WebCore
- Revision
- 289189
- Author
- [email protected]
- Date
- 2022-02-06 16:33:13 -0800 (Sun, 06 Feb 2022)
Log Message
[LFC][IFC] Check if fallback font glyphs initiate ideographic baseline
https://bugs.webkit.org/show_bug.cgi?id=236182
Reviewed by Antti Koivisto.
This patch is in preparation for supporting vertical writing mode.
* layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::fallbackFontHasVerticalGlyph):
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
(WebCore::Layout::LineBoxBuilder::adjustIdeographicBaselineIfApplicable):
* layout/formattingContexts/inline/InlineLineBoxBuilder.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289188 => 289189)
--- trunk/Source/WebCore/ChangeLog 2022-02-07 00:16:59 UTC (rev 289188)
+++ trunk/Source/WebCore/ChangeLog 2022-02-07 00:33:13 UTC (rev 289189)
@@ -1,5 +1,20 @@
2022-02-06 Alan Bujtas <[email protected]>
+ [LFC][IFC] Check if fallback font glyphs initiate ideographic baseline
+ https://bugs.webkit.org/show_bug.cgi?id=236182
+
+ Reviewed by Antti Koivisto.
+
+ This patch is in preparation for supporting vertical writing mode.
+
+ * layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
+ (WebCore::Layout::fallbackFontHasVerticalGlyph):
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ (WebCore::Layout::LineBoxBuilder::adjustIdeographicBaselineIfApplicable):
+ * layout/formattingContexts/inline/InlineLineBoxBuilder.h:
+
+2022-02-06 Alan Bujtas <[email protected]>
+
[LFC][IFC] Add initial ideographic baseline support
https://bugs.webkit.org/show_bug.cgi?id=236177
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp (289188 => 289189)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2022-02-07 00:16:59 UTC (rev 289188)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2022-02-07 00:33:13 UTC (rev 289189)
@@ -36,6 +36,15 @@
namespace WebCore {
namespace Layout {
+static bool fallbackFontHasVerticalGlyph(const TextUtil::FallbackFontList& fallbackFontList)
+{
+ for (auto* font : fallbackFontList) {
+ if (font->hasVerticalGlyphs())
+ return true;
+ }
+ return false;
+}
+
static std::optional<InlineLayoutUnit> horizontalAlignmentOffset(TextAlignMode textAlign, const LineBuilder::LineContent& lineContent, bool isLeftToRightDirection)
{
// Depending on the line’s alignment/justification, the hanging glyph can be placed outside the line box.
@@ -301,6 +310,7 @@
auto fallbackFonts = TextUtil::fallbackFontsForRun(run, style);
if (!fallbackFonts.isEmpty()) {
// Adjust non-empty inline box height when glyphs from the non-primary font stretch the box.
+ m_fallbackFontRequiresIdeographicBaseline = m_fallbackFontRequiresIdeographicBaseline || fallbackFontHasVerticalGlyph(fallbackFonts);
adjustLayoutBoundsWithFallbackFonts(parentInlineBox, fallbackFonts);
}
continue;
@@ -338,22 +348,17 @@
if (rootInlineBoxStyle.isHorizontalWritingMode())
return false;
- auto styleRequiresIdeographicBaseline = [&] (auto& style) {
+ auto primaryFontRequiresIdeographicBaseline = [&] (auto& style) {
return style.fontDescription().orientation() == FontOrientation::Vertical || style.fontCascade().primaryFont().hasVerticalGlyphs();
};
- if (styleRequiresIdeographicBaseline(rootInlineBoxStyle))
+ if (m_fallbackFontRequiresIdeographicBaseline || primaryFontRequiresIdeographicBaseline(rootInlineBoxStyle))
return true;
for (auto& inlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
- if (styleRequiresIdeographicBaseline(styleToUse(inlineLevelBox)))
+ if (primaryFontRequiresIdeographicBaseline(styleToUse(inlineLevelBox)))
return true;
}
-
- auto contentRequiresIdeographicBaseline = [&] {
- // FIXME: Add support for fallback fonts.
- return false;
- };
- return contentRequiresIdeographicBaseline();
+ return false;
};
if (!lineNeedsIdeographicBaseline())
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h (289188 => 289189)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h 2022-02-07 00:16:59 UTC (rev 289188)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h 2022-02-07 00:33:13 UTC (rev 289189)
@@ -62,6 +62,7 @@
private:
const InlineFormattingContext& m_inlineFormattingContext;
+ bool m_fallbackFontRequiresIdeographicBaseline { false };
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes