Title: [150085] trunk/Source/WebCore
Revision
150085
Author
akl...@apple.com
Date
2013-05-14 13:22:52 -0700 (Tue, 14 May 2013)

Log Message

Assertion failure in GlyphPage::setGlyphDataForIndex: (!glyph || fontData == m_fontDataForAllGlyphs)
<http://webkit.org/b/116113>
<rdar://problem/13833790>

Reviewed by Dan Bernstein.

If we're filling a full GlyphPage with a SimpleFontData that is actually a composite font reference,
we need to make sure we have per-glyph font data pointers, since it may end up using them.

Added GlyphPage::mayUseMixedFontDataWhenFilling() which can be implemented by the platform to let
GlyphPageTreeNode know that it should allocate a full-sized GlyphPage for mixed font data pointers
in case the font is a composite font reference, or if there are CJK ideographs in the text.

This code can be made smarter, but that's outside the scope of this change.
Fixes heavy asserting on bots running unreleased software.

* platform/graphics/GlyphPage.h:
(GlyphPage):
(WebCore::GlyphPage::mayUseMixedFontDataWhenFilling):
* platform/graphics/GlyphPageTreeNode.cpp:
(WebCore::GlyphPageTreeNode::initializePage):
* platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
(WebCore::shouldUseCoreText):
(WebCore::GlyphPage::mayUseMixedFontDataWhenFilling):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150084 => 150085)


--- trunk/Source/WebCore/ChangeLog	2013-05-14 20:09:17 UTC (rev 150084)
+++ trunk/Source/WebCore/ChangeLog	2013-05-14 20:22:52 UTC (rev 150085)
@@ -1,3 +1,30 @@
+2013-05-14  Andreas Kling  <akl...@apple.com>
+
+        Assertion failure in GlyphPage::setGlyphDataForIndex: (!glyph || fontData == m_fontDataForAllGlyphs)
+        <http://webkit.org/b/116113>
+        <rdar://problem/13833790>
+
+        Reviewed by Dan Bernstein.
+
+        If we're filling a full GlyphPage with a SimpleFontData that is actually a composite font reference,
+        we need to make sure we have per-glyph font data pointers, since it may end up using them.
+
+        Added GlyphPage::mayUseMixedFontDataWhenFilling() which can be implemented by the platform to let
+        GlyphPageTreeNode know that it should allocate a full-sized GlyphPage for mixed font data pointers
+        in case the font is a composite font reference, or if there are CJK ideographs in the text.
+
+        This code can be made smarter, but that's outside the scope of this change.
+        Fixes heavy asserting on bots running unreleased software.
+
+        * platform/graphics/GlyphPage.h:
+        (GlyphPage):
+        (WebCore::GlyphPage::mayUseMixedFontDataWhenFilling):
+        * platform/graphics/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::initializePage):
+        * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
+        (WebCore::shouldUseCoreText):
+        (WebCore::GlyphPage::mayUseMixedFontDataWhenFilling):
+
 2013-05-14  Bem Jones-Bey  <bjone...@adobe.com>
 
         Heap-use-after-free in WebCore::RenderBox::exclusionShapeOutsideInfo

Modified: trunk/Source/WebCore/platform/graphics/GlyphPage.h (150084 => 150085)


--- trunk/Source/WebCore/platform/graphics/GlyphPage.h	2013-05-14 20:09:17 UTC (rev 150084)
+++ trunk/Source/WebCore/platform/graphics/GlyphPage.h	2013-05-14 20:22:52 UTC (rev 150085)
@@ -168,6 +168,11 @@
 
     // Implemented by the platform.
     bool fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
+#if PLATFORM(MAC)
+    static bool mayUseMixedFontDataWhenFilling(const UChar* characterBuffer, unsigned bufferLength, const SimpleFontData*);
+#else
+    static bool mayUseMixedFontDataWhenFilling(const UChar*, unsigned, const SimpleFontData*) { return false; }
+#endif
 
 private:
     explicit GlyphPage(GlyphPageTreeNode* owner, const SimpleFontData* fontDataForAllGlyphs = 0)

Modified: trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp (150084 => 150085)


--- trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp	2013-05-14 20:09:17 UTC (rev 150084)
+++ trunk/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp	2013-05-14 20:22:52 UTC (rev 150085)
@@ -211,7 +211,10 @@
             // for only 128 out of 256 characters.
             bool haveGlyphs;
             if (!fontData->isSegmented()) {
-                m_page = GlyphPage::createForSingleFontData(this, static_cast<const SimpleFontData*>(fontData));
+                if (GlyphPage::mayUseMixedFontDataWhenFilling(buffer, bufferLength, static_cast<const SimpleFontData*>(fontData)))
+                    m_page = GlyphPage::createForMixedFontData(this);
+                else
+                    m_page = GlyphPage::createForSingleFontData(this, static_cast<const SimpleFontData*>(fontData));
                 haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, bufferLength, static_cast<const SimpleFontData*>(fontData));
             } else {
                 m_page = GlyphPage::createForMixedFontData(this);

Modified: trunk/Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp (150084 => 150085)


--- trunk/Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp	2013-05-14 20:09:17 UTC (rev 150084)
+++ trunk/Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp	2013-05-14 20:22:52 UTC (rev 150085)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+static bool shouldUseCoreText(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     if (fontData->platformData().isCompositeFontReference())
         return true;
@@ -51,6 +51,12 @@
     return false;
 }
 
+bool GlyphPage::mayUseMixedFontDataWhenFilling(const UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
+{
+    // FIXME: This could be smarter if the logic currently in GlyphPage::fill() got to make the decision about what kind of GlyphPage to construct.
+    return shouldUseCoreText(buffer, bufferLength, fontData);
+}
+
 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
 {
     bool haveGlyphs = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to