[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

mitz at apple.com mitz at apple.com
Fri Jan 21 14:46:25 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit f8888e785f11a0747d86687c7239ad3b00437a00
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 29 22:18:42 2010 +0000

    A more robust fix for https://bugs.webkit.org/show_bug.cgi?id=51681
    
    Reviewed by Kenneth Russel.
    
    * html/HTMLCanvasElement.cpp:
    (WebCore::HTMLCanvasElement::attach): Added. Like recalcStyle(), calls
    CanvasRenderingContext2D::updateFont() if necessary. This covers the case of a detach/
    attach-type style recalc.
    * html/HTMLCanvasElement.h:
    * html/canvas/CanvasRenderingContext2D.cpp:
    (WebCore::CanvasRenderingContext2D::drawTextInternal): Removed the early return added in
    r74716. A font that is loading custom fonts is okay to use, as long as it is valid.
    (WebCore::CanvasRenderingContext2D::accessFont): Added a call to
    Document::updateStyleIfNeeded(). This ensures that any pending style recalc will take place
    and update the font if it is invalid.
    * platform/graphics/Font.h:
    (WebCore::Font::loadingCustomFonts): Made this private.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74759 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cdb5505..cbd489a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-12-29  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Kenneth Russel.
+
+        A more robust fix for https://bugs.webkit.org/show_bug.cgi?id=51681
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::attach): Added. Like recalcStyle(), calls
+        CanvasRenderingContext2D::updateFont() if necessary. This covers the case of a detach/
+        attach-type style recalc.
+        * html/HTMLCanvasElement.h:
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::drawTextInternal): Removed the early return added in
+        r74716. A font that is loading custom fonts is okay to use, as long as it is valid.
+        (WebCore::CanvasRenderingContext2D::accessFont): Added a call to
+        Document::updateStyleIfNeeded(). This ensures that any pending style recalc will take place
+        and update the font if it is invalid.
+        * platform/graphics/Font.h:
+        (WebCore::Font::loadingCustomFonts): Made this private.
+
 2010-12-29  Pavel Feldman  <pfeldman at chromium.org>
 
         Not reviewed: Qt build fix.
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index 2b66b0c..f286749 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -292,6 +292,16 @@ void HTMLCanvasElement::makeRenderingResultsAvailable()
         m_context->paintRenderingResultsToCanvas();
 }
 
+void HTMLCanvasElement::attach()
+{
+    HTMLElement::attach();
+
+    if (m_context && m_context->is2d()) {
+        CanvasRenderingContext2D* ctx = static_cast<CanvasRenderingContext2D*>(m_context.get());
+        ctx->updateFont();
+    }
+}
+
 void HTMLCanvasElement::recalcStyle(StyleChange change)
 {
     HTMLElement::recalcStyle(change);
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index 97897c0..8921656 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -130,6 +130,8 @@ private:
     virtual void parseMappedAttribute(Attribute*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 
+    virtual void attach();
+
     virtual void recalcStyle(StyleChange);
 
     void reset();
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index f2b6147..bd90697 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -1761,10 +1761,6 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
 
     const Font& font = accessFont();
     
-    // Don't draw anything while we are using custom fonts that are in the process of loading.
-    if (font.loadingCustomFonts())
-        return;
-
     // FIXME: Handle maxWidth.
     // FIXME: Need to turn off font smoothing.
 
@@ -1882,6 +1878,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
 
 const Font& CanvasRenderingContext2D::accessFont()
 {
+    canvas()->document()->updateStyleIfNeeded();
+
     if (!state().m_realizedFont)
         setFont(state().m_unparsedFont);
     return state().m_font;
diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h
index ec3d220..225bb32 100644
--- a/WebCore/platform/graphics/Font.h
+++ b/WebCore/platform/graphics/Font.h
@@ -210,11 +210,6 @@ public:
     }
 
     FontSelector* fontSelector() const;
-    bool loadingCustomFonts() const
-    {
-        return m_fontList && m_fontList->loadingCustomFonts();
-    }
-
     static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
     static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || (c >= 0x200c && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == objectReplacementCharacter; }
     static bool canReceiveTextEmphasis(UChar32 c);
@@ -240,6 +235,11 @@ public:
     bool needsTranscoding() const { return m_needsTranscoding; }
 
 private:
+    bool loadingCustomFonts() const
+    {
+        return m_fontList && m_fontList->loadingCustomFonts();
+    }
+
     FontDescription m_fontDescription;
     mutable RefPtr<FontFallbackList> m_fontList;
     short m_letterSpacing;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list