Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (281372 => 281373)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-08-21 13:42:48 UTC (rev 281372)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp 2021-08-21 13:49:32 UTC (rev 281373)
@@ -204,8 +204,8 @@
case AvoidanceReason::FlowChildIsSelected:
stream << "selected content";
break;
- case AvoidanceReason::FlowFontHasOverflowGlyph:
- stream << "-webkit-line-box-contain: glyphs with overflowing text.";
+ case AvoidanceReason::FlowHasLineBoxContainGlyphs:
+ stream << "-webkit-line-box-contain: glyphs";
break;
case AvoidanceReason::FlowTextHasSurrogatePair:
stream << "surrogate pair";
@@ -436,18 +436,10 @@
}
template <typename CharacterType>
-static OptionSet<AvoidanceReason> canUseForText(const CharacterType* text, unsigned length, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint, IncludeReasons includeReasons)
+static OptionSet<AvoidanceReason> canUseForText(const CharacterType* text, unsigned length, const FontCascade& fontCascade, IncludeReasons includeReasons)
{
OptionSet<AvoidanceReason> reasons;
auto& primaryFont = fontCascade.primaryFont();
- auto& fontMetrics = primaryFont.fontMetrics();
- auto availableSpaceForGlyphAscent = fontMetrics.ascent();
- auto availableSpaceForGlyphDescent = fontMetrics.descent();
- if (lineHeightConstraint) {
- auto lineHeightPadding = *lineHeightConstraint - fontMetrics.height();
- availableSpaceForGlyphAscent += lineHeightPadding / 2;
- availableSpaceForGlyphDescent += lineHeightPadding / 2;
- }
for (unsigned i = 0; i < length; ++i) {
auto character = text[i];
@@ -458,21 +450,15 @@
auto glyphData = fontCascade.glyphDataForCharacter(character, false);
if (!glyphData.isValid() || glyphData.font != &primaryFont)
SET_REASON_AND_RETURN_IF_NEEDED(FlowPrimaryFontIsInsufficient, reasons, includeReasons);
-
- if (lineHeightConstraint) {
- auto bounds = primaryFont.boundsForGlyph(glyphData.glyph);
- if (ceilf(-bounds.y()) > availableSpaceForGlyphAscent || ceilf(bounds.maxY()) > availableSpaceForGlyphDescent)
- SET_REASON_AND_RETURN_IF_NEEDED(FlowFontHasOverflowGlyph, reasons, includeReasons);
- }
}
return reasons;
}
-static OptionSet<AvoidanceReason> canUseForText(StringView text, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint, IncludeReasons includeReasons)
+static OptionSet<AvoidanceReason> canUseForText(StringView text, const FontCascade& fontCascade, IncludeReasons includeReasons)
{
if (text.is8Bit())
- return canUseForText(text.characters8(), text.length(), fontCascade, lineHeightConstraint, includeReasons);
- return canUseForText(text.characters16(), text.length(), fontCascade, lineHeightConstraint, includeReasons);
+ return canUseForText(text.characters8(), text.length(), fontCascade, includeReasons);
+ return canUseForText(text.characters16(), text.length(), fontCascade, includeReasons);
}
static OptionSet<AvoidanceReason> canUseForFontAndText(const RenderBoxModelObject& container, IncludeReasons includeReasons)
@@ -483,9 +469,8 @@
auto& fontCascade = style.fontCascade();
if (fontCascade.primaryFont().isInterstitial())
SET_REASON_AND_RETURN_IF_NEEDED(FlowIsMissingPrimaryFont, reasons, includeReasons);
- std::optional<float> lineHeightConstraint;
if (style.lineBoxContain().contains(LineBoxContain::Glyphs))
- lineHeightConstraint = container.lineHeight(false, HorizontalLine, PositionOfInteriorLineBoxes).toFloat();
+ SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainGlyphs, reasons, includeReasons);
for (const auto& textRenderer : childrenOfType<RenderText>(container)) {
// FIXME: Do not return until after checking all children.
if (textRenderer.isCombineText())
@@ -508,7 +493,7 @@
SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);
}
- auto textReasons = canUseForText(textRenderer.stringView(), fontCascade, lineHeightConstraint, includeReasons);
+ auto textReasons = canUseForText(textRenderer.stringView(), fontCascade, includeReasons);
if (textReasons)
ADD_REASONS_AND_RETURN_IF_NEEDED(textReasons, reasons, includeReasons);
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (281372 => 281373)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-08-21 13:42:48 UTC (rev 281372)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-08-21 13:49:32 UTC (rev 281373)
@@ -82,7 +82,7 @@
FlowDoesNotEstablishInlineFormattingContext = 1LLU << 42,
FlowChildIsSelected = 1LLU << 43,
FlowHasHangingPunctuation = 1LLU << 44,
- FlowFontHasOverflowGlyph = 1LLU << 45,
+ FlowHasLineBoxContainGlyphs = 1LLU << 45,
FlowTextHasSurrogatePair = 1LLU << 46,
MultiColumnFlowIsNotTopLevel = 1LLU << 47,
MultiColumnFlowHasColumnSpanner = 1LLU << 48,