Title: [211682] trunk
Revision
211682
Author
za...@apple.com
Date
2017-02-05 10:01:04 -0800 (Sun, 05 Feb 2017)

Log Message

Simple line layout: Use RenderText::canUseSimpleFontCodePath() only as a hint.
https://bugs.webkit.org/show_bug.cgi?id=167853
<rdar://problem/30367302>

Reviewed by Simon Fraser.

Source/WebCore:

Apparently RenderText::canUseSimpleFontCodePath() only checks if the string is qualified for
the simple font code path. However certain css properties could still force us to use the complex
path.
In most cases, we still do only one string traversal thanks to TextRun::setCharacterScanForCodePath().

Test: fast/text/simple-line-layout-simple-text-but-complex-font-path.html

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

LayoutTests:

* fast/text/simple-line-layout-simple-text-but-complex-font-path-expected.html: Added.
* fast/text/simple-line-layout-simple-text-but-complex-font-path.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (211681 => 211682)


--- trunk/LayoutTests/ChangeLog	2017-02-05 17:22:45 UTC (rev 211681)
+++ trunk/LayoutTests/ChangeLog	2017-02-05 18:01:04 UTC (rev 211682)
@@ -1,5 +1,16 @@
 2017-02-05  Zalan Bujtas  <za...@apple.com>
 
+        Simple line layout: Use RenderText::canUseSimpleFontCodePath() only as a hint.
+        https://bugs.webkit.org/show_bug.cgi?id=167853
+        <rdar://problem/30367302>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/simple-line-layout-simple-text-but-complex-font-path-expected.html: Added.
+        * fast/text/simple-line-layout-simple-text-but-complex-font-path.html: Added.
+
+2017-02-05  Zalan Bujtas  <za...@apple.com>
+
         Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
         https://bugs.webkit.org/show_bug.cgi?id=167840
         <rdar://problem/30364784>

Added: trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path-expected.html (0 => 211682)


--- trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path-expected.html	2017-02-05 18:01:04 UTC (rev 211682)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't try to use simple line layout for simple text but complex font path related properties.</title>
+</head>
+<body></body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path.html (0 => 211682)


--- trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-simple-text-but-complex-font-path.html	2017-02-05 18:01:04 UTC (rev 211682)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't try to use simple line layout for simple text but complex font path related properties.</title>
+<style>
+div {
+    color: white;      
+}
+.common-ligatures-disabled {
+    font-variant-ligatures: no-common-ligatures;
+}
+
+.common-ligatures-enabled {
+    font-variant-ligatures: common-ligatures;
+}
+</style>
+<script>
+if (window.internals) {
+    internals.settings.setSimpleLineLayoutDebugBordersEnabled(true);
+    internals.settings.setSimpleLineLayoutEnabled(true);
+}
+</script>
+</head>
+<body>
+    <div>
+        <div class="common-ligatures-disabled">file</div>
+        <div class="common-ligatures-enabled">file</div>
+    </div>
+    <div style="text-rendering: optimizelegibility">
+        <div class="common-ligatures-disabled">file</div>
+        <div class="common-ligatures-enabled">file</div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (211681 => 211682)


--- trunk/Source/WebCore/ChangeLog	2017-02-05 17:22:45 UTC (rev 211681)
+++ trunk/Source/WebCore/ChangeLog	2017-02-05 18:01:04 UTC (rev 211682)
@@ -1,3 +1,21 @@
+2017-02-05  Zalan Bujtas  <za...@apple.com>
+
+        Simple line layout: Use RenderText::canUseSimpleFontCodePath() only as a hint.
+        https://bugs.webkit.org/show_bug.cgi?id=167853
+        <rdar://problem/30367302>
+
+        Reviewed by Simon Fraser.
+
+        Apparently RenderText::canUseSimpleFontCodePath() only checks if the string is qualified for
+        the simple font code path. However certain css properties could still force us to use the complex
+        path.
+        In most cases, we still do only one string traversal thanks to TextRun::setCharacterScanForCodePath(). 
+
+        Test: fast/text/simple-line-layout-simple-text-but-complex-font-path.html
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForFontAndText):
+
 2017-02-05  Zan Dobersek  <zdober...@igalia.com>
 
         Move TextureMapper-specific logic out of GraphicsContext3DPrivate

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (211681 => 211682)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2017-02-05 17:22:45 UTC (rev 211681)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2017-02-05 18:01:04 UTC (rev 211682)
@@ -230,8 +230,15 @@
             SET_REASON_AND_RETURN_IF_NEEDED(FlowTextIsTextFragment, reasons, includeReasons);
         if (textRenderer.isSVGInlineText())
             SET_REASON_AND_RETURN_IF_NEEDED(FlowTextIsSVGInlineText, reasons, includeReasons);
-        if (!textRenderer.canUseSimpleFontCodePath())
+        if (!textRenderer.canUseSimpleFontCodePath()) {
+            // No need to check the code path at this point. We already know it can't be simple.
             SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);
+        } else {
+            TextRun run(textRenderer.text());
+            run.setCharacterScanForCodePath(false);
+            if (style.fontCascade().codePath(run) != FontCascade::Simple)
+                SET_REASON_AND_RETURN_IF_NEEDED(FlowHasComplexFontCodePath, reasons, includeReasons);
+        }
 
         auto textReasons = canUseForText(textRenderer.stringView(), fontCascade, lineHeightConstraint, flowIsJustified, includeReasons);
         if (textReasons != NoReason)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to