Changeset 61128 in webkit


Ignore:
Timestamp:
Jun 14, 2010, 10:06:56 AM (15 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/7752961> Unevenly distributed space in justified text
https://bugs.webkit.org/show_bug.cgi?id=36105

Reviewed by Simon Fraser.

WebCore:

Test: fast/text/justify-padding-distribution.html

  • platform/graphics/WidthIterator.cpp:

(WebCore::WidthIterator::WidthIterator): Initialize m_padPerSpace to the quotient of the total
padding and the number of spaces rather than truncating it.
(WebCore::WidthIterator::advance): Subtract m_padPerSpace from m_padding and add the difference
between its old and new values, when rounded, to the advance.

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::ComplexTextController::ComplexTextController):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):

  • platform/graphics/win/UniscribeController.cpp:

(WebCore::UniscribeController::UniscribeController):
(WebCore::UniscribeController::shapeAndPlaceItem):

  • platform/graphics/win/UniscribeController.h:

LayoutTests:

  • fast/text/justify-padding-distribution-expected.checksum: Added.
  • fast/text/justify-padding-distribution-expected.png: Added.
  • fast/text/justify-padding-distribution-expected.txt: Added.
  • fast/text/justify-padding-distribution.html: Added.
  • platform/mac/css1/box_properties/clear_float-expected.checksum:
  • platform/mac/css1/box_properties/clear_float-expected.png:
  • platform/mac/css1/box_properties/float_elements_in_series-expected.checksum:
  • platform/mac/css1/box_properties/float_elements_in_series-expected.png:
  • platform/mac/css1/box_properties/float_on_text_elements-expected.checksum:
  • platform/mac/css1/box_properties/float_on_text_elements-expected.png:
  • platform/mac/css1/text_properties/text_align-expected.checksum:
  • platform/mac/css1/text_properties/text_align-expected.png:
  • platform/mac/css2.1/t0905-c5525-fltcont-00-d-g-expected.checksum:
  • platform/mac/css2.1/t0905-c5525-fltcont-00-d-g-expected.png:
  • platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.checksum:
  • platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.png:
  • platform/mac/css2.1/t1602-c546-txt-align-00-b-expected.checksum:
  • platform/mac/css2.1/t1602-c546-txt-align-00-b-expected.png:
  • platform/mac/fast/multicol/float-avoidance-expected.checksum:
  • platform/mac/fast/multicol/float-avoidance-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-1-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-1-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-10-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-10-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-2-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-2-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-3-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-3-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-4-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-4-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-5-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-5-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-6-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-6-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-7-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-7-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-8-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-8-expected.png:
  • platform/mac/fast/repaint/line-flow-with-floats-9-expected.checksum:
  • platform/mac/fast/repaint/line-flow-with-floats-9-expected.png:
  • platform/mac/fast/text/atsui-spacing-features-expected.checksum:
  • platform/mac/fast/text/atsui-spacing-features-expected.png:
  • platform/mac/fast/text/justified-selection-at-edge-expected.checksum:
  • platform/mac/fast/text/justified-selection-at-edge-expected.png:
  • platform/mac/tables/mozilla/marvin/x_tbody_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_tbody_align_justify-expected.png:
  • platform/mac/tables/mozilla/marvin/x_td_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_td_align_justify-expected.png:
  • platform/mac/tables/mozilla/marvin/x_tfoot_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_tfoot_align_justify-expected.png:
  • platform/mac/tables/mozilla/marvin/x_th_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_th_align_justify-expected.png:
  • platform/mac/tables/mozilla/marvin/x_thead_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_thead_align_justify-expected.png:
  • platform/mac/tables/mozilla/marvin/x_tr_align_justify-expected.checksum:
  • platform/mac/tables/mozilla/marvin/x_tr_align_justify-expected.png:
Location:
trunk
Files:
4 added
58 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61125 r61128  
     12010-06-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7752961> Unevenly distributed space in justified text
     6        https://bugs.webkit.org/show_bug.cgi?id=36105
     7
     8        * fast/text/justify-padding-distribution-expected.checksum: Added.
     9        * fast/text/justify-padding-distribution-expected.png: Added.
     10        * fast/text/justify-padding-distribution-expected.txt: Added.
     11        * fast/text/justify-padding-distribution.html: Added.
     12        * platform/mac/css1/box_properties/clear_float-expected.checksum:
     13        * platform/mac/css1/box_properties/clear_float-expected.png:
     14        * platform/mac/css1/box_properties/float_elements_in_series-expected.checksum:
     15        * platform/mac/css1/box_properties/float_elements_in_series-expected.png:
     16        * platform/mac/css1/box_properties/float_on_text_elements-expected.checksum:
     17        * platform/mac/css1/box_properties/float_on_text_elements-expected.png:
     18        * platform/mac/css1/text_properties/text_align-expected.checksum:
     19        * platform/mac/css1/text_properties/text_align-expected.png:
     20        * platform/mac/css2.1/t0905-c5525-fltcont-00-d-g-expected.checksum:
     21        * platform/mac/css2.1/t0905-c5525-fltcont-00-d-g-expected.png:
     22        * platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.checksum:
     23        * platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.png:
     24        * platform/mac/css2.1/t1602-c546-txt-align-00-b-expected.checksum:
     25        * platform/mac/css2.1/t1602-c546-txt-align-00-b-expected.png:
     26        * platform/mac/fast/multicol/float-avoidance-expected.checksum:
     27        * platform/mac/fast/multicol/float-avoidance-expected.png:
     28        * platform/mac/fast/repaint/line-flow-with-floats-1-expected.checksum:
     29        * platform/mac/fast/repaint/line-flow-with-floats-1-expected.png:
     30        * platform/mac/fast/repaint/line-flow-with-floats-10-expected.checksum:
     31        * platform/mac/fast/repaint/line-flow-with-floats-10-expected.png:
     32        * platform/mac/fast/repaint/line-flow-with-floats-2-expected.checksum:
     33        * platform/mac/fast/repaint/line-flow-with-floats-2-expected.png:
     34        * platform/mac/fast/repaint/line-flow-with-floats-3-expected.checksum:
     35        * platform/mac/fast/repaint/line-flow-with-floats-3-expected.png:
     36        * platform/mac/fast/repaint/line-flow-with-floats-4-expected.checksum:
     37        * platform/mac/fast/repaint/line-flow-with-floats-4-expected.png:
     38        * platform/mac/fast/repaint/line-flow-with-floats-5-expected.checksum:
     39        * platform/mac/fast/repaint/line-flow-with-floats-5-expected.png:
     40        * platform/mac/fast/repaint/line-flow-with-floats-6-expected.checksum:
     41        * platform/mac/fast/repaint/line-flow-with-floats-6-expected.png:
     42        * platform/mac/fast/repaint/line-flow-with-floats-7-expected.checksum:
     43        * platform/mac/fast/repaint/line-flow-with-floats-7-expected.png:
     44        * platform/mac/fast/repaint/line-flow-with-floats-8-expected.checksum:
     45        * platform/mac/fast/repaint/line-flow-with-floats-8-expected.png:
     46        * platform/mac/fast/repaint/line-flow-with-floats-9-expected.checksum:
     47        * platform/mac/fast/repaint/line-flow-with-floats-9-expected.png:
     48        * platform/mac/fast/text/atsui-spacing-features-expected.checksum:
     49        * platform/mac/fast/text/atsui-spacing-features-expected.png:
     50        * platform/mac/fast/text/justified-selection-at-edge-expected.checksum:
     51        * platform/mac/fast/text/justified-selection-at-edge-expected.png:
     52        * platform/mac/tables/mozilla/marvin/x_tbody_align_justify-expected.checksum:
     53        * platform/mac/tables/mozilla/marvin/x_tbody_align_justify-expected.png:
     54        * platform/mac/tables/mozilla/marvin/x_td_align_justify-expected.checksum:
     55        * platform/mac/tables/mozilla/marvin/x_td_align_justify-expected.png:
     56        * platform/mac/tables/mozilla/marvin/x_tfoot_align_justify-expected.checksum:
     57        * platform/mac/tables/mozilla/marvin/x_tfoot_align_justify-expected.png:
     58        * platform/mac/tables/mozilla/marvin/x_th_align_justify-expected.checksum:
     59        * platform/mac/tables/mozilla/marvin/x_th_align_justify-expected.png:
     60        * platform/mac/tables/mozilla/marvin/x_thead_align_justify-expected.checksum:
     61        * platform/mac/tables/mozilla/marvin/x_thead_align_justify-expected.png:
     62        * platform/mac/tables/mozilla/marvin/x_tr_align_justify-expected.checksum:
     63        * platform/mac/tables/mozilla/marvin/x_tr_align_justify-expected.png:
     64
    1652010-06-14  Marcus Bulach  <bulach@chromium.org>
    266
  • trunk/LayoutTests/platform/mac/css1/box_properties/clear_float-expected.checksum

    r60205 r61128  
    1 ee38366edf587371ecd5e44b75ac4f83
     171748b4c92387280d1106a8266e8acad
  • trunk/LayoutTests/platform/mac/css1/box_properties/float_elements_in_series-expected.checksum

    r60205 r61128  
    1 9dd246594bcb497233da6a4eef206949
     143d98abae03e72e6c55a7eb903de2b0f
  • trunk/LayoutTests/platform/mac/css1/box_properties/float_on_text_elements-expected.checksum

    r60205 r61128  
    1 13759a847f6756cb98a48deaa9faa870
     126e25fa1fc507983803ba6309c7d963b
  • trunk/LayoutTests/platform/mac/css1/text_properties/text_align-expected.checksum

    r60205 r61128  
    1 eee20503b8b9b606b737b0561baf79a5
     14f3f2643de8c809f740d007d20eead50
  • trunk/LayoutTests/platform/mac/css2.1/t0905-c5525-fltcont-00-d-g-expected.checksum

    r42379 r61128  
    1 007ec3c23eebd3116871af355a8d9b3b
     1045b368aa3a4b3b324302698c9f1d4ed
  • trunk/LayoutTests/platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.checksum

    r42379 r61128  
    1 13cb1ca4cd7bb71ac46f536370c76360
     1e491e9fc5f8e8294814d100d83d7db07
  • trunk/LayoutTests/platform/mac/css2.1/t1602-c546-txt-align-00-b-expected.checksum

    r38122 r61128  
    1 7a509da9b91656eada33dfebca1a4a3d
     1ec586d40ba01d8b74341a0ce38a07169
  • trunk/LayoutTests/platform/mac/fast/multicol/float-avoidance-expected.checksum

    r38121 r61128  
    1 c8545b1323bd20899b86e692b5116fb2
     14f9e61fc2c6d3b0a1f75e2c47674f60f
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-1-expected.checksum

    r53010 r61128  
    1 ba610e3ad0cb701622f562dfbf2d5cb5
     1305fc4a2a2227aaffdb6f2fdfae0c30d
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-10-expected.checksum

    r38121 r61128  
    1 e17a88c51117505132e4ece85913f326
     1d9444aabdbc0013059ca36698d2fa593
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-2-expected.checksum

    r38121 r61128  
    1 9f2200fdb5b48b0d7ea1d24550b123f1
     1a5a0341e9a7898f523c0bd94351b6489
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-3-expected.checksum

    r38121 r61128  
    1 f67989722ec6c797822dce738ac78517
     109f905a8a21fef5708f0988bbd463ef0
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-4-expected.checksum

    r38121 r61128  
    1 9f1290f6ccea415d0b3c6f6ec52ff89c
     1a8bd2f0509729f0fac4c4847f4ac9680
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-5-expected.checksum

    r38121 r61128  
    1 c320ad13737ca944eaf11fcac5fa0d45
     14e604572281bc581a1c045be9b2c121d
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-6-expected.checksum

    r38121 r61128  
    1 db9a2c2acf5ae993a3aaf0edac756b9f
     104c7b5cdb56dea3ac76f3ab517424f4f
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-7-expected.checksum

    r38121 r61128  
    1 ce793bd2c08eec9bcad6620cefc9b1dd
     14214c4496b6f397db44450bf091511d0
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-8-expected.checksum

    r38121 r61128  
    1 0fe9c400c227e6e8a7a1c880b8aa6bc3
     1511a1387505c309295e38750d7f4a732
  • trunk/LayoutTests/platform/mac/fast/repaint/line-flow-with-floats-9-expected.checksum

    r38121 r61128  
    1 afd6b5e4425b9a3931b2afd2206053bd
     1766468f2fd0c58c412fcdbecf9fe1197
  • trunk/LayoutTests/platform/mac/fast/text/atsui-spacing-features-expected.checksum

    r38121 r61128  
    1 a2f8ebf485ed22d4876e38b725807b75
     16139b17401e3e95cee7504d0fec3bdc0
  • trunk/LayoutTests/platform/mac/fast/text/justified-selection-at-edge-expected.checksum

    r38121 r61128  
    1 cbf5886fcf7d9bf8c43df6254d7317f0
     1a51c45496b68f9ba48e221f2666bfbf6
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_tbody_align_justify-expected.checksum

    r60196 r61128  
    1 d25e40d86188e6c41bb09dfd3e77c3d7
     1b37a5632bb5b55737b75b57fbef70886
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_td_align_justify-expected.checksum

    r60196 r61128  
    1 02ccffadde62ebe726cbb091a736461c
     1ab5a679b58229d200570b4eae8bb1add
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_tfoot_align_justify-expected.checksum

    r60196 r61128  
    1 7a33c74f7dea146597af98b649edb017
     17e87779cc3115492afe41be349c37d80
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_th_align_justify-expected.checksum

    r60196 r61128  
    1 1ecc766b1ff30d780338c1e75ba8440a
     14418953485197b052c1d33db8a495965
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_thead_align_justify-expected.checksum

    r60196 r61128  
    1 983c73dac4db4ca966e20518525289e5
     1eef3d13dd15de0e6d3502973f8a60acc
  • trunk/LayoutTests/platform/mac/tables/mozilla/marvin/x_tr_align_justify-expected.checksum

    r60196 r61128  
    1 fe6b9b5cda16a61d65d7841bf6db9364
     1459bb5cd45d60909f1a73dff2b0d8ced
  • trunk/WebCore/ChangeLog

    r61127 r61128  
     12010-06-14  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7752961> Unevenly distributed space in justified text
     6        https://bugs.webkit.org/show_bug.cgi?id=36105
     7
     8        Test: fast/text/justify-padding-distribution.html
     9
     10        * platform/graphics/WidthIterator.cpp:
     11        (WebCore::WidthIterator::WidthIterator): Initialize m_padPerSpace to the quotient of the total
     12        padding and the number of spaces rather than truncating it.
     13        (WebCore::WidthIterator::advance): Subtract m_padPerSpace from m_padding and add the difference
     14        between its old and new values, when rounded, to the advance.
     15        * platform/graphics/mac/ComplexTextController.cpp:
     16        (WebCore::ComplexTextController::ComplexTextController):
     17        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
     18        * platform/graphics/win/UniscribeController.cpp:
     19        (WebCore::UniscribeController::UniscribeController):
     20        (WebCore::UniscribeController::shapeAndPlaceItem):
     21        * platform/graphics/win/UniscribeController.h:
     22
    1232010-06-14  Andreas Kling  <andreas.kling@nokia.com>
    224
  • trunk/WebCore/platform/graphics/WidthIterator.cpp

    r58585 r61128  
    11/*
    2  * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
    33 * Copyright (C) 2008 Holger Hans Peter Freyther
    44 *
     
    6161        m_padPerSpace = 0;
    6262    else {
    63         float numSpaces = 0;
    64         for (int i = 0; i < run.length(); i++)
     63        int numSpaces = 0;
     64        for (int i = 0; i < run.length(); i++) {
    6565            if (Font::treatAsSpace(m_run[i]))
    6666                numSpaces++;
    67 
    68         if (numSpaces == 0)
     67        }
     68
     69        if (!numSpaces)
    6970            m_padPerSpace = 0;
    7071        else
    71             m_padPerSpace = ceilf(m_run.padding() / numSpaces);
     72            m_padPerSpace = m_padding / numSpaces;
    7273    }
    7374}
     
    171172                        m_padding = 0;
    172173                    } else {
    173                         width += m_padPerSpace;
     174                        float previousPadding = m_padding;
    174175                        m_padding -= m_padPerSpace;
     176                        width += roundf(previousPadding) - roundf(m_padding);
    175177                    }
    176178                }
  • trunk/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r59570 r61128  
    11/*
    2  * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7070    , m_characterInCurrentGlyph(0)
    7171    , m_finalRoundingWidth(0)
     72    , m_padding(run.padding())
    7273    , m_fallbackFonts(fallbackFonts)
    7374    , m_minGlyphBoundingBoxX(numeric_limits<float>::max())
     
    7778    , m_lastRoundingGlyph(0)
    7879{
    79     m_padding = m_run.padding();
    8080    if (!m_padding)
    8181        m_padPerSpace = 0;
    8282    else {
    83         float numSpaces = 0;
    84         for (int s = 0; s < m_run.length(); s++)
     83        int numSpaces = 0;
     84        for (int s = 0; s < m_run.length(); s++) {
    8585            if (Font::treatAsSpace(m_run[s]))
    8686                numSpaces++;
    87 
    88         if (numSpaces == 0)
     87        }
     88
     89        if (!numSpaces)
    8990            m_padPerSpace = 0;
    9091        else
    91             m_padPerSpace = ceilf(m_run.padding() / numSpaces);
     92            m_padPerSpace = m_padding / numSpaces;
    9293    }
    9394
     
    509510                            m_padding = 0;
    510511                        } else {
    511                             advance.width += m_padPerSpace;
     512                            float previousPadding = m_padding;
    512513                            m_padding -= m_padPerSpace;
     514                            advance.width += roundf(previousPadding) - roundf(m_padding);
    513515                        }
    514516                    }
  • trunk/WebCore/platform/graphics/win/UniscribeController.cpp

    r58192 r61128  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions
    66 * are met:
     7 * 1. Redistributions of source code must retain the above copyright
     8 *    notice, this list of conditions and the following disclaimer.
     9 * 2. Redistributions in binary form must reproduce the above copyright
     10 *    notice, this list of conditions and the following disclaimer in the
     11 *    documentation and/or other materials provided with the distribution.
    712 *
    8  * 1.  Redistributions of source code must retain the above copyright
    9  *     notice, this list of conditions and the following disclaimer.
    10  * 2.  Redistributions in binary form must reproduce the above copyright
    11  *     notice, this list of conditions and the following disclaimer in the
    12  *     documentation and/or other materials provided with the distribution.
    13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
    14  *     its contributors may be used to endorse or promote products derived
    15  *     from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
    18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
    21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23 * THE POSSIBILITY OF SUCH DAMAGE.
    2724 */
    2825
     
    5249    , m_currentCharacter(0)
    5350    , m_runWidthSoFar(0)
     51    , m_padding(run.padding())
    5452    , m_computingOffsetPosition(false)
    5553    , m_includePartialGlyphs(false)
     
    5755    , m_offsetPosition(0)
    5856{
    59     m_padding = m_run.padding();
    6057    if (!m_padding)
    6158        m_padPerSpace = 0;
    6259    else {
    6360        float numSpaces = 0;
    64         for (int s = 0; s < m_run.length(); s++)
     61        for (int s = 0; s < m_run.length(); s++) {
    6562            if (Font::treatAsSpace(m_run[s]))
    6663                numSpaces++;
     64        }
    6765
    6866        if (numSpaces == 0)
    6967            m_padPerSpace = 0;
    7068        else
    71             m_padPerSpace = ceilf(m_run.padding() / numSpaces);
     69            m_padPerSpace = m_padding / numSpaces;
    7270    }
    7371
     
    340338                        m_padding = 0;
    341339                    } else {
    342                         advance += m_padPerSpace;
     340                        float previousPadding = m_padding;
    343341                        m_padding -= m_padPerSpace;
     342                        advance += roundf(previousPadding) - roundf(m_padding);
    344343                    }
    345344                }
  • trunk/WebCore/platform/graphics/win/UniscribeController.h

    r57215 r61128  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions
    66 * are met:
     7 * 1. Redistributions of source code must retain the above copyright
     8 *    notice, this list of conditions and the following disclaimer.
     9 * 2. Redistributions in binary form must reproduce the above copyright
     10 *    notice, this list of conditions and the following disclaimer in the
     11 *    documentation and/or other materials provided with the distribution.
    712 *
    8  * 1.  Redistributions of source code must retain the above copyright
    9  *     notice, this list of conditions and the following disclaimer.
    10  * 2.  Redistributions in binary form must reproduce the above copyright
    11  *     notice, this list of conditions and the following disclaimer in the
    12  *     documentation and/or other materials provided with the distribution.
    13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
    14  *     its contributors may be used to endorse or promote products derived
    15  *     from this software without specific prior written permission.
    16  *
    17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
    18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
    21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23 * THE POSSIBILITY OF SUCH DAMAGE.
    2724 */
    2825
Note: See TracChangeset for help on using the changeset viewer.