Title: [148956] trunk
Revision
148956
Author
grao...@apple.com
Date
2013-04-23 02:50:15 -0700 (Tue, 23 Apr 2013)

Log Message

Initial advance of text runs should be taken into account
https://bugs.webkit.org/show_bug.cgi?id=114949

Reviewed by Darin Adler.

Source/WebCore:

Keep track of complex text runs' initial advance by adding a new
member to GlyphBuffer and adding the initial advance of any non-first
text run to the advance of the last glyph added for the previous text run.
Additionally, we now correctly handle advance values in the y-axis.

Test: fast/text/complex-initial-advance.html

* WebCore.exp.in:
Add support for new WebKitSystemInterface API.
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::drawGlyphBuffer):
Take into account the buffer's initial advance in the y-axis to adjust
the point at which to draw the buffers. Additionally, keep track of advances
on the y-axis as well as the x-axis (which we already were doing) as we iterate
through glyphs and adjust the start point.
(WebCore::Font::drawEmphasisMarks):
Adopt change of GlyphBuffer::advanceAt() return type.
* platform/graphics/GlyphBuffer.h:
Removing the WINCE-specific GlyphBufferAdvance struct since heights are now necessary.
(WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
New default constructor for GlyphBufferAdvance to support the m_initialAdvance member.
(WebCore::GlyphBuffer::setInitialAdvance):
(WebCore::GlyphBuffer::initialAdvance):
New APIs to get and set the initial advance for a glyph buffer.
(WebCore::GlyphBuffer::advanceAt):
Return a GlyphBufferAdvance rather than a float which used to be only
the glyph buffer's x-axis advance. This is necessary to handle deltas
on the y-axis as well (see WebCore::Font::drawGlyphBuffer).
* platform/graphics/GlyphBuffer.h:
(GlyphBuffer):
(WebCore::GlyphBuffer::setInitialAdvance):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
(WebCore::WidthIterator::advanceOneCharacter):
Adopt change of GlyphBuffer::advanceAt() return type.
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::Font::drawGlyphs):
Adopt change of GlyphBuffer::advanceAt() return type.
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::advance):
When processing the first text run, set that run's initial advance as
the glyph buffer's initial advance.
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
Represent the initial advance for a text run by adjusting the advance
of the last glyph of the previous text run in the glyph buffer.
* platform/graphics/mac/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
(ComplexTextRun):
New API to read the inital advance of a complex text run.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
Obtain the text run's initial advance via the new wkCTRunGetInitialAdvance
WebKitSystemInterface API.
* platform/graphics/qt/FontQt.cpp:
(WebCore::Font::drawGlyphs):
Adopt change of GlyphBuffer::advanceAt() return type.
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:
Add support for the new wkCTRunGetInitialAdvance WebKitSystemInterface API.
* platform/wx/wxcode/cairo/non-kerned-drawing.cpp:
(WebCore::drawTextWithSpacing):
Adopt change of GlyphBuffer::advanceAt() return type.
* rendering/svg/SVGTextRunRenderingContext.cpp:
(WebCore::SVGTextRunRenderingContext::drawSVGGlyphs):
Adopt change of GlyphBuffer::advanceAt() return type.

Source/WebKit/mac:

Adding support for new method CTRunGetInitialAdvance in WebKitSystemInterface.

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Source/WebKit2:

Adding support for new method CTRunGetInitialAdvance in WebKitSystemInterface.

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

WebKitLibraries:

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLion.a:
* libWebKitSystemInterfaceMountainLion.a:

LayoutTests:

* fast/text/complex-initial-advance-expected.html: Added.
* fast/text/complex-initial-advance.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148955 => 148956)


