Title: [192429] branches/safari-601.1.46-branch

Diff

Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (192428 => 192429)


--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-11-13 17:03:50 UTC (rev 192429)
@@ -1,5 +1,25 @@
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r192269. rdar://problem/23189742
+
+    2015-11-09  David Hyatt  <hy...@apple.com>
+
+            tate-chu-yoko should shrink to fit when it exceeds the available width.
+            <rdar://problem/12130468>
+            https://bugs.webkit.org/show_bug.cgi?id=151051
+
+            Reviewed by Myles Maxfield.
+
+            * fast/text/international/spaces-combined-in-vertical-text-expected.txt:
+            * fast/text/text-combine-crash-expected.txt:
+            * platform/mac/fast/text/decorations-with-text-combine-expected.png:
+            * platform/mac/fast/text/decorations-with-text-combine-expected.txt:
+            * platform/mac/fast/text/international/text-combine-image-test-expected.txt:
+            * platform/mac/fast/text/tatechuyoko-expected.png:
+            * platform/mac/fast/text/tatechuyoko-expected.txt:
+
+2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r192120. rdar://problem/23189774
 
     2015-11-06  Myles C. Maxfield  <mmaxfi...@apple.com>

Modified: branches/safari-601.1.46-branch/LayoutTests/fast/text/text-combine-crash-expected.txt (192428 => 192429)


--- branches/safari-601.1.46-branch/LayoutTests/fast/text/text-combine-crash-expected.txt	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/LayoutTests/fast/text/text-combine-crash-expected.txt	2015-11-13 17:03:50 UTC (rev 192429)
@@ -2,7 +2,7 @@
 CONSOLE MESSAGE: line 1: SyntaxError: Unexpected token '&'
 Test passes if there's no crash.
 
-foo   
+
 
 
 Errlog webtest_fn_1: TypeError: undefined is not an object (evaluating 'document.applets[0].addEventListener')

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/decorations-with-text-combine-expected.png


(Binary files differ)

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/decorations-with-text-combine-expected.txt (192428 => 192429)


--- branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/decorations-with-text-combine-expected.txt	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/decorations-with-text-combine-expected.txt	2015-11-13 17:03:50 UTC (rev 192429)
@@ -17,11 +17,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
         RenderBlock {DIV} at (46,0) size 36x584
           RenderText {#text} at (6,0) size 24x72
             text run at (6,0) width 72: "\x{305D}\x{306E}\x{5973}"
@@ -35,11 +35,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
       RenderBlock {DIV} at (92,0) size 82x584
         RenderBlock {DIV} at (0,0) size 36x584
           RenderText {#text} at (6,0) size 24x72
@@ -54,11 +54,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
         RenderBlock {DIV} at (46,0) size 36x584
           RenderText {#text} at (6,0) size 24x72
             text run at (6,0) width 72: "\x{305D}\x{306E}\x{5973}"
@@ -72,11 +72,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
       RenderBlock {DIV} at (184,0) size 82x584
         RenderBlock {DIV} at (0,0) size 36x584
           RenderText {#text} at (6,0) size 24x72
@@ -91,11 +91,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
         RenderBlock {DIV} at (46,0) size 36x584
           RenderText {#text} at (6,0) size 24x72
             text run at (6,0) width 72: "\x{305D}\x{306E}\x{5973}"
@@ -109,11 +109,11 @@
               text run at (6,144) width 24: "\x{FFFC}"
           RenderText {#text} at (6,168) size 24x120
             text run at (6,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (6,288) size 24x71
-              text run at (6,288) width 71: "12345"
-          RenderText {#text} at (6,358) size 24x169
-            text run at (6,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (6,288) size 24x24
+              text run at (6,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (6,312) size 24x168
+            text run at (6,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
       RenderBlock {DIV} at (276,0) size 98x584
         RenderBlock {DIV} at (0,0) size 44x584
           RenderText {#text} at (14,0) size 24x72
@@ -128,11 +128,11 @@
               text run at (14,144) width 24: "\x{FFFC}"
           RenderText {#text} at (14,168) size 24x120
             text run at (14,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (14,288) size 24x71
-              text run at (14,288) width 71: "12345"
-          RenderText {#text} at (14,358) size 24x169
-            text run at (14,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (14,288) size 24x24
+              text run at (14,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (14,312) size 24x168
+            text run at (14,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
         RenderBlock {DIV} at (54,0) size 44x584
           RenderText {#text} at (14,0) size 24x72
             text run at (14,0) width 72: "\x{305D}\x{306E}\x{5973}"
@@ -146,8 +146,8 @@
               text run at (14,144) width 24: "\x{FFFC}"
           RenderText {#text} at (14,168) size 24x120
             text run at (14,168) width 120: "\x{304B}\x{3057}\x{3064}\x{3051}\x{306B}"
-          RenderInline {SPAN} at (0,0) size 24x71 [color=#0000FF]
-            RenderCombineText {#text} at (14,288) size 24x71
-              text run at (14,288) width 71: "12345"
-          RenderText {#text} at (14,358) size 24x169
-            text run at (14,358) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"
+          RenderInline {SPAN} at (0,0) size 24x24 [color=#0000FF]
+            RenderCombineText {#text} at (14,288) size 24x24
+              text run at (14,288) width 24: "\x{FFFC}"
+          RenderText {#text} at (14,312) size 24x168
+            text run at (14,312) width 168: "\x{6765}\x{3066}\x{304F}\x{308C}\x{308B}\x{307E}\x{3067}"

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/international/text-combine-image-test-expected.txt (192428 => 192429)


--- branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/international/text-combine-image-test-expected.txt	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/international/text-combine-image-test-expected.txt	2015-11-13 17:03:50 UTC (rev 192429)
@@ -40,32 +40,32 @@
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {HR} at (132,0) size 2x584 [border: (1px inset #000000)]
       RenderBlock (anonymous) at (142,0) size 45x584
-        RenderInline {SPAN} at (0,0) size 37x465
-          RenderInline {SPAN} at (0,0) size 37x79
-            RenderCombineText {#text} at (4,0) size 37x79
-              text run at (4,0) width 79: "Times"
-          RenderText {#text} at (4,78) size 37x83
-            text run at (4,78) width 83: "=\x{897F}\x{66A6}"
-          RenderInline {SPAN} at (0,0) size 37x65
-            RenderCombineText {#text} at (4,160) size 37x65
-              text run at (4,160) width 64: "2010"
-          RenderText {#text} at (4,224) size 37x33
-            text run at (4,224) width 32: "\x{5E74}"
+        RenderInline {SPAN} at (0,0) size 37x371
+          RenderInline {SPAN} at (0,0) size 37x32
+            RenderCombineText {#text} at (4,0) size 37x32
+              text run at (4,0) width 32: "\x{FFFC}"
+          RenderText {#text} at (4,32) size 37x83
+            text run at (4,32) width 83: "=\x{897F}\x{66A6}"
           RenderInline {SPAN} at (0,0) size 37x33
-            RenderCombineText {#text} at (4,256) size 37x33
-              text run at (4,256) width 32: "\x{FFFC}"
-          RenderText {#text} at (4,288) size 37x33
-            text run at (4,288) width 32: "\x{6708}"
+            RenderCombineText {#text} at (4,114) size 37x33
+              text run at (4,114) width 32: "\x{FFFC}"
+          RenderText {#text} at (4,146) size 37x33
+            text run at (4,146) width 32: "\x{5E74}"
           RenderInline {SPAN} at (0,0) size 37x33
-            RenderCombineText {#text} at (4,320) size 37x33
-              text run at (4,320) width 32: "\x{FFFC}"
-          RenderText {#text} at (4,352) size 37x33
-            text run at (4,352) width 32: "\x{65E5}"
-          RenderInline {SPAN} at (0,0) size 37x49
-            RenderCombineText {#text} at (4,384) size 37x49
-              text run at (4,384) width 48: "365"
-          RenderText {#text} at (4,432) size 37x33
-            text run at (4,432) width 32: "\x{56DE}"
+            RenderCombineText {#text} at (4,178) size 37x33
+              text run at (4,178) width 32: "\x{FFFC}"
+          RenderText {#text} at (4,210) size 37x33
+            text run at (4,210) width 32: "\x{6708}"
+          RenderInline {SPAN} at (0,0) size 37x33
+            RenderCombineText {#text} at (4,242) size 37x33
+              text run at (4,242) width 32: "\x{FFFC}"
+          RenderText {#text} at (4,274) size 37x33
+            text run at (4,274) width 32: "\x{65E5}"
+          RenderInline {SPAN} at (0,0) size 37x33
+            RenderCombineText {#text} at (4,306) size 37x33
+              text run at (4,306) width 32: "\x{FFFC}"
+          RenderText {#text} at (4,338) size 37x33
+            text run at (4,338) width 32: "\x{56DE}"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {HR} at (195,0) size 2x584 [border: (1px inset #000000)]
       RenderBlock (anonymous) at (205,0) size 96x584

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac/fast/text/tatechuyoko-expected.png


(Binary files differ)

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192428 => 192429)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-11-13 17:03:50 UTC (rev 192429)
@@ -1,5 +1,31 @@
 2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r192269. rdar://problem/23189742
+
+    2015-11-09  David Hyatt  <hy...@apple.com>
+
+            tate-chu-yoko should shrink to fit when it exceeds the available width.
+            <rdar://problem/12130468>
+            https://bugs.webkit.org/show_bug.cgi?id=151051
+
+            Reviewed by Myles Maxfield.
+
+            Covered by existing tests
+
+            * rendering/RenderCombineText.cpp:
+            (WebCore::RenderCombineText::combineText):
+
+            When testing for text-combine, find the font variant that is the best fit, i.e.,
+            that exceeds the available width by the smallest amount. Scale that best fit down
+            repeatedly until it fits within the available space. We set a pixel size of 6 as
+            the threshold at which we give up.
+
+            Also make sure to reset glyphOverflow on each measurement, as this was creating
+            a potential bug both with variant checking and then with scaling, since glyphOverflow
+            isn't reset when width() is invoked.
+
+2015-11-13  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r192120. rdar://problem/23189774
 
     2015-11-06  Myles C. Maxfield  <mmaxfi...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp (192428 => 192429)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-13 17:03:47 UTC (rev 192428)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-13 17:03:50 UTC (rev 192429)
@@ -107,10 +107,14 @@
     glyphOverflow.computeBounds = true;
     
     float combinedTextWidth = width(0, textLength(), originalFont(), 0, nullptr, &glyphOverflow);
+
+    float bestFitDelta = combinedTextWidth - emWidth;
+    auto bestFitDescription = description;
+
     m_isCombined = combinedTextWidth <= emWidth;
     
     FontSelector* fontSelector = style().fontCascade().fontSelector();
-
+    
     if (m_isCombined)
         shouldUpdateFont = m_combineFontStyle->setFontDescription(description); // Need to change font orientation to horizontal.
     else {
@@ -122,6 +126,7 @@
             FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
             compressedFont.update(fontSelector);
             
+            glyphOverflow.left = glyphOverflow.top = glyphOverflow.right = glyphOverflow.bottom = 0;
             float runWidth = RenderText::width(0, textLength(), compressedFont, 0, nullptr, &glyphOverflow);
             if (runWidth <= emWidth) {
                 combinedTextWidth = runWidth;
@@ -131,11 +136,36 @@
                 shouldUpdateFont = m_combineFontStyle->setFontDescription(description);
                 break;
             }
+            
+            float widthDelta = runWidth - emWidth;
+            if (widthDelta < bestFitDelta) {
+                bestFitDelta = widthDelta;
+                bestFitDescription = description;
+            }
         }
     }
 
-    if (!m_isCombined)
-        shouldUpdateFont = m_combineFontStyle->setFontDescription(originalFont().fontDescription());
+    if (!m_isCombined) {
+        float scaleFactor = std::max(0.4f, emWidth / (emWidth + bestFitDelta));
+        float originalSize = bestFitDescription.computedSize();
+        do {
+            float computedSize = originalSize * scaleFactor;
+            bestFitDescription.setComputedSize(computedSize);
+            shouldUpdateFont = m_combineFontStyle->setFontDescription(bestFitDescription);
+        
+            FontCascade compressedFont(bestFitDescription, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
+            compressedFont.update(fontSelector);
+            
+            glyphOverflow.left = glyphOverflow.top = glyphOverflow.right = glyphOverflow.bottom = 0;
+            float runWidth = RenderText::width(0, textLength(), compressedFont, 0, nullptr, &glyphOverflow);
+            if (runWidth <= emWidth) {
+                combinedTextWidth = runWidth;
+                m_isCombined = true;
+                break;
+            }
+            scaleFactor -= 0.05f;
+        } while (scaleFactor >= 0.4f);
+    }
 
     if (shouldUpdateFont)
         m_combineFontStyle->fontCascade().update(fontSelector);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to