Bail out of simple line layout when hyphen needs a fallback font.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 18:19:31 +0000 (18:19 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 18:19:31 +0000 (18:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171811

Reviewed by Antti Koivisto.

With hyphen: auto is set, we don't know if the hypen string is going to be used, until
after we started laying out the content and figured that the text overflows the line.
However it's too late to bail out of simple line layout at this point, so let's just
pre-check if the hyphen string needs a fallback font.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForStyle):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/SimpleLineLayout.cpp

index a445994..f2c0af7 100644 (file)
@@ -1,3 +1,18 @@
+2017-05-08  Zalan Bujtas  <zalan@apple.com>
+
+        Bail out of simple line layout when hyphen needs a fallback font.
+        https://bugs.webkit.org/show_bug.cgi?id=171811
+
+        Reviewed by Antti Koivisto.
+
+        With hyphen: auto is set, we don't know if the hypen string is going to be used, until
+        after we started laying out the content and figured that the text overflows the line.
+        However it's too late to bail out of simple line layout at this point, so let's just
+        pre-check if the hyphen string needs a fallback font.
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForStyle):
+
 2017-05-08  Youenn Fablet  <youenn@apple.com>
 
         TURNS gathering is not working properly
index b3f1d0f..c6ddcac 100644 (file)
@@ -241,6 +241,11 @@ static AvoidanceReasonFlags canUseForStyle(const RenderStyle& style, IncludeReas
     if (style.trailingWord() != TrailingWord::Auto)
         SET_REASON_AND_RETURN_IF_NEEDED(FlowHasNonAutoTrailingWord, reasons, includeReasons);
 #endif
+    if (style.hyphens() == HyphensAuto) {
+        auto textReasons = canUseForText(style.hyphenString(), style.fontCascade(), std::nullopt, false, includeReasons);
+        if (textReasons != NoReason)
+            SET_REASON_AND_RETURN_IF_NEEDED(textReasons, reasons, includeReasons);
+    }
     return reasons;
 }