--- trunk/LayoutTests/ChangeLog	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/LayoutTests/ChangeLog	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1,3 +1,13 @@
+2013-04-23  Antoine Quint  <grao...@apple.com>
+
+        Initial advance of text runs should be taken into account
+        https://bugs.webkit.org/show_bug.cgi?id=114949
+
+        Reviewed by Darin Adler.
+
+        * fast/text/complex-initial-advance-expected.html: Added.
+        * fast/text/complex-initial-advance.html: Added.
+
 2013-04-23  Zan Dobersek  <zdober...@igalia.com>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/fast/text/complex-initial-advance-expected.html (0 => 148956)


--- trunk/LayoutTests/fast/text/complex-initial-advance-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/complex-initial-advance-expected.html	2013-04-23 09:50:15 UTC (rev 148956)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body style="font-family: Geeza Pro">
+<span>مليئ حياةٍ مليئ</span>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/text/complex-initial-advance.html (0 => 148956)


--- trunk/LayoutTests/fast/text/complex-initial-advance.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/complex-initial-advance.html	2013-04-23 09:50:15 UTC (rev 148956)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body style="font-family: Geeza Pro">
+<span>مليئ</span><span> </span><span>حياةٍ</span><span> </span><span>مليئ</span>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (148955 => 148956)


--- trunk/Source/WebCore/ChangeLog	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/ChangeLog	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1,3 +1,76 @@
+2013-04-23  Antoine Quint  <grao...@apple.com>
+
+        Initial advance of text runs should be taken into account
+        https://bugs.webkit.org/show_bug.cgi?id=114949
+
+        Reviewed by Darin Adler.
+
+        Keep track of complex text runs' initial advance by adding a new
+        member to GlyphBuffer and adding the initial advance of any non-first
+        text run to the advance of the last glyph added for the previous text run.
+        Additionally, we now correctly handle advance values in the y-axis.
+
+        Test: fast/text/complex-initial-advance.html
+
+        * WebCore.exp.in:
+        Add support for new WebKitSystemInterface API.
+        * platform/graphics/FontFastPath.cpp:
+        (WebCore::Font::drawGlyphBuffer):
+        Take into account the buffer's initial advance in the y-axis to adjust
+        the point at which to draw the buffers. Additionally, keep track of advances
+        on the y-axis as well as the x-axis (which we already were doing) as we iterate
+        through glyphs and adjust the start point.
+        (WebCore::Font::drawEmphasisMarks):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+        * platform/graphics/GlyphBuffer.h:
+        Removing the WINCE-specific GlyphBufferAdvance struct since heights are now necessary.
+        (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
+        New default constructor for GlyphBufferAdvance to support the m_initialAdvance member.
+        (WebCore::GlyphBuffer::setInitialAdvance):
+        (WebCore::GlyphBuffer::initialAdvance):
+        New APIs to get and set the initial advance for a glyph buffer.
+        (WebCore::GlyphBuffer::advanceAt):
+        Return a GlyphBufferAdvance rather than a float which used to be only
+        the glyph buffer's x-axis advance. This is necessary to handle deltas
+        on the y-axis as well (see WebCore::Font::drawGlyphBuffer).
+        * platform/graphics/GlyphBuffer.h:
+        (GlyphBuffer):
+        (WebCore::GlyphBuffer::setInitialAdvance):
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::advanceInternal):
+        (WebCore::WidthIterator::advanceOneCharacter):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::Font::drawGlyphs):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::advance):
+        When processing the first text run, set that run's initial advance as
+        the glyph buffer's initial advance.
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+        Represent the initial advance for a text run by adjusting the advance
+        of the last glyph of the previous text run in the glyph buffer.
+        * platform/graphics/mac/ComplexTextController.h:
+        (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
+        (ComplexTextRun):
+        New API to read the inital advance of a complex text run.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+        Obtain the text run's initial advance via the new wkCTRunGetInitialAdvance
+        WebKitSystemInterface API.
+        * platform/graphics/qt/FontQt.cpp:
+        (WebCore::Font::drawGlyphs):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        Add support for the new wkCTRunGetInitialAdvance WebKitSystemInterface API.
+        * platform/wx/wxcode/cairo/non-kerned-drawing.cpp:
+        (WebCore::drawTextWithSpacing):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+        * rendering/svg/SVGTextRunRenderingContext.cpp:
+        (WebCore::SVGTextRunRenderingContext::drawSVGGlyphs):
+        Adopt change of GlyphBuffer::advanceAt() return type.
+
 2013-04-23  Noam Rosenthal  <n...@webkit.org>
 
         [Texmap] Don't paint to an intermediate surface when the result is going to be clipped out completely.

Modified: trunk/Source/WebCore/WebCore.exp.in (148955 => 148956)


--- trunk/Source/WebCore/WebCore.exp.in	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1650,6 +1650,7 @@
 _wkCreateCTLineWithUniCharProvider
 _wkCreateCustomCFReadStream
 _wkCreatePrivateStorageSession
+_wkCTRunGetInitialAdvance
 _wkDeleteAllHTTPCookies
 _wkDeleteHTTPCookie
 _wkGetCFURLResponseHTTPResponse

Modified: trunk/Source/WebCore/platform/graphics/FontFastPath.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/FontFastPath.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/FontFastPath.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -477,8 +477,9 @@
     // Draw each contiguous run of glyphs that use the same font data.
     const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
     FloatSize offset = glyphBuffer.offsetAt(0);
-    FloatPoint startPoint(point);
-    float nextX = startPoint.x() + glyphBuffer.advanceAt(0);
+    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
+    float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
+    float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
     int lastFrom = 0;
     int nextGlyph = 1;
 #if ENABLE(SVG_FONTS)
@@ -500,8 +501,10 @@
             fontData = nextFontData;
             offset = nextOffset;
             startPoint.setX(nextX);
+            startPoint.setY(nextY);
         }
-        nextX += glyphBuffer.advanceAt(nextGlyph);
+        nextX += glyphBuffer.advanceAt(nextGlyph).width();
+        nextY += glyphBuffer.advanceAt(nextGlyph).height();
         nextGlyph++;
     }
 
@@ -550,7 +553,7 @@
     GlyphBuffer markBuffer;
     for (int i = 0; i + 1 < glyphBuffer.size(); ++i) {
         float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1);
-        float advance = glyphBuffer.advanceAt(i) - middleOfLastGlyph + middleOfNextGlyph;
+        float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph;
         markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
         middleOfLastGlyph = middleOfNextGlyph;
     }

Modified: trunk/Source/WebCore/platform/graphics/GlyphBuffer.h (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/GlyphBuffer.h	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/GlyphBuffer.h	2013-04-23 09:50:15 UTC (rev 148956)
@@ -67,6 +67,7 @@
 #if USE(CG) || (OS(DARWIN) && PLATFORM(WX))
 struct GlyphBufferAdvance : CGSize {
 public:
+    GlyphBufferAdvance() : CGSize(CGSizeZero) { }
     GlyphBufferAdvance(CGSize size) : CGSize(size)
     {
     }
@@ -75,25 +76,10 @@
     CGFloat width() const { return this->CGSize::width; }
     CGFloat height() const { return this->CGSize::height; }
 };
-#elif OS(WINCE)
-// There is no cross-platform code that uses the height of GlyphBufferAdvance,
-// so we can save memory space on embedded devices by storing only the width
-struct GlyphBufferAdvance {
-public:
-    GlyphBufferAdvance(float width)
-        : advance(width)
-    {
-    }
-
-    void setWidth(float width) { advance = width; }
-    float width() const { return advance; }
-
-private:
-    float advance;
-};
 #elif PLATFORM(QT)
 struct GlyphBufferAdvance : public QPointF {
 public:
+    GlyphBufferAdvance() : QPointF() { }
     GlyphBufferAdvance(const QPointF& advance)
         : QPointF(advance)
     {
@@ -128,6 +114,9 @@
     const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
 
     const SimpleFontData* fontDataAt(int index) const { return m_fontData[index]; }
+
+    void setInitialAdvance(GlyphBufferAdvance initialAdvance) { m_initialAdvance = initialAdvance; }
+    const GlyphBufferAdvance& initialAdvance() const { return m_initialAdvance; }
     
     Glyph glyphAt(int index) const
     {
@@ -138,9 +127,9 @@
 #endif
     }
 
-    float advanceAt(int index) const
+    GlyphBufferAdvance advanceAt(int index) const
     {
-        return m_advances[index].width();
+        return m_advances[index];
     }
 
     FloatSize offsetAt(int index) const
@@ -168,8 +157,6 @@
 #if USE(CG) || (OS(DARWIN) && PLATFORM(WX))
         CGSize advance = { width, 0 };
         m_advances.append(advance);
-#elif OS(WINCE)
-        m_advances.append(width);
 #elif PLATFORM(QT)
         m_advances.append(QPointF(width, 0));
 #else
@@ -240,6 +227,7 @@
     Vector<const SimpleFontData*, 2048> m_fontData;
     Vector<GlyphBufferGlyph, 2048> m_glyphs;
     Vector<GlyphBufferAdvance, 2048> m_advances;
+    GlyphBufferAdvance m_initialAdvance;
 #if PLATFORM(WIN)
     Vector<FloatSize, 2048> m_offsets;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -254,7 +254,7 @@
 
         if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character))
             charactersTreatedAsSpace.append(make_pair(glyphBuffer->size(),
-                OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1) : 0, width)));
+                OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1).width() : 0, width)));
 
         if (m_accountForGlyphBounds) {
             bounds = fontData->boundsForGlyph(glyph);
@@ -343,7 +343,7 @@
     advance(m_currentCharacter + 1, &glyphBuffer);
     float w = 0;
     for (int i = oldSize; i < glyphBuffer.size(); ++i)
-        w += glyphBuffer.advanceAt(i);
+        w += glyphBuffer.advanceAt(i).width();
     width = w;
     return glyphBuffer.size() > oldSize;
 }

Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -105,7 +105,7 @@
     for (int i = 0; i < numGlyphs; i++) {
         glyphs[i].x = offset;
         glyphs[i].y = point.y();
-        offset += glyphBuffer.advanceAt(from + i);
+        offset += glyphBuffer.advanceAt(from + i).width();
     }
 
     PlatformContextCairo* platformContext = context->platformContext();

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -500,6 +500,9 @@
         if (fallbackFonts && complexTextRun.fontData() != m_font.primaryFont())
             fallbackFonts->add(complexTextRun.fontData());
 
+        if (glyphBuffer && glyphBuffer->isEmpty())
+            glyphBuffer->setInitialAdvance(complexTextRun.initialAdvance());
+
         while (m_glyphInCurrentRun < glyphCount) {
             unsigned glyphStartOffset = complexTextRun.indexAt(g);
             unsigned glyphEndOffset;
@@ -565,6 +568,15 @@
         unsigned glyphCount = complexTextRun.glyphCount();
         const SimpleFontData* fontData = complexTextRun.fontData();
 
+        // Represent the initial advance for a text run by adjusting the advance
+        // of the last glyph of the previous text run in the glyph buffer.
+        if (r && m_adjustedAdvances.size()) {
+            CGSize previousAdvance = m_adjustedAdvances.last();
+            previousAdvance.width += complexTextRun.initialAdvance().width;
+            previousAdvance.height -= complexTextRun.initialAdvance().height;
+            m_adjustedAdvances[m_adjustedAdvances.size() - 1] = previousAdvance;
+        }
+
         if (!complexTextRun.isLTR())
             m_isLTROnly = false;
 

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h	2013-04-23 09:50:15 UTC (rev 148956)
@@ -94,6 +94,7 @@
         CFIndex indexEnd() const { return m_indexEnd; }
         CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
         const CGGlyph* glyphs() const { return m_glyphs; }
+        CGSize initialAdvance() const { return m_initialAdvance; }
         const CGSize* advances() const { return m_advances; }
         bool isLTR() const { return m_isLTR; }
         bool isMonotonic() const { return m_isMonotonic; }
@@ -115,6 +116,7 @@
         Vector<CFIndex, 64> m_glyphEndOffsets;
         Vector<CGGlyph, 64> m_glyphsVector;
         const CGGlyph* m_glyphs;
+        CGSize m_initialAdvance;
         Vector<CGSize, 64> m_advancesVector;
         const CGSize* m_advances;
         bool m_isLTR;

Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm	2013-04-23 09:50:15 UTC (rev 148956)
@@ -94,6 +94,7 @@
     , m_stringLength(stringLength)
     , m_indexBegin(runRange.location)
     , m_indexEnd(runRange.location + runRange.length)
+    , m_initialAdvance(wkCTRunGetInitialAdvance(ctRun))    
     , m_isLTR(!(CTRunGetStatus(ctRun) & kCTRunStatusRightToLeft))
     , m_isMonotonic(true)
 {
@@ -129,6 +130,7 @@
     , m_stringLength(stringLength)
     , m_indexBegin(0)
     , m_indexEnd(stringLength)
+    , m_initialAdvance(CGSizeZero)
     , m_isLTR(ltr)
     , m_isMonotonic(true)
 {

Modified: trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -296,7 +296,7 @@
 
     for (int i = 0; i < numGlyphs; ++i) {
         Glyph glyph = glyphBuffer.glyphAt(from + i);
-        float advance = glyphBuffer.advanceAt(from + i);
+        float advance = glyphBuffer.advanceAt(from + i).width();
         if (!glyph)
             continue;
         glyphIndexes.append(glyph);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (148955 => 148956)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2013-04-23 09:50:15 UTC (rev 148956)
@@ -50,6 +50,7 @@
 typedef const struct _CFURLRequest *CFURLRequestRef;
 typedef const struct __CTFont * CTFontRef;
 typedef const struct __CTLine * CTLineRef;
+typedef const struct __CTRun * CTRunRef;
 typedef const struct __CTTypesetter * CTTypesetterRef;
 typedef const struct __AXUIElement *AXUIElementRef;
 typedef struct _NSRange NSRange;
@@ -253,6 +254,8 @@
 
 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
 
+extern CGSize (*wkCTRunGetInitialAdvance)(CTRunRef);
+
 #if PLATFORM(MAC) && USE(CA)
 extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace);
 extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (148955 => 148956)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2013-04-23 09:50:15 UTC (rev 148956)
@@ -143,6 +143,8 @@
 bool (*wkCTFontTransformGlyphs)(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, wkCTFontTransformOptions options);
 #endif
 
+CGSize (*wkCTRunGetInitialAdvance)(CTRunRef);
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
 

Modified: trunk/Source/WebCore/platform/wx/wxcode/cairo/non-kerned-drawing.cpp (148955 => 148956)


--- trunk/Source/WebCore/platform/wx/wxcode/cairo/non-kerned-drawing.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/platform/wx/wxcode/cairo/non-kerned-drawing.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -228,7 +228,7 @@
 #endif
         glyphs[i].x = offset;
         glyphs[i].y = point.y();
-        offset += glyphBuffer.advanceAt(from + i);
+        offset += glyphBuffer.advanceAt(from + i).width();
     }
 
     cairo_set_source_rgba(cr, color.Red()/255.0, color.Green()/255.0, color.Blue()/255.0, color.Alpha()/255.0);
@@ -252,7 +252,7 @@
     wxString text = wxEmptyString;
     for (unsigned i = 0; i < numGlyphs; i++) {
         text = text.Append((wxChar)glyphs[i]);
-        offset += glyphBuffer.advanceAt(from + i);
+        offset += glyphBuffer.advanceAt(from + i).width();
     }
     
     // the y point is actually the bottom point of the text, turn it into the top

Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (148955 => 148956)


--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-04-23 09:50:15 UTC (rev 148956)
@@ -126,7 +126,7 @@
         if (!glyph)
             continue;
 
-        float advance = glyphBuffer.advanceAt(from + i);
+        float advance = glyphBuffer.advanceAt(from + i).width();
         SVGGlyph svgGlyph = fontElement->svgGlyphForGlyph(glyph);
         ASSERT(!svgGlyph.isPartOfLigature);
         ASSERT(svgGlyph.tableEntry == glyph);

Modified: trunk/Source/WebKit/mac/ChangeLog (148955 => 148956)


--- trunk/Source/WebKit/mac/ChangeLog	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1,3 +1,15 @@
+2013-04-23  Antoine Quint  <grao...@apple.com>
+
+        Initial advance of text runs should be taken into account
+        https://bugs.webkit.org/show_bug.cgi?id=114949
+
+        Reviewed by Darin Adler.
+
+        Adding support for new method CTRunGetInitialAdvance in WebKitSystemInterface.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2013-04-22  Benjamin Poulain  <benja...@webkit.org>
 
         Remove the memory instrumentation code

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (148955 => 148956)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2013-04-23 09:50:15 UTC (rev 148956)
@@ -137,6 +137,7 @@
     INIT(IOSurfaceContextCreate);
     INIT(IOSurfaceContextCreateImage);
     INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+    INIT(CTRunGetInitialAdvance);
     INIT(RecommendedScrollerStyle);
     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
     INIT(SetCrashReportApplicationSpecificInformation);

Modified: trunk/Source/WebKit2/ChangeLog (148955 => 148956)


--- trunk/Source/WebKit2/ChangeLog	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1,3 +1,15 @@
+2013-04-23  Antoine Quint  <grao...@apple.com>
+
+        Initial advance of text runs should be taken into account
+        https://bugs.webkit.org/show_bug.cgi?id=114949
+
+        Reviewed by Darin Adler.
+
+        Adding support for new method CTRunGetInitialAdvance in WebKitSystemInterface.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface):
+
 2013-04-23  Noam Rosenthal  <n...@webkit.org>
 
         [Coordinated Graphics] Remove the lockAnimations code path

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (148955 => 148956)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2013-04-23 09:50:15 UTC (rev 148956)
@@ -125,6 +125,7 @@
         INIT(IOSurfaceContextCreate);
         INIT(IOSurfaceContextCreateImage);
         INIT(CreateCTTypesetterWithUniCharProviderAndOptions);
+        INIT(CTRunGetInitialAdvance);
         INIT(RecommendedScrollerStyle);
         INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
         INIT(CopyDefaultSearchProviderDisplayName);

Modified: trunk/WebKitLibraries/ChangeLog (148955 => 148956)


--- trunk/WebKitLibraries/ChangeLog	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/WebKitLibraries/ChangeLog	2013-04-23 09:50:15 UTC (rev 148956)
@@ -1,3 +1,14 @@
+2013-04-23  Antoine Quint  <grao...@apple.com>
+
+        Initial advance of text runs should be taken into account
+        https://bugs.webkit.org/show_bug.cgi?id=114949
+
+        Reviewed by Darin Adler.
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLion.a:
+        * libWebKitSystemInterfaceMountainLion.a:
+
 2013-04-12  Jeffrey Pfau  <jp...@apple.com>
 
         Query directly for cache partition names

Modified: trunk/WebKitLibraries/WebKitSystemInterface.h (148955 => 148956)


--- trunk/WebKitLibraries/WebKitSystemInterface.h	2013-04-23 09:42:15 UTC (rev 148955)
+++ trunk/WebKitLibraries/WebKitSystemInterface.h	2013-04-23 09:50:15 UTC (rev 148956)
@@ -163,6 +163,8 @@
 
 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
 
+CGSize WKCTRunGetInitialAdvance(CTRunRef);
+
 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
 

Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceLion.a


(Binary files differ)

Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a


(Binary files differ)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to