Changeset 61253 in webkit


Ignore:
Timestamp:
Jun 16, 2010 6:51:21 AM (14 years ago)
Author:
Nikolas Zimmermann
Message:

2010-06-16 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Dirk Schulze.

Provide floating-point support for text selection framework
https://bugs.webkit.org/show_bug.cgi?id=40665

This is the first chunk of the SVG Text rewrite patches.
offsetForPosition() / selectionRectForText() should accept float/FloatPoint arguments instead
of int/IntPoint. offsetForPosition() already worked with floats internally in Qt and Mac.
selectionRectForText() was already returning a FloatRect, but the passed in origin was an integer.
Fixing these problems in order to support sub-pixel positioning in the upcoming SVG Text rewrite patch.

Add a glyphScale parameter to TextRun, that will be used to support text selection
in lengthAdjust/textLength scenarios in SVG text, soon.

Doesn't affect any testcases so far. HTML is not affected in any way,
as it only ever passes integers to these functions.

  • platform/graphics/Font.cpp: (WebCore::Font::selectionRectForText): (WebCore::Font::offsetForPosition):
  • platform/graphics/Font.h:
  • platform/graphics/FontFastPath.cpp: (WebCore::Font::selectionRectForSimpleText): (WebCore::Font::offsetForPositionForSimpleText):
  • platform/graphics/TextRun.h: (WebCore::TextRun::TextRun): (WebCore::TextRun::glyphScale): (WebCore::TextRun::setGlyphScale): (WebCore::TextRun::applyGlyphScaling):
  • platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::advance):
  • platform/graphics/chromium/FontChromiumWin.cpp: (WebCore::Font::selectionRectForComplexText): (WebCore::Font::offsetForPositionForComplexText):
  • platform/graphics/chromium/FontLinux.cpp: (WebCore::Font::offsetForPositionForComplexText): (WebCore::Font::selectionRectForComplexText):
  • platform/graphics/efl/FontEfl.cpp: (WebCore::Font::offsetForPositionForComplexText): (WebCore::Font::selectionRectForComplexText):
  • platform/graphics/gtk/FontGtk.cpp: (WebCore::Font::offsetForPositionForComplexText): (WebCore::Font::selectionRectForComplexText):
  • platform/graphics/haiku/FontHaiku.cpp: (WebCore::Font::selectionRectForComplexText): (WebCore::Font::offsetForPositionForComplexText):
  • platform/graphics/mac/ComplexTextController.cpp: (WebCore::ComplexTextController::offsetForPosition):
  • platform/graphics/mac/ComplexTextController.h:
  • platform/graphics/mac/FontComplexTextMac.cpp: (WebCore::Font::selectionRectForComplexText): (WebCore::Font::offsetForPositionForComplexText):
  • platform/graphics/qt/FontQt.cpp: (WebCore::Font::offsetForPositionForSimpleText): (WebCore::Font::offsetForPositionForComplexText): (WebCore::Font::selectionRectForSimpleText): (WebCore::Font::selectionRectForComplexText):
  • platform/graphics/win/FontWin.cpp: (WebCore::Font::selectionRectForComplexText): (WebCore::Font::offsetForPositionForComplexText):
  • platform/graphics/wince/FontWince.cpp: (WebCore::Font::offsetForPositionForComplexText): (WebCore::Font::selectionRectForComplexText):
  • platform/graphics/wx/FontWx.cpp: (WebCore::Font::selectionRectForComplexText): (WebCore::Font::offsetForPositionForComplexText):
  • svg/SVGFont.cpp: (WebCore::Font::selectionRectForTextUsingSVGFont): (WebCore::Font::offsetForPositionForTextUsingSVGFont):
Location:
trunk/WebCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61252 r61253  
     12010-06-16  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        Provide floating-point support for text selection framework
     6        https://bugs.webkit.org/show_bug.cgi?id=40665
     7
     8        This is the first chunk of the SVG Text rewrite patches.
     9        offsetForPosition() / selectionRectForText() should accept float/FloatPoint arguments instead
     10        of int/IntPoint. offsetForPosition() already worked with floats internally in Qt and Mac.
     11        selectionRectForText() was already returning a FloatRect, but the passed in origin was an integer.
     12        Fixing these problems in order to support sub-pixel positioning in the upcoming SVG Text rewrite patch.
     13
     14        Add a glyphScale parameter to TextRun, that will be used to support text selection
     15        in lengthAdjust/textLength scenarios in SVG text, soon.
     16
     17        Doesn't affect any testcases so far. HTML is not affected in any way,
     18        as it only ever passes integers to these functions.
     19
     20        * platform/graphics/Font.cpp:
     21        (WebCore::Font::selectionRectForText):
     22        (WebCore::Font::offsetForPosition):
     23        * platform/graphics/Font.h:
     24        * platform/graphics/FontFastPath.cpp:
     25        (WebCore::Font::selectionRectForSimpleText):
     26        (WebCore::Font::offsetForPositionForSimpleText):
     27        * platform/graphics/TextRun.h:
     28        (WebCore::TextRun::TextRun):
     29        (WebCore::TextRun::glyphScale):
     30        (WebCore::TextRun::setGlyphScale):
     31        (WebCore::TextRun::applyGlyphScaling):
     32        * platform/graphics/WidthIterator.cpp:
     33        (WebCore::WidthIterator::advance):
     34        * platform/graphics/chromium/FontChromiumWin.cpp:
     35        (WebCore::Font::selectionRectForComplexText):
     36        (WebCore::Font::offsetForPositionForComplexText):
     37        * platform/graphics/chromium/FontLinux.cpp:
     38        (WebCore::Font::offsetForPositionForComplexText):
     39        (WebCore::Font::selectionRectForComplexText):
     40        * platform/graphics/efl/FontEfl.cpp:
     41        (WebCore::Font::offsetForPositionForComplexText):
     42        (WebCore::Font::selectionRectForComplexText):
     43        * platform/graphics/gtk/FontGtk.cpp:
     44        (WebCore::Font::offsetForPositionForComplexText):
     45        (WebCore::Font::selectionRectForComplexText):
     46        * platform/graphics/haiku/FontHaiku.cpp:
     47        (WebCore::Font::selectionRectForComplexText):
     48        (WebCore::Font::offsetForPositionForComplexText):
     49        * platform/graphics/mac/ComplexTextController.cpp:
     50        (WebCore::ComplexTextController::offsetForPosition):
     51        * platform/graphics/mac/ComplexTextController.h:
     52        * platform/graphics/mac/FontComplexTextMac.cpp:
     53        (WebCore::Font::selectionRectForComplexText):
     54        (WebCore::Font::offsetForPositionForComplexText):
     55        * platform/graphics/qt/FontQt.cpp:
     56        (WebCore::Font::offsetForPositionForSimpleText):
     57        (WebCore::Font::offsetForPositionForComplexText):
     58        (WebCore::Font::selectionRectForSimpleText):
     59        (WebCore::Font::selectionRectForComplexText):
     60        * platform/graphics/win/FontWin.cpp:
     61        (WebCore::Font::selectionRectForComplexText):
     62        (WebCore::Font::offsetForPositionForComplexText):
     63        * platform/graphics/wince/FontWince.cpp:
     64        (WebCore::Font::offsetForPositionForComplexText):
     65        (WebCore::Font::selectionRectForComplexText):
     66        * platform/graphics/wx/FontWx.cpp:
     67        (WebCore::Font::selectionRectForComplexText):
     68        (WebCore::Font::offsetForPositionForComplexText):
     69        * svg/SVGFont.cpp:
     70        (WebCore::Font::selectionRectForTextUsingSVGFont):
     71        (WebCore::Font::offsetForPositionForTextUsingSVGFont):
     72
    1732010-06-16  Anton Muhin  <antonm@chromium.org>
    274
  • trunk/WebCore/platform/graphics/Font.cpp

    r61002 r61253  
    192192}
    193193
    194 FloatRect Font::selectionRectForText(const TextRun& run, const IntPoint& point, int h, int from, int to) const
     194FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
    195195{
    196196#if ENABLE(SVG_FONTS)
     
    207207}
    208208
    209 int Font::offsetForPosition(const TextRun& run, int x, bool includePartialGlyphs) const
     209int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const
    210210{
    211211#if ENABLE(SVG_FONTS)
  • trunk/WebCore/platform/graphics/Font.h

    r61002 r61253  
    5151class GlyphPageTreeNode;
    5252class GraphicsContext;
    53 class IntPoint;
    5453class SVGFontElement;
    5554
     
    10099    float floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
    101100
    102     int offsetForPosition(const TextRun&, int position, bool includePartialGlyphs) const;
    103     FloatRect selectionRectForText(const TextRun&, const IntPoint&, int h, int from = 0, int to = -1) const;
     101    int offsetForPosition(const TextRun&, float position, bool includePartialGlyphs) const;
     102    FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const;
    104103
    105104    bool isSmallCaps() const { return m_fontDescription.smallCaps(); }
     
    159158    float floatWidthUsingSVGFont(const TextRun&) const;
    160159    float floatWidthUsingSVGFont(const TextRun&, int extraCharsAvailable, int& charsConsumed, String& glyphName) const;
    161     FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const IntPoint&, int h, int from, int to) const;
    162     int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const;
     160    FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const FloatPoint&, int h, int from, int to) const;
     161    int offsetForPositionForTextUsingSVGFont(const TextRun&, float position, bool includePartialGlyphs) const;
    163162#endif
    164163
     
    167166    void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const;
    168167    float floatWidthForSimpleText(const TextRun&, GlyphBuffer*, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
    169     int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const;
    170     FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;
     168    int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const;
     169    FloatRect selectionRectForSimpleText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
    171170
    172171    static bool canReturnFallbackFontsForComplexText();
     
    175174    void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    176175    float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
    177     int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const;
    178     FloatRect selectionRectForComplexText(const TextRun&, const IntPoint&, int h, int from, int to) const;
     176    int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
     177    FloatRect selectionRectForComplexText(const TextRun&, const FloatPoint&, int h, int from, int to) const;
    179178
    180179    friend struct WidthIterator;
  • trunk/WebCore/platform/graphics/FontFastPath.cpp

    r61001 r61253  
    3030#include "GlyphBuffer.h"
    3131#include "GlyphPageTreeNode.h"
    32 #include "IntPoint.h"
    3332#include "SimpleFontData.h"
    3433#include "WidthIterator.h"
     
    258257}
    259258
    260 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& point, int h, int from, int to) const
     259FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
    261260{
    262261    WidthIterator it(this, run);
     
    266265    float afterWidth = it.m_runWidthSoFar;
    267266
    268     // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning
     267    // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning.
    269268    if (run.rtl()) {
    270269        it.advance(run.length());
    271270        float totalWidth = it.m_runWidthSoFar;
    272271        return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
    273     } else {
    274         return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
    275     }
    276 }
    277 
    278 int Font::offsetForPositionForSimpleText(const TextRun& run, int x, bool includePartialGlyphs) const
    279 {
    280     float delta = (float)x;
     272    }
     273
     274    return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
     275}
     276
     277int Font::offsetForPositionForSimpleText(const TextRun& run, float x, bool includePartialGlyphs) const
     278{
     279    float delta = x;
    281280
    282281    WidthIterator it(this, run);
  • trunk/WebCore/platform/graphics/TextRun.h

    r58212 r61253  
    4040        , m_xpos(xpos)
    4141        , m_padding(padding)
     42        , m_glyphScale(1.0f)
    4243        , m_allowTabs(allowTabs)
    4344        , m_rtl(rtl)
     
    5960        , m_xpos(xpos)
    6061        , m_padding(padding)
     62        , m_glyphScale(1.0f)
    6163        , m_allowTabs(allowTabs)
    6264        , m_rtl(rtl)
     
    8082    void setText(const UChar* c, int len) { m_characters = c; m_len = len; }
    8183
     84    float glyphScale() const { return m_glyphScale; }
     85    void setGlyphScale(float scale) { m_glyphScale = scale; }
     86
    8287    bool allowTabs() const { return m_allowTabs; }
    8388    int xPos() const { return m_xpos; }
     
    8994    bool applyWordRounding() const { return m_applyWordRounding; }
    9095    bool spacingDisabled() const { return m_disableSpacing; }
     96    bool applyGlyphScaling() const { return m_glyphScale != 1.0f; }
    9197
    9298    void disableSpacing() { m_disableSpacing = true; }
     
    109115    int m_xpos;
    110116    int m_padding;
     117    float m_glyphScale;
    111118    bool m_allowTabs;
    112119    bool m_rtl;
  • trunk/WebCore/platform/graphics/WidthIterator.cpp

    r61128 r61253  
    135135        } else {
    136136            width = fontData->widthForGlyph(glyph);
     137
     138            // SVG uses glyphScale(), when textLength is used to stretch/squeeze text.
     139            if (m_run.applyGlyphScaling())
     140                width *= m_run.glyphScale();
     141
    137142            // We special case spaces in two ways when applying word rounding.
    138143            // First, we round spaces to an adjusted width in all fonts.
  • trunk/WebCore/platform/graphics/chromium/FontChromiumWin.cpp

    r61129 r61253  
    435435
    436436FloatRect Font::selectionRectForComplexText(const TextRun& run,
    437                                             const IntPoint& point,
     437                                            const FloatPoint& point,
    438438                                            int h,
    439439                                            int from,
     
    446446    // If the text is RTL, left will actually be after right.
    447447    if (left < right)
    448         return FloatRect(left, static_cast<float>(point.y()),
     448        return FloatRect(left, point.y(),
    449449                       right - left, static_cast<float>(h));
    450450
    451     return FloatRect(right, static_cast<float>(point.y()),
     451    return FloatRect(right, point.y(),
    452452                     left - right, static_cast<float>(h));
    453453}
     
    510510}
    511511
    512 int Font::offsetForPositionForComplexText(const TextRun& run, int x,
     512int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
    513513                                          bool includePartialGlyphs) const
    514514{
     515    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
     516    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     517    int x = static_cast<int>(xFloat);
     518
    515519    // Mac code ignores includePartialGlyphs, and they don't know what it's
    516520    // supposed to do, so we just ignore it as well.
  • trunk/WebCore/platform/graphics/chromium/FontLinux.cpp

    r58916 r61253  
    565565
    566566// Return the code point index for the given |x| offset into the text run.
    567 int Font::offsetForPositionForComplexText(const TextRun& run, int x,
     567int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
    568568                                          bool includePartialGlyphs) const
    569569{
     570    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
     571    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     572    int x = static_cast<int>(xFloat);
     573
    570574    // (Mac code ignores includePartialGlyphs, and they don't know what it's
    571575    // supposed to do, so we just ignore it as well.)
     
    642646// Return the rectangle for selecting the given range of code-points in the TextRun.
    643647FloatRect Font::selectionRectForComplexText(const TextRun& run,
    644                                             const IntPoint& point, int height,
     648                                            const FloatPoint& point, int height,
    645649                                            int from, int to) const
    646650{
  • trunk/WebCore/platform/graphics/efl/FontEfl.cpp

    r57215 r61253  
    5252}
    5353
    54 int Font::offsetForPositionForComplexText(const TextRun&, int, bool) const
     54int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const
    5555{
    5656    notImplemented();
     
    5858}
    5959
    60 FloatRect Font::selectionRectForComplexText(const TextRun&, const IntPoint&, int, int, int) const
     60FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const
    6161{
    6262    notImplemented();
  • trunk/WebCore/platform/graphics/gtk/FontGtk.cpp

    r61129 r61253  
    309309}
    310310
    311 int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const
    312 {
     311int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
     312{
     313    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
     314    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     315    int x = static_cast<int>(xFloat);
     316
    313317    PangoLayout* layout = getDefaultPangoLayout(run);
    314318    setPangoAttributes(this, run, layout);
     
    329333}
    330334
    331 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const
     335FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
    332336{
    333337    PangoLayout* layout = getDefaultPangoLayout(run);
  • trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp

    r57215 r61253  
    101101}
    102102
    103 FloatRect Font::selectionRectForComplexText(const TextRun&, const IntPoint&, int, int, int) const
     103FloatRect Font::selectionRectForComplexText(const TextRun&, const FloatPoint&, int, int, int) const
    104104{
    105105    notImplemented();
     
    107107}
    108108
    109 int Font::offsetForPositionForComplexText(const TextRun&, int, bool) const
     109int Font::offsetForPositionForComplexText(const TextRun&, float, bool) const
    110110{
    111111    notImplemented();
  • trunk/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r61128 r61253  
    9797}
    9898
    99 int ComplexTextController::offsetForPosition(int h, bool includePartialGlyphs)
     99int ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)
    100100{
    101101    if (h >= m_totalWidth)
  • trunk/WebCore/platform/graphics/mac/ComplexTextController.h

    r58707 r61253  
    5454
    5555    // Compute the character offset for a given x coordinate.
    56     int offsetForPosition(int x, bool includePartialGlyphs);
     56    int offsetForPosition(float x, bool includePartialGlyphs);
    5757
    5858    // Returns the width of everything we've consumed so far.
  • trunk/WebCore/platform/graphics/mac/FontComplexTextMac.cpp

    r57215 r61253  
    3838namespace WebCore {
    3939
    40 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h,
     40FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h,
    4141                                            int from, int to) const
    4242{
     
    9898}
    9999
    100 int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const
     100int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
    101101{
    102102    ComplexTextController controller(this, run);
  • trunk/WebCore/platform/graphics/qt/FontQt.cpp

    r61129 r61253  
    248248}
    249249
    250 int Font::offsetForPositionForSimpleText(const TextRun& run, int position, bool includePartialGlyphs) const
     250int Font::offsetForPositionForSimpleText(const TextRun& run, float position, bool includePartialGlyphs) const
    251251{
    252252#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
     
    255255
    256256    QFontMetrics fm(font());
    257     float delta = (float)position;
     257    float delta = position;
    258258    int curPos = 0;
    259259    do {
     
    276276}
    277277
    278 int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool) const
     278int Font::offsetForPositionForComplexText(const TextRun& run, float position, bool) const
    279279{
    280280    String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
     
    286286}
    287287
    288 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
     288FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
    289289{
    290290#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
     
    303303}
    304304
    305 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt, int h, int from, int to) const
     305FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
    306306{
    307307    String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
  • trunk/WebCore/platform/graphics/win/FontWin.cpp

    r57215 r61253  
    4444}
    4545
    46 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h,
     46FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h,
    4747                                            int from, int to) const
    4848{
     
    105105}
    106106
    107 int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const
     107int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
    108108{
     109    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
     110    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     111    int x = static_cast<int>(xFloat);
     112
    109113    UniscribeController controller(this, run);
    110114    return controller.offsetForPosition(x, includePartialGlyphs);
  • trunk/WebCore/platform/graphics/wince/FontWince.cpp

    r57215 r61253  
    243243}
    244244
    245 int Font::offsetForPositionForComplexText(const TextRun& run, int position, bool includePartialGlyphs) const
    246 {
     245int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
     246{
     247    // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
     248    // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
     249    int position = static_cast<int>(xFloat);
     250
    247251    TextRunComponents components;
    248252    int w = generateComponents(&components, *this, run);
     
    309313}
    310314
    311 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& pt,
     315FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt,
    312316                                     int h, int from, int to) const
    313317{
  • trunk/WebCore/platform/graphics/wx/FontWx.cpp

    r60315 r61253  
    7171}
    7272
    73 FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int from, int to) const
     73FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const
    7474{
    7575#if OS(WINDOWS) || OS(DARWIN)
     
    154154}
    155155
    156 int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool includePartialGlyphs) const
     156int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
    157157{
    158158#if OS(WINDOWS) || OS(DARWIN)
  • trunk/WebCore/svg/SVGFont.cpp

    r58212 r61253  
    572572}
    573573
    574 FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const IntPoint& point, int height, int from, int to) const
     574FloatRect Font::selectionRectForTextUsingSVGFont(const TextRun& run, const FloatPoint& point, int height, int from, int to) const
    575575{
    576576    int charsConsumed;
     
    581581}
    582582
    583 int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, int, bool) const
     583int Font::offsetForPositionForTextUsingSVGFont(const TextRun&, float, bool) const
    584584{
    585585    // TODO: Fix text selection when HTML text is drawn using a SVG Font
Note: See TracChangeset for help on using the changeset viewer.