Diff
Modified: releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog (214736 => 214737)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog 2017-04-03 07:12:28 UTC (rev 214736)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/ChangeLog 2017-04-03 07:15:11 UTC (rev 214737)
@@ -1,3 +1,13 @@
+2017-03-14 Zalan Bujtas <za...@apple.com>
+
+ Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
+ https://bugs.webkit.org/show_bug.cgi?id=169617
+
+ Reviewed by Antti Koivisto.
+
+ * fast/text/simple-line-layout-hyphenation-constrains-expected.html: Added.
+ * fast/text/simple-line-layout-hyphenation-constrains.html: Added.
+
2017-03-13 Wenson Hsieh <wenson_hs...@apple.com>
Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView
Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains-expected.html (0 => 214737)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains-expected.html (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains-expected.html 2017-04-03 07:15:11 UTC (rev 214737)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that simple and normal line layout produce the same lines with hyphenation and enlarged font</title>
+<style>
+div {
+ display: inline-block;
+ width: 43px;
+ margin-right: 150px;
+ vertical-align: top;
+ font-size: 30px;
+}
+</style>
+</head>
+<body>
+<div>advantageous remunerative profitability</div>
+<div>saxicolous sesquipedalian superabundant</div>
+<div>unencumbered responsibilities unparagoned peerless</div>
+</body>
+</html>
Added: releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains.html (0 => 214737)
--- releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains.html (rev 0)
+++ releases/WebKitGTK/webkit-2.16/LayoutTests/fast/text/simple-line-layout-hyphenation-constrains.html 2017-04-03 07:15:11 UTC (rev 214737)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that simple and normal line layout produce the same lines with hyphenation and enlarged font</title>
+<style>
+div {
+ display: inline-block;
+ -webkit-hyphens: auto;
+ width: 43px;
+ margin-right: 150px;
+ vertical-align: top;
+ font-size: 30px;
+}
+</style>
+</head>
+<body>
+<div>advantageous remunerative profitability</div>
+<div>saxicolous sesquipedalian superabundant</div>
+<div>unencumbered responsibilities unparagoned peerless</div>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog (214736 => 214737)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-04-03 07:12:28 UTC (rev 214736)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/ChangeLog 2017-04-03 07:15:11 UTC (rev 214737)
@@ -1,3 +1,20 @@
+2017-03-14 Alan Kinsley <za...@apple.com>
+
+ Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
+ https://bugs.webkit.org/show_bug.cgi?id=169617
+
+ Reviewed by Antti Koivisto.
+
+ This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout.
+
+ Test: fast/text/simple-line-layout-hyphenation-constrains.html
+
+ * rendering/SimpleLineLayout.cpp:
+ (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613
+ (WebCore::SimpleLineLayout::splitFragmentToFitLine):
+ * rendering/line/BreakingContext.h: Integral -> fractional.
+ (WebCore::tryHyphenating):
+
2017-03-14 Adrian Perez de Castro <ape...@igalia.com>
Remove redundant check for "firstLine" in RenderBlock::lineHeight()
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/SimpleLineLayout.cpp (214736 => 214737)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-04-03 07:12:28 UTC (rev 214736)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-04-03 07:15:11 UTC (rev 214737)
@@ -596,7 +596,7 @@
}
static std::optional<unsigned> hyphenPositionForFragment(unsigned splitPosition, TextFragmentIterator::TextFragment& fragmentToSplit,
- const TextFragmentIterator& textFragmentIterator, float availableWidth)
+ const TextFragmentIterator& textFragmentIterator, float availableWidth, bool lineIsEmpty)
{
auto& style = textFragmentIterator.style();
bool shouldHyphenate = style.shouldHyphenate && (!style.hyphenLimitLines || fragmentToSplit.wrappingWithHyphenCounter() < *style.hyphenLimitLines);
@@ -603,7 +603,12 @@
if (!shouldHyphenate)
return std::nullopt;
- if (!enoughWidthForHyphenation(availableWidth, style.font.pixelSize()))
+ // FIXME: This is a workaround for webkit.org/b/169613. See maxPrefixWidth computation in tryHyphenating().
+ // It does not work properly with non-collapsed leading tabs when font is enlarged.
+ auto adjustedAvailableWidth = availableWidth - style.hyphenStringWidth;
+ if (!lineIsEmpty)
+ adjustedAvailableWidth += style.spaceWidth;
+ if (!enoughWidthForHyphenation(adjustedAvailableWidth, style.font.pixelSize()))
return std::nullopt;
// We might be able to fit the hyphen at the split position.
@@ -620,7 +625,7 @@
return textFragmentIterator.lastHyphenPosition(fragmentToSplit, splitPositionWithHyphen + 1);
}
-static TextFragmentIterator::TextFragment splitFragmentToFitLine(TextFragmentIterator::TextFragment& fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const TextFragmentIterator& textFragmentIterator)
+static TextFragmentIterator::TextFragment splitFragmentToFitLine(TextFragmentIterator::TextFragment& fragmentToSplit, float availableWidth, bool lineIsEmpty, const TextFragmentIterator& textFragmentIterator)
{
// FIXME: add surrogate pair support.
unsigned start = fragmentToSplit.start();
@@ -631,9 +636,9 @@
unsigned splitPosition = (*it);
// Does first character fit this line?
if (splitPosition == start) {
- if (keepAtLeastOneCharacter)
+ if (lineIsEmpty)
++splitPosition;
- } else if (auto hyphenPosition = hyphenPositionForFragment(splitPosition, fragmentToSplit, textFragmentIterator, availableWidth))
+ } else if (auto hyphenPosition = hyphenPositionForFragment(splitPosition, fragmentToSplit, textFragmentIterator, availableWidth, lineIsEmpty))
return fragmentToSplit.splitWithHyphen(*hyphenPosition, textFragmentIterator);
return fragmentToSplit.split(splitPosition, textFragmentIterator);
}
Modified: releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/line/BreakingContext.h (214736 => 214737)
--- releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/line/BreakingContext.h 2017-04-03 07:12:28 UTC (rev 214736)
+++ releases/WebKitGTK/webkit-2.16/Source/WebCore/rendering/line/BreakingContext.h 2017-04-03 07:15:11 UTC (rev 214737)
@@ -662,7 +662,7 @@
lineWhitespaceCollapsingState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
}
-inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, std::optional<unsigned> nextBreakable, bool& hyphenated)
+inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, float availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, std::optional<unsigned> nextBreakable, bool& hyphenated)
{
// Map 'hyphenate-limit-{before,after}: auto;' to 2.
unsigned minimumPrefixLength;
@@ -684,7 +684,7 @@
if (consecutiveHyphenatedLinesLimit >= 0 && consecutiveHyphenatedLines >= static_cast<unsigned>(consecutiveHyphenatedLinesLimit))
return;
- int hyphenWidth = measureHyphenWidth(text, font);
+ float hyphenWidth = measureHyphenWidth(text, font);
float maxPrefixWidth = availableWidth - xPos - hyphenWidth - lastSpaceWordSpacing;
if (!enoughWidthForHyphenation(maxPrefixWidth, font.pixelSize()))