From 893f77dade81f99d230c0773a8390f4abdfd0654 Mon Sep 17 00:00:00 2001 From: "dglazkov@chromium.org" Date: Thu, 15 Jan 2009 21:30:17 +0000 Subject: [PATCH] 2009-01-15 Dimitri Glazkov Reviewed by Darin Adler. https://bugs.webkit.org/show_bug.cgi?id=23354 Fix up graphics/chromium files to account for Uniscribe style scrubbing. * platform/graphics/chromium/FontChromiumWin.cpp: (WebCore::windowsCanHandleTextDrawing): (WebCore::Font::selectionRectForComplexText): (WebCore::Font::drawComplexText): (WebCore::Font::floatWidthForComplexText): (WebCore::Font::offsetForPositionForComplexText): * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp: (WebCore::fillNonBMPGlyphs): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39944 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 16 ++++++++++++++ .../graphics/chromium/FontChromiumWin.cpp | 21 +++++++++---------- .../chromium/GlyphPageTreeNodeChromiumWin.cpp | 4 ++-- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 4c4a2ae352aa..7e0fe6d5b7e2 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2009-01-15 Dimitri Glazkov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=23354 + Fix up graphics/chromium files to account for Uniscribe style scrubbing. + + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::windowsCanHandleTextDrawing): + (WebCore::Font::selectionRectForComplexText): + (WebCore::Font::drawComplexText): + (WebCore::Font::floatWidthForComplexText): + (WebCore::Font::offsetForPositionForComplexText): + * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp: + (WebCore::fillNonBMPGlyphs): + 2009-01-15 David Levin Reviewed by Darin Adler. diff --git a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index 1cbe6554961d..3cf18a6e10d1 100644 --- a/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -57,8 +57,7 @@ static bool windowsCanHandleTextDrawing(GraphicsContext* context) // which look weird. All else being equal, it's better to use Windows' text // drawing, so we don't check for zooms. const TransformationMatrix& matrix = context->getCTM(); - if (matrix.b() != 0 || // Y skew - matrix.c() != 0) // X skew + if (matrix.b() != 0 || matrix.c() != 0) // Check for skew. return false; // Check for stroke effects. @@ -263,12 +262,12 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, int to) const { UniscribeHelperTextRun state(run, *this); - float left = static_cast(point.x() + state.CharacterToX(from)); - float right = static_cast(point.x() + state.CharacterToX(to)); + float left = static_cast(point.x() + state.characterToX(from)); + float right = static_cast(point.x() + state.characterToX(to)); // If the text is RTL, left will actually be after right. if (left < right) - return FloatRect(left, static_cast(point.y()), + return FloatRect(left, static_cast(point.y()), right - left, static_cast(h)); return FloatRect(right, static_cast(point.y()), @@ -300,14 +299,14 @@ void Font::drawComplexText(GraphicsContext* graphicsContext, // Uniscribe counts the coordinates from the upper left, while WebKit uses // the baseline, so we have to subtract off the ascent. - state.Draw(hdc, static_cast(point.x()), static_cast(point.y() - ascent()), from, to); + state.draw(hdc, static_cast(point.x()), static_cast(point.y() - ascent()), from, to); context->canvas()->endPlatformPaint(); } float Font::floatWidthForComplexText(const TextRun& run) const { UniscribeHelperTextRun state(run, *this); - return static_cast(state.Width()); + return static_cast(state.width()); } int Font::offsetForPositionForComplexText(const TextRun& run, int x, @@ -316,13 +315,13 @@ int Font::offsetForPositionForComplexText(const TextRun& run, int x, // Mac code ignores includePartialGlyphs, and they don't know what it's // supposed to do, so we just ignore it as well. UniscribeHelperTextRun state(run, *this); - int char_index = state.XToCharacter(x); + int charIndex = state.xToCharacter(x); // XToCharacter will return -1 if the position is before the first // character (we get called like this sometimes). - if (char_index < 0) - char_index = 0; - return char_index; + if (charIndex < 0) + charIndex = 0; + return charIndex; } } // namespace WebCore diff --git a/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp b/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp index 123b1c54d81a..4c5cf7b7f270 100644 --- a/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp +++ b/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp @@ -205,13 +205,13 @@ static bool fillNonBMPGlyphs(unsigned offset, fontData->m_font.scriptCache(), fontData->m_font.scriptFontProperties()); state.setInhibitLigate(true); - state.Init(); + state.init(); for (unsigned i = 0; i < length; i++) { // Each character in this input buffer is a surrogate pair, which // consists of two UChars. So, the offset for its i-th character is // (i * 2). - WORD glyph = state.FirstGlyphForCharacter(i * 2); + WORD glyph = state.firstGlyphForCharacter(i * 2); if (glyph) { haveGlyphs = true; page->setGlyphDataForIndex(offset + i, glyph, fontData); -- 2.36.0