[Webkit-unassigned] [Bug 153980] Soft hyphen is not shown when it is placed at the end of an inline element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Feb 17 14:01:50 PST 2016
https://bugs.webkit.org/show_bug.cgi?id=153980
zalan <zalan at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|zalan at apple.com |webkit-unassigned at lists.web
| |kit.org
--- Comment #1 from zalan <zalan at apple.com> ---
We missed the case when the character at the breaking position does not fit the line and soft-hyphen is followed by this overflowing character. (foo­bar where b overflows the line). In such cases we don't yet have an item in the breaking history.
This should fix it ->
diff --git a/Source/WebCore/rendering/line/BreakingContext.h b/Source/WebCore/rendering/line/BreakingContext.h
index b44c5a2..46b1c68 100644
--- a/Source/WebCore/rendering/line/BreakingContext.h
+++ b/Source/WebCore/rendering/line/BreakingContext.h
@@ -903,8 +903,28 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
m_lineInfo.setPreviousLineBrokeCleanly(true);
wordMeasurement.endOffset = m_lineBreakHistory.offset();
}
- if (m_lineBreakHistory.offset() && downcast<RenderText>(m_lineBreakHistory.renderer()) && downcast<RenderText>(*m_lineBreakHistory.renderer()).textLength() && downcast<RenderText>(*m_lineBreakHistory.renderer()).characterAt(m_lineBreakHistory.offset() - 1) == softHyphen && style.hyphens() != HyphensNone)
- hyphenated = true;
+ // Check if the last breaking position is a soft-hyphen.
+ if (!hyphenated) {
+ const RenderText* textRenderer = nullptr;
+ Optional<int> breakingPositon;
+ if (m_lineBreakHistory.historyLength() && is<RenderText>(m_lineBreakHistory.renderer())) {
+ textRenderer = downcast<RenderText>(m_lineBreakHistory.renderer());
+ breakingPositon = m_lineBreakHistory.offset();
+ } else if (nextBreakablePosition > -1 && is<RenderText>(m_current.renderer())) {
+ textRenderer = downcast<RenderText>(m_current.renderer());
+ breakingPositon = nextBreakablePosition;
+ }
+ if (textRenderer && breakingPositon) {
+ if (breakingPositon.value() == 0) {
+ // We need to check the previous renderer for the soft-hyphen character instead.
+ textRenderer = is<RenderText>(m_lastObject) ? downcast<RenderText>(m_lastObject) : nullptr;
+ if (textRenderer)
+ breakingPositon = textRenderer->textLength();
+ }
+ UChar characterBeforeBreakingPosition = textRenderer->characterAt(breakingPositon.value() - 1);
+ hyphenated = characterBeforeBreakingPosition == softHyphen && style.hyphens() != HyphensNone;
+ }
+ }
if (m_lineBreakHistory.offset() && m_lineBreakHistory.offset() != (unsigned)wordMeasurement.endOffset && !wordMeasurement.width) {
if (charWidth) {
wordMeasurement.endOffset = m_lineBreakHistory.offset();
Patch is coming up soon. (need to see first if checking prev is sufficient enough)
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160217/5e995c81/attachment.html>
More information about the webkit-unassigned
mailing list