Changeset 229202 in webkit


Ignore:
Timestamp:
Mar 3, 2018 9:19:13 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp
https://bugs.webkit.org/show_bug.cgi?id=183165

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2018-03-03
Reviewed by Darin Adler.

Source/WebCore:

Some of the calls in SVGToOTFFontConversion.cpp were directed to the function
in MathExtras.h while the rest were directed to this local static function.
There should not be two versions with the same name while they are supposed
to do the same thing. Besides, the local version does not work correctly
if the type of the argument's max limit is less the max limit of the returned
type, e.g. char -> uint16_t.

  • svg/SVGToOTFFontConversion.cpp:

(WebCore::clampTo): Deleted.

LayoutTests:

Re-baseline the results of these two tests since the local version of
clampTo() was not returning the expected results always.

  • platform/ios/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt:
  • platform/ios/svg/text/text-altglyph-01-b-expected.txt:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229200 r229202  
     12018-03-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=183165
     5
     6        Reviewed by Darin Adler.
     7
     8        Re-baseline the results of these two tests since the local version of
     9        clampTo() was not returning the expected results always.
     10
     11        * platform/ios/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt:
     12        * platform/ios/svg/text/text-altglyph-01-b-expected.txt:
     13
    1142018-03-03  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/LayoutTests/platform/ios/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt

    r205001 r229202  
    1212      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
    1313      RenderSVGContainer {g} at (45,125) size 428x165
    14         RenderSVGText {text} at (140,130) size 192x75 contains 1 chunk(s)
     14        RenderSVGText {text} at (140,130) size 199x75 contains 1 chunk(s)
    1515          RenderSVGTSpan {altGlyph} at (0,0) size 44x75
    1616            RenderSVGInlineText {#text} at (0,0) size 44x75
    17               chunk 1 text run 1 at (140.00,190.00) startOffset 0 endOffset 1 width 43.32: "H"
     17              chunk 1 text run 1 at (140.00,190.00) startOffset 0 endOffset 1 width 43.33: "H"
    1818          RenderSVGInlineText {#text} at (0,0) size 0x0
    1919          RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    2020            RenderSVGInlineText {#text} at (43,0) size 38x75
    21               chunk 1 text run 1 at (183.32,190.00) startOffset 0 endOffset 1 width 37.50: "A"
     21              chunk 1 text run 1 at (183.33,190.00) startOffset 0 endOffset 1 width 37.50: "A"
    2222          RenderSVGInlineText {#text} at (0,0) size 0x0
    23           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    24             RenderSVGInlineText {#text} at (80,0) size 37x75
    25               chunk 1 text run 1 at (220.82,190.00) startOffset 0 endOffset 1 width 36.66: "P"
     23          RenderSVGTSpan {altGlyph} at (0,0) size 41x75
     24            RenderSVGInlineText {#text} at (80,0) size 41x75
     25              chunk 1 text run 1 at (220.83,190.00) startOffset 0 endOffset 1 width 40.02: "P"
    2626          RenderSVGInlineText {#text} at (0,0) size 0x0
    27           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    28             RenderSVGInlineText {#text} at (117,0) size 37x75
    29               chunk 1 text run 1 at (257.48,190.00) startOffset 0 endOffset 1 width 36.66: "P"
     27          RenderSVGTSpan {altGlyph} at (0,0) size 41x75
     28            RenderSVGInlineText {#text} at (120,0) size 41x75
     29              chunk 1 text run 1 at (260.85,190.00) startOffset 0 endOffset 1 width 40.02: "P"
    3030          RenderSVGInlineText {#text} at (0,0) size 0x0
    31           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    32             RenderSVGInlineText {#text} at (154,0) size 38x75
    33               chunk 1 text run 1 at (294.14,190.00) startOffset 0 endOffset 1 width 37.50: "Y"
     31          RenderSVGTSpan {altGlyph} at (0,0) size 39x75
     32            RenderSVGInlineText {#text} at (160,0) size 38x75
     33              chunk 1 text run 1 at (300.87,190.00) startOffset 0 endOffset 1 width 37.50: "Y"
    3434          RenderSVGInlineText {#text} at (0,0) size 0x0
    3535        RenderSVGText {text} at (50,210) size 113x75 contains 1 chunk(s)
  • trunk/LayoutTests/platform/ios/svg/text/text-altglyph-01-b-expected.txt

    r205001 r229202  
    1212      RenderSVGHiddenContainer {defs} at (0,0) size 0x0
    1313      RenderSVGContainer {g} at (75,208) size 713x276
    14         RenderSVGText {text} at (140,130) size 192x75 contains 1 chunk(s)
     14        RenderSVGText {text} at (140,130) size 199x75 contains 1 chunk(s)
    1515          RenderSVGTSpan {altGlyph} at (0,0) size 44x75
    1616            RenderSVGInlineText {#text} at (0,0) size 44x75
    17               chunk 1 text run 1 at (140.00,190.00) startOffset 0 endOffset 1 width 43.32: "H"
     17              chunk 1 text run 1 at (140.00,190.00) startOffset 0 endOffset 1 width 43.33: "H"
    1818          RenderSVGInlineText {#text} at (0,0) size 0x0
    1919          RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    2020            RenderSVGInlineText {#text} at (43,0) size 38x75
    21               chunk 1 text run 1 at (183.32,190.00) startOffset 0 endOffset 1 width 37.50: "A"
     21              chunk 1 text run 1 at (183.33,190.00) startOffset 0 endOffset 1 width 37.50: "A"
    2222          RenderSVGInlineText {#text} at (0,0) size 0x0
    23           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    24             RenderSVGInlineText {#text} at (80,0) size 37x75
    25               chunk 1 text run 1 at (220.82,190.00) startOffset 0 endOffset 1 width 36.66: "P"
     23          RenderSVGTSpan {altGlyph} at (0,0) size 41x75
     24            RenderSVGInlineText {#text} at (80,0) size 41x75
     25              chunk 1 text run 1 at (220.83,190.00) startOffset 0 endOffset 1 width 40.02: "P"
    2626          RenderSVGInlineText {#text} at (0,0) size 0x0
    27           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    28             RenderSVGInlineText {#text} at (117,0) size 37x75
    29               chunk 1 text run 1 at (257.48,190.00) startOffset 0 endOffset 1 width 36.66: "P"
     27          RenderSVGTSpan {altGlyph} at (0,0) size 41x75
     28            RenderSVGInlineText {#text} at (120,0) size 41x75
     29              chunk 1 text run 1 at (260.85,190.00) startOffset 0 endOffset 1 width 40.02: "P"
    3030          RenderSVGInlineText {#text} at (0,0) size 0x0
    31           RenderSVGTSpan {altGlyph} at (0,0) size 38x75
    32             RenderSVGInlineText {#text} at (154,0) size 38x75
    33               chunk 1 text run 1 at (294.14,190.00) startOffset 0 endOffset 1 width 37.50: "Y"
     31          RenderSVGTSpan {altGlyph} at (0,0) size 39x75
     32            RenderSVGInlineText {#text} at (160,0) size 38x75
     33              chunk 1 text run 1 at (300.87,190.00) startOffset 0 endOffset 1 width 37.50: "Y"
    3434          RenderSVGInlineText {#text} at (0,0) size 0x0
    3535        RenderSVGText {text} at (50,210) size 113x75 contains 1 chunk(s)
  • trunk/Source/WebCore/ChangeLog

    r229200 r229202  
     12018-03-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=183165
     5
     6        Reviewed by Darin Adler.
     7
     8        Some of the calls in SVGToOTFFontConversion.cpp were directed to the function
     9        in MathExtras.h while the rest were directed to this local static function.
     10        There should not be two versions with the same name while they are supposed
     11        to do the same thing. Besides, the local version does not work correctly
     12        if the type of the argument's max limit is less the max limit of the returned
     13        type, e.g. char -> uint16_t.
     14
     15        * svg/SVGToOTFFontConversion.cpp:
     16        (WebCore::clampTo): Deleted.
     17
    1182018-03-03  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/svg/SVGToOTFFontConversion.cpp

    r219050 r229202  
    422422}
    423423
    424 // Assumption: T2 can hold every value that a T1 can hold.
    425 template<typename T1, typename T2> static inline T1 clampTo(T2 x)
    426 {
    427     x = std::min(x, static_cast<T2>(std::numeric_limits<T1>::max()));
    428     x = std::max(x, static_cast<T2>(std::numeric_limits<T1>::min()));
    429     return static_cast<T1>(x);
    430 }
    431 
    432424void SVGToOTFFontConverter::appendHHEATable()
    433425{
Note: See TracChangeset for help on using the changeset viewer.