Log Message
Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient. https://bugs.webkit.org/show_bug.cgi?id=167820 Source/WebCore:
<rdar://problem/30359685> Reviewed by Myles C. Maxfield. Currently simple line layout requires the primary font to have all the glyps for the content. Test: fast/text/simple-line-layout-do-not-support-unicode-range.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForText): (WebCore::SimpleLineLayout::canUseForFontAndText): (WebCore::SimpleLineLayout::printReason): LayoutTests: Reviewed by Myles C. Maxfield. * fast/text/simple-line-layout-do-not-support-unicode-range-expected.html: Added. * fast/text/simple-line-layout-do-not-support-unicode-range.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (211660 => 211661)
--- trunk/LayoutTests/ChangeLog 2017-02-04 01:39:19 UTC (rev 211660)
+++ trunk/LayoutTests/ChangeLog 2017-02-04 01:42:12 UTC (rev 211661)
@@ -1,3 +1,13 @@
+2017-02-03 Zalan Bujtas <za...@apple.com>
+
+ Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
+ https://bugs.webkit.org/show_bug.cgi?id=167820
+
+ Reviewed by Myles C. Maxfield.
+
+ * fast/text/simple-line-layout-do-not-support-unicode-range-expected.html: Added.
+ * fast/text/simple-line-layout-do-not-support-unicode-range.html: Added.
+
2017-02-03 Jer Noble <jer.no...@apple.com>
ASSERT in HTMLMediaElement::~HTMLMediaElement
Added: trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range-expected.html (0 => 211661)
--- trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range-expected.html 2017-02-04 01:42:12 UTC (rev 211661)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Simple line layout can't work with insufficient primary font.</title>
+<style>
+@font-face {
+ font-family: Monaco;
+ unicode-range: U+0060-0080;
+ src: local(Times);
+}
+</style>
+<script>
+if (window.internals) {
+ internals.settings.setSimpleLineLayoutDebugBordersEnabled(true);
+ internals.settings.setSimpleLineLayoutEnabled(false);
+}
+</script>
+</head>
+<body>
+<p style="font-family: Monaco;">THIS SHOULD NOT HAVE GREEN simple line layout borders.</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range.html (0 => 211661)
--- trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range.html (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-do-not-support-unicode-range.html 2017-02-04 01:42:12 UTC (rev 211661)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Simple line layout can't work with insufficient primary font.</title>
+<style>
+@font-face {
+ font-family: Monaco;
+ unicode-range: U+0060-0080;
+ src: local(Times);
+}
+</style>
+<script>
+if (window.internals) {
+ internals.settings.setSimpleLineLayoutDebugBordersEnabled(true);
+ internals.settings.setSimpleLineLayoutEnabled(true);
+}
+</script>
+</head>
+<body>
+<p style="font-family: Monaco;">THIS SHOULD NOT HAVE GREEN simple line layout borders.</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (211660 => 211661)
--- trunk/Source/WebCore/ChangeLog 2017-02-04 01:39:19 UTC (rev 211660)
+++ trunk/Source/WebCore/ChangeLog 2017-02-04 01:42:12 UTC (rev 211661)
@@ -1,3 +1,20 @@
+2017-02-03 Zalan Bujtas <za...@apple.com>
+
+ Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
+ https://bugs.webkit.org/show_bug.cgi?id=167820
+ <rdar://problem/30359685>
+
+ Reviewed by Myles C. Maxfield.
+
+ Currently simple line layout requires the primary font to have all the glyps for the content.
+
+ Test: fast/text/simple-line-layout-do-not-support-unicode-range.html
+
+ * rendering/SimpleLineLayout.cpp:
+ (WebCore::SimpleLineLayout::canUseForText):
+ (WebCore::SimpleLineLayout::canUseForFontAndText):
+ (WebCore::SimpleLineLayout::printReason):
+
2017-02-03 Jer Noble <jer.no...@apple.com>
ASSERT in HTMLMediaElement::~HTMLMediaElement
Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (211660 => 211661)
--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-02-04 01:39:19 UTC (rev 211660)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-02-04 01:42:12 UTC (rev 211661)
@@ -100,7 +100,7 @@
FlowTextHasSoftHyphen = 1LLU << 34,
FlowTextHasDirectionCharacter = 1LLU << 35,
FlowIsMissingPrimaryFont = 1LLU << 36,
- FlowFontIsMissingGlyph = 1LLU << 37,
+ FlowPrimaryFontIsInsufficient = 1LLU << 37,
FlowTextIsCombineText = 1LLU << 38,
FlowTextIsRenderCounter = 1LLU << 39,
FlowTextIsRenderQuote = 1LLU << 40,
@@ -137,10 +137,11 @@
#endif
template <typename CharacterType>
-static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const Font& font, std::optional<float> lineHeightConstraint,
+static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint,
bool textIsJustified, IncludeReasons includeReasons)
{
AvoidanceReasonFlags reasons = { };
+ auto& primaryFont = fontCascade.primaryFont();
// FIXME: <textarea maxlength=0> generates empty text node.
if (!length)
SET_REASON_AND_RETURN_IF_NEEDED(FlowTextIsEmpty, reasons, includeReasons);
@@ -168,20 +169,21 @@
|| direction == U_POP_DIRECTIONAL_FORMAT || direction == U_BOUNDARY_NEUTRAL)
SET_REASON_AND_RETURN_IF_NEEDED(FlowTextHasDirectionCharacter, reasons, includeReasons);
- auto glyph = font.glyphForCharacter(character);
- if (!glyph)
- SET_REASON_AND_RETURN_IF_NEEDED(FlowFontIsMissingGlyph, reasons, includeReasons);
- if (lineHeightConstraint && font.boundsForGlyph(glyph).height() > *lineHeightConstraint)
+ auto glyphData = fontCascade.glyphDataForCharacter(character, false);
+ if (!glyphData.isValid() || glyphData.font != &primaryFont)
+ SET_REASON_AND_RETURN_IF_NEEDED(FlowPrimaryFontIsInsufficient, reasons, includeReasons);
+
+ if (lineHeightConstraint && primaryFont.boundsForGlyph(glyphData.glyph).height() > *lineHeightConstraint)
SET_REASON_AND_RETURN_IF_NEEDED(FlowFontHasOverflowGlyph, reasons, includeReasons);
}
return reasons;
}
-static AvoidanceReasonFlags canUseForText(const RenderText& textRenderer, const Font& font, std::optional<float> lineHeightConstraint, bool textIsJustified, IncludeReasons includeReasons)
+static AvoidanceReasonFlags canUseForText(const RenderText& textRenderer, const FontCascade& fontCascade, std::optional<float> lineHeightConstraint, bool textIsJustified, IncludeReasons includeReasons)
{
if (textRenderer.is8Bit())
- return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font, lineHeightConstraint, false, includeReasons);
- return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font, lineHeightConstraint, textIsJustified, includeReasons);
+ return canUseForText(textRenderer.characters8(), textRenderer.textLength(), fontCascade, lineHeightConstraint, false, includeReasons);
+ return canUseForText(textRenderer.characters16(), textRenderer.textLength(), fontCascade, lineHeightConstraint, textIsJustified, includeReasons);
}
static AvoidanceReasonFlags canUseForFontAndText(const RenderBlockFlow& flow, IncludeReasons includeReasons)
@@ -189,8 +191,8 @@
AvoidanceReasonFlags reasons = { };
// We assume that all lines have metrics based purely on the primary font.
const auto& style = flow.style();
- auto& primaryFont = style.fontCascade().primaryFont();
- if (primaryFont.isLoading())
+ auto& fontCascade = style.fontCascade();
+ if (fontCascade.primaryFont().isLoading())
SET_REASON_AND_RETURN_IF_NEEDED(FlowIsMissingPrimaryFont, reasons, includeReasons);
std::optional<float> lineHeightConstraint;
if (style.lineBoxContain() & LineBoxContainGlyphs)
@@ -210,7 +212,7 @@
if (style.fontCascade().codePath(TextRun(textRenderer.text())) != FontCascade::Simple)
SET_REASON_AND_RETURN_IF_NEEDED(FlowFontIsNotSimple, reasons, includeReasons);
- auto textReasons = canUseForText(textRenderer, primaryFont, lineHeightConstraint, flowIsJustified, includeReasons);
+ auto textReasons = canUseForText(textRenderer, fontCascade, lineHeightConstraint, flowIsJustified, includeReasons);
if (textReasons != NoReason)
SET_REASON_AND_RETURN_IF_NEEDED(textReasons, reasons, includeReasons);
}
@@ -1031,8 +1033,8 @@
case FlowIsMissingPrimaryFont:
stream << "missing primary font";
break;
- case FlowFontIsMissingGlyph:
- stream << "missing glyph";
+ case FlowPrimaryFontIsInsufficient:
+ stream << "missing glyph or glyph needs another font";
break;
case FlowTextIsCombineText:
stream << "text is combine";
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes