<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[28867] trunk/WebCore</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/28867">28867</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2007-12-19 11:24:10 -0800 (Wed, 19 Dec 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for GDI text on Windows.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorecssCSSStyleSelectorcpp">trunk/WebCore/css/CSSStyleSelector.cpp</a></li>
<li><a href="#trunkWebCoredomDocumentcpp">trunk/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkWebCorepageSettingscpp">trunk/WebCore/page/Settings.cpp</a></li>
<li><a href="#trunkWebCorepageSettingsh">trunk/WebCore/page/Settings.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicsFonth">trunk/WebCore/platform/graphics/Font.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicsFontCachecpp">trunk/WebCore/platform/graphics/FontCache.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicsFontDescriptionh">trunk/WebCore/platform/graphics/FontDescription.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicsGraphicsContexth">trunk/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinFontCacheWincpp">trunk/WebCore/platform/graphics/win/FontCacheWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinFontDataWincpp">trunk/WebCore/platform/graphics/win/FontDataWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinFontPlatformDatah">trunk/WebCore/platform/graphics/win/FontPlatformData.h</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinFontPlatformDataWincpp">trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinFontWincpp">trunk/WebCore/platform/graphics/win/FontWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicswinIconWincpp">trunk/WebCore/platform/graphics/win/IconWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformwinGraphicsContextWincpp">trunk/WebCore/platform/win/GraphicsContextWin.cpp</a></li>
<li><a href="#trunkWebCoreplatformwinUniscribeControllercpp">trunk/WebCore/platform/win/UniscribeController.cpp</a></li>
<li><a href="#trunkWebCoreplatformwinUniscribeControllerh">trunk/WebCore/platform/win/UniscribeController.h</a></li>
<li><a href="#trunkWebCorepluginswinPluginViewWincpp">trunk/WebCore/plugins/win/PluginViewWin.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/ChangeLog        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2007-12-19  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        Add support for GDI text rendering to WebKit.
+      
+        Reviewed by mitz
+        
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * dom/Document.cpp:
+        (WebCore::Document::recalcStyle):
+        * page/Settings.cpp:
+        (WebCore::Settings::setFontRenderingMode):
+        (WebCore::Settings::fontRenderingMode):
+        * page/Settings.h:
+        * platform/graphics/Font.h:
+        (WebCore::Font::renderingMode):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
+        (WebCore::FontPlatformDataCacheKey::operator==):
+        (WebCore::computeHash):
+        (WebCore::FontCache::getCachedFontPlatformData):
+        * platform/graphics/FontDescription.h:
+        (WebCore::):
+        (WebCore::FontDescription::FontDescription):
+        (WebCore::FontDescription::renderingMode):
+        (WebCore::FontDescription::setRenderingMode):
+        (WebCore::FontDescription::operator==):
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::FontCache::fontExists):
+        (WebCore::FontCache::createFontPlatformData):
+        * platform/graphics/win/FontDataWin.cpp:
+        (WebCore::FontData::platformInit):
+        (WebCore::FontData::smallCapsFontData):
+        (WebCore::FontData::containsCharacters):
+        (WebCore::FontData::determinePitch):
+        (WebCore::FontData::platformWidthForGlyph):
+        * platform/graphics/win/FontPlatformData.h:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::useGDI):
+        (WebCore::FontPlatformData::operator==):
+        * platform/graphics/win/FontPlatformDataWin.cpp:
+        (WebCore::FontPlatformData::FontPlatformData):
+        * platform/graphics/win/FontWin.cpp:
+        (WebCore::Font::drawGlyphs):
+        * platform/graphics/win/IconWin.cpp:
+        (WebCore::Icon::paint):
+        * platform/win/GraphicsContextWin.cpp:
+        (WebCore::GraphicsContext::getWindowsContext):
+        (WebCore::GraphicsContext::releaseWindowsContext):
+        * platform/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::shapeAndPlaceItem):
+        * platform/win/UniscribeController.h:
+        * plugins/win/PluginViewWin.cpp:
+        (WebCore::PluginViewWin::paint):
+
</ins><span class="cx"> 2007-12-19  Sven Herzberg  &lt;sven@imendio.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Alp Toker.
</span></span></pre></div>
<a id="trunkWebCorecssCSSStyleSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSStyleSelector.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSStyleSelector.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/css/CSSStyleSelector.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -3338,8 +3338,11 @@
</span><span class="cx">             if (style-&gt;setFontDescription(fontDescription))
</span><span class="cx">                 fontDirty = true;
</span><span class="cx">         } else if (isInitial) {
</span><ins>+            Settings* settings = m_document-&gt;settings();
</ins><span class="cx">             FontDescription fontDescription;
</span><span class="cx">             fontDescription.setGenericFamily(FontDescription::StandardFamily);
</span><ins>+            fontDescription.setRenderingMode(settings-&gt;fontRenderingMode());
+            fontDescription.setUsePrinterFont(m_document-&gt;printing());
</ins><span class="cx">             const AtomicString&amp; standardFontFamily = m_document-&gt;settings()-&gt;standardFontFamily();
</span><span class="cx">             if (!standardFontFamily.isEmpty()) {
</span><span class="cx">                 fontDescription.firstFamily().setFamily(standardFontFamily);
</span></span></pre></div>
<a id="trunkWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Document.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Document.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/dom/Document.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -1064,6 +1064,7 @@
</span><span class="cx">         FontDescription fontDescription;
</span><span class="cx">         fontDescription.setUsePrinterFont(printing());
</span><span class="cx">         if (Settings* settings = this-&gt;settings()) {
</span><ins>+            fontDescription.setRenderingMode(settings-&gt;fontRenderingMode());
</ins><span class="cx">             if (printing() &amp;&amp; !settings-&gt;shouldPrintBackgrounds())
</span><span class="cx">                 _style-&gt;setForceBackgroundsToWhite(true);
</span><span class="cx">             const AtomicString&amp; stdfont = settings-&gt;standardFontFamily();
</span></span></pre></div>
<a id="trunkWebCorepageSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/Settings.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/Settings.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/page/Settings.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -314,4 +314,17 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Settings::setFontRenderingMode(FontRenderingMode mode)
+{
+    if (m_fontRenderingMode == mode)
+        return;
+    m_fontRenderingMode = mode;
+    setNeedsReapplyStylesInAllFrames(m_page);
+}
+
+FontRenderingMode Settings::fontRenderingMode() const
+{
+    return m_fontRenderingMode;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCorepageSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/Settings.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/Settings.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/page/Settings.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AtomicString.h&quot;
</span><span class="cx"> #include &quot;KURL.h&quot;
</span><ins>+#include &quot;FontDescription.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -146,6 +147,9 @@
</span><span class="cx">         void setDefaultDatabaseOriginQuota(unsigned long long);
</span><span class="cx">         unsigned long long defaultDatabaseOriginQuota() const;
</span><span class="cx">         
</span><ins>+        void setFontRenderingMode(FontRenderingMode mode);
+        FontRenderingMode fontRenderingMode() const;
+
</ins><span class="cx">     private:
</span><span class="cx">         Page* m_page;
</span><span class="cx">         
</span><span class="lines">@@ -181,6 +185,7 @@
</span><span class="cx">         bool m_forceFTPDirectoryListings : 1;
</span><span class="cx">         bool m_developerExtrasEnabled : 1;
</span><span class="cx">         bool m_authorAndUserStylesEnabled : 1;
</span><ins>+        FontRenderingMode m_fontRenderingMode : 1;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsFonth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/Font.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/Font.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/Font.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -159,6 +159,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isFixedPitch() const;
</span><span class="cx">     bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
</span><ins>+    
+    FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
</ins><span class="cx"> 
</span><span class="cx">     FontFamily&amp; firstFamily() { return m_fontDescription.firstFamily(); }
</span><span class="cx">     const FontFamily&amp; family() const { return m_fontDescription.family(); }
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsFontCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/FontCache.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/FontCache.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/FontCache.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -40,19 +40,21 @@
</span><span class="cx"> 
</span><span class="cx"> struct FontPlatformDataCacheKey {
</span><span class="cx">     FontPlatformDataCacheKey(const AtomicString&amp; family = AtomicString(), unsigned size = 0, bool bold = false, bool italic = false,
</span><del>-                             bool isPrinterFont = false)
</del><ins>+                             bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode)
</ins><span class="cx">         : m_family(family)
</span><span class="cx">         , m_size(size)
</span><span class="cx">         , m_bold(bold)
</span><span class="cx">         , m_italic(italic)
</span><span class="cx">         , m_printerFont(isPrinterFont)
</span><ins>+        , m_renderingMode(renderingMode)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool operator==(const FontPlatformDataCacheKey&amp; other) const
</span><span class="cx">     {
</span><span class="cx">         return equalIgnoringCase(m_family, other.m_family) &amp;&amp; m_size == other.m_size &amp;&amp; 
</span><del>-               m_bold == other.m_bold &amp;&amp; m_italic == other.m_italic &amp;&amp; m_printerFont == other.m_printerFont;
</del><ins>+               m_bold == other.m_bold &amp;&amp; m_italic == other.m_italic &amp;&amp; m_printerFont == other.m_printerFont &amp;&amp;
+               m_renderingMode == other.m_renderingMode;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     AtomicString m_family;
</span><span class="lines">@@ -60,16 +62,18 @@
</span><span class="cx">     bool m_bold;
</span><span class="cx">     bool m_italic;
</span><span class="cx">     bool m_printerFont;
</span><ins>+    FontRenderingMode m_renderingMode;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline unsigned computeHash(const FontPlatformDataCacheKey&amp; fontKey)
</span><span class="cx"> {
</span><del>-    unsigned hashCodes[3] = {
</del><ins>+    unsigned hashCodes[4] = {
</ins><span class="cx">         CaseFoldingHash::hash(fontKey.m_family),
</span><span class="cx">         fontKey.m_size,
</span><del>-        static_cast&lt;unsigned&gt;(fontKey.m_bold) &lt;&lt; 2 | static_cast&lt;unsigned&gt;(fontKey.m_italic) &lt;&lt; 1 | static_cast&lt;unsigned&gt;(fontKey.m_printerFont)
</del><ins>+        static_cast&lt;unsigned&gt;(fontKey.m_bold) &lt;&lt; 3 | static_cast&lt;unsigned&gt;(fontKey.m_italic) &lt;&lt; 2 | static_cast&lt;unsigned&gt;(fontKey.m_printerFont) &lt;&lt; 1 |
+        static_cast&lt;unsigned&gt;(fontKey.m_renderingMode)
</ins><span class="cx">     };
</span><del>-    return StringImpl::computeHash(reinterpret_cast&lt;UChar*&gt;(hashCodes), 3 * sizeof(unsigned) / sizeof(UChar));
</del><ins>+    return StringImpl::computeHash(reinterpret_cast&lt;UChar*&gt;(hashCodes), 4 * sizeof(unsigned) / sizeof(UChar));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> struct FontPlatformDataCacheKeyHash {
</span><span class="lines">@@ -141,7 +145,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     FontPlatformDataCacheKey key(familyName, fontDescription.computedPixelSize(), fontDescription.bold(), fontDescription.italic(),
</span><del>-                                 fontDescription.usePrinterFont());
</del><ins>+                                 fontDescription.usePrinterFont(), fontDescription.renderingMode());
</ins><span class="cx">     FontPlatformData* result = 0;
</span><span class="cx">     bool foundResult;
</span><span class="cx">     FontPlatformDataCache::iterator it = gFontPlatformDataCache-&gt;find(key);
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsFontDescriptionh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/FontDescription.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/FontDescription.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/FontDescription.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> const unsigned cNormalWeight = 50;
</span><span class="cx"> const unsigned cBoldWeight = 63;
</span><span class="cx"> 
</span><ins>+// This setting is used to provide ways of switching between multiple rendering modes that may have different
+// metrics.  It is used to switch between CG and GDI text on Windows.
+enum FontRenderingMode { NormalRenderingMode, AlternateRenderingMode };
+
</ins><span class="cx"> class FontDescription {
</span><span class="cx"> public:
</span><span class="cx">     enum GenericFamilyType { NoFamily, StandardFamily, SerifFamily, SansSerifFamily, 
</span><span class="lines">@@ -39,7 +43,7 @@
</span><span class="cx">     FontDescription()
</span><span class="cx">         : m_specifiedSize(0), m_computedSize(0), 
</span><span class="cx">           m_italic(false), m_smallCaps(false), m_isAbsoluteSize(false), m_weight(cNormalWeight), 
</span><del>-          m_genericFamily(NoFamily), m_usePrinterFont(false), m_keywordSize(0)
</del><ins>+          m_genericFamily(NoFamily), m_usePrinterFont(false), m_renderingMode(NormalRenderingMode), m_keywordSize(0)
</ins><span class="cx">           {}
</span><span class="cx">     
</span><span class="cx">     bool operator==(const FontDescription&amp;) const;
</span><span class="lines">@@ -57,6 +61,7 @@
</span><span class="cx">     unsigned weight() const { return m_weight; }
</span><span class="cx">     GenericFamilyType genericFamily() const { return static_cast&lt;GenericFamilyType&gt;(m_genericFamily); }
</span><span class="cx">     bool usePrinterFont() const { return m_usePrinterFont; }
</span><ins>+    FontRenderingMode renderingMode() const { return static_cast&lt;FontRenderingMode&gt;(m_renderingMode); }
</ins><span class="cx">     int keywordSize() const { return m_keywordSize; }
</span><span class="cx"> 
</span><span class="cx">     void setFamily(const FontFamily&amp; family) { m_familyList = family; }
</span><span class="lines">@@ -69,6 +74,7 @@
</span><span class="cx">     void setWeight(unsigned w) { m_weight = w; }
</span><span class="cx">     void setGenericFamily(GenericFamilyType genericFamily) { m_genericFamily = genericFamily; }
</span><span class="cx">     void setUsePrinterFont(bool p) { m_usePrinterFont = p; }
</span><ins>+    void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
</ins><span class="cx">     void setKeywordSize(int s) { m_keywordSize = s; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -85,7 +91,9 @@
</span><span class="cx">     unsigned m_weight : 8;
</span><span class="cx">     unsigned m_genericFamily : 3; // GenericFamilyType
</span><span class="cx">     bool m_usePrinterFont : 1;
</span><del>-    
</del><ins>+
+    unsigned m_renderingMode : 1;  // Used to switch between CG and GDI text on Windows.
+
</ins><span class="cx">     int m_keywordSize : 4; // We cache whether or not a font is currently represented by a CSS keyword (e.g., medium).  If so,
</span><span class="cx">                            // then we can accurately translate across different generic families to adjust for different preference settings
</span><span class="cx">                            // (e.g., 13px monospace vs. 16px everything else).  Sizes are 1-8 (like the HTML size values for &lt;font&gt;).
</span><span class="lines">@@ -102,6 +110,7 @@
</span><span class="cx">         &amp;&amp; m_weight == other.m_weight
</span><span class="cx">         &amp;&amp; m_genericFamily == other.m_genericFamily
</span><span class="cx">         &amp;&amp; m_usePrinterFont == other.m_usePrinterFont
</span><ins>+        &amp;&amp; m_renderingMode == other.m_renderingMode
</ins><span class="cx">         &amp;&amp; m_keywordSize == other.m_keywordSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/GraphicsContext.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/GraphicsContext.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/GraphicsContext.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -221,8 +221,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx">         GraphicsContext(HDC); // FIXME: To be removed.
</span><del>-        HDC getWindowsContext(bool supportAlphaBlend = false, const IntRect* = 0); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
-        void releaseWindowsContext(HDC, bool supportAlphaBlend = false, const IntRect* = 0);    // The passed in HDC should be the one handed back by getWindowsContext.
</del><ins>+        HDC getWindowsContext(const IntRect&amp;, bool supportAlphaBlend = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
+        void releaseWindowsContext(HDC, const IntRect&amp;, bool supportAlphaBlend = true);    // The passed in HDC should be the one handed back by getWindowsContext.
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(QT)
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinFontCacheWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/FontCacheWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/FontCacheWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/FontCacheWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx">     HFONT hfont = CreateFontIndirect(&amp;winfont);
</span><span class="cx">     // Windows will always give us a valid pointer here, even if the face name is non-existent.  We have to double-check
</span><span class="cx">     // and see if the family name was really used.
</span><del>-    HDC dc = GetDC((HWND)0);
</del><ins>+    HDC dc = GetDC(0);
</ins><span class="cx">     SaveDC(dc);
</span><span class="cx">     SelectObject(dc, hfont);
</span><span class="cx">     WCHAR name[LF_FACESIZE];
</span><span class="lines">@@ -230,22 +230,28 @@
</span><span class="cx"> 
</span><span class="cx"> FontPlatformData* FontCache::createFontPlatformData(const FontDescription&amp; fontDescription, const AtomicString&amp; family)
</span><span class="cx"> {
</span><ins>+    bool isLucidaGrande = false;
+    static AtomicString lucidaStr(&quot;Lucida Grande&quot;);
+    if (equalIgnoringCase(family, lucidaStr))
+        isLucidaGrande = true;
+
+    bool useGDI = fontDescription.renderingMode() == AlternateRenderingMode &amp;&amp; !isLucidaGrande;
+
</ins><span class="cx">     LOGFONT winfont;
</span><span class="cx"> 
</span><del>-    // The size here looks unusual.  The negative number is intentional.  The logical size constant is 32.
-    winfont.lfHeight = -fontDescription.computedPixelSize() * 32;
</del><ins>+    // The size here looks unusual.  The negative number is intentional.  The logical size constant is 32. We do this
+    // for subpixel precision when rendering using Uniscribe.  This masks rounding errors related to the HFONT metrics being
+    // different from the CGFont metrics.
+    // FIXME: We will eventually want subpixel precision for GDI mode, but the scaled rendering doesn't look as nice.  That may be solvable though.
+    winfont.lfHeight = -fontDescription.computedPixelSize() * (useGDI ? 1 : 32);
</ins><span class="cx">     winfont.lfWidth = 0;
</span><span class="cx">     winfont.lfEscapement = 0;
</span><span class="cx">     winfont.lfOrientation = 0;
</span><span class="cx">     winfont.lfUnderline = false;
</span><span class="cx">     winfont.lfStrikeOut = false;
</span><span class="cx">     winfont.lfCharSet = DEFAULT_CHARSET;
</span><del>-#if PLATFORM(CG)
</del><span class="cx">     winfont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
</span><del>-#else
-    winfont.lfOutPrecision = OUT_TT_PRECIS;
-#endif
-    winfont.lfQuality = 5; // Force cleartype.
</del><ins>+    winfont.lfQuality = DEFAULT_QUALITY;
</ins><span class="cx">     winfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
</span><span class="cx">     winfont.lfItalic = fontDescription.italic();
</span><span class="cx"> 
</span><span class="lines">@@ -254,10 +260,10 @@
</span><span class="cx">     // gaps in the weight list.
</span><span class="cx">     // FIXME: Hardcoding Lucida Grande for now.  It uses different weights than typical Win32 fonts
</span><span class="cx">     // (500/600 instead of 400/700).
</span><del>-    static AtomicString lucidaStr(&quot;Lucida Grande&quot;);
-    if (equalIgnoringCase(family, lucidaStr))
</del><ins>+    if (isLucidaGrande) {
</ins><span class="cx">         winfont.lfWeight = fontDescription.bold() ? 600 : 500;
</span><del>-    else
</del><ins>+        useGDI = false; // Never use GDI for Lucida Grande.
+    } else
</ins><span class="cx">         winfont.lfWeight = fontDescription.bold() ? 700 : 400;
</span><span class="cx">     int len = min(family.length(), (unsigned int)LF_FACESIZE - 1);
</span><span class="cx">     memcpy(winfont.lfFaceName, family.characters(), len * sizeof(WORD));
</span><span class="lines">@@ -266,7 +272,7 @@
</span><span class="cx">     HFONT hfont = CreateFontIndirect(&amp;winfont);
</span><span class="cx">     // Windows will always give us a valid pointer here, even if the face name is non-existent.  We have to double-check
</span><span class="cx">     // and see if the family name was really used.
</span><del>-    HDC dc = GetDC((HWND)0);
</del><ins>+    HDC dc = GetDC(0);
</ins><span class="cx">     SaveDC(dc);
</span><span class="cx">     SelectObject(dc, hfont);
</span><span class="cx">     WCHAR name[LF_FACESIZE];
</span><span class="lines">@@ -280,7 +286,7 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     FontPlatformData* result = new FontPlatformData(hfont, fontDescription.computedPixelSize(),
</span><del>-                                                    fontDescription.bold(), fontDescription.italic());
</del><ins>+                                                    fontDescription.bold(), fontDescription.italic(), useGDI);
</ins><span class="cx">     if (!result-&gt;cgFont()) {
</span><span class="cx">         // The creation of the CGFontRef failed for some reason.  We already asserted in debug builds, but to make
</span><span class="cx">         // absolutely sure that we don't use this font, go ahead and return 0 so that we can fall back to the next
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinFontDataWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/FontDataWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/FontDataWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/FontDataWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -59,7 +59,36 @@
</span><span class="cx"> void FontData::platformInit()
</span><span class="cx"> {    
</span><span class="cx">     m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f;
</span><ins>+    m_scriptCache = 0;
+    m_scriptFontProperties = 0;
+    m_isSystemFont = false;
+    
+    if (m_font.useGDI()) {
+        HDC hdc = GetDC(0);
+        HGDIOBJ oldFont = SelectObject(hdc, m_font.hfont());
+        OUTLINETEXTMETRIC metrics;
+        GetOutlineTextMetrics(hdc, sizeof(metrics), &amp;metrics);
+        TEXTMETRIC&amp; textMetrics = metrics.otmTextMetrics;
+        m_ascent = textMetrics.tmAscent;
+        m_descent = textMetrics.tmDescent;
+        m_lineGap = textMetrics.tmExternalLeading;
+        m_lineSpacing = m_ascent + m_descent + m_lineGap;
+        m_xHeight = m_ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
</ins><span class="cx"> 
</span><ins>+        GLYPHMETRICS gm;
+        MAT2 mat = { 1, 0, 0, 1 };
+        DWORD len = GetGlyphOutline(hdc, 'x', GGO_METRICS, &amp;gm, 0, 0, &amp;mat);
+        if (len != GDI_ERROR &amp;&amp; gm.gmptGlyphOrigin.y &gt; 0)
+            m_xHeight = gm.gmptGlyphOrigin.y;
+
+        m_unitsPerEm = metrics.otmEMSquare;
+
+        SelectObject(hdc, oldFont);
+        ReleaseDC(0, hdc);
+
+        return;
+    }
+
</ins><span class="cx">     CGFontRef font = m_font.cgFont();
</span><span class="cx">     int iAscent = CGFontGetAscent(font);
</span><span class="cx">     int iDescent = CGFontGetDescent(font);
</span><span class="lines">@@ -70,7 +99,6 @@
</span><span class="cx">     float fDescent = -scaleEmToUnits(iDescent, m_unitsPerEm) * pointSize;
</span><span class="cx">     float fLineGap = scaleEmToUnits(iLineGap, m_unitsPerEm) * pointSize;
</span><span class="cx"> 
</span><del>-    m_isSystemFont = false;
</del><span class="cx">     if (!isCustomFont()) {
</span><span class="cx">         HDC dc = GetDC(0);
</span><span class="cx">         HGDIOBJ oldFont = SelectObject(dc, m_font.hfont());
</span><span class="lines">@@ -115,9 +143,6 @@
</span><span class="cx">         int iXHeight = CGFontGetXHeight(font);
</span><span class="cx">         m_xHeight = scaleEmToUnits(iXHeight, m_unitsPerEm) * pointSize;
</span><span class="cx">     }
</span><del>-
-    m_scriptCache = 0;
-    m_scriptFontProperties = 0;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontData::platformDestroy()
</span><span class="lines">@@ -145,9 +170,9 @@
</span><span class="cx">         } else {
</span><span class="cx">             LOGFONT winfont;
</span><span class="cx">             GetObject(m_font.hfont(), sizeof(LOGFONT), &amp;winfont);
</span><del>-            winfont.lfHeight = -lroundf(smallCapsHeight * 32);
</del><ins>+            winfont.lfHeight = -lroundf(smallCapsHeight * m_font.useGDI() ? 1 : 32);
</ins><span class="cx">             HFONT hfont = CreateFontIndirect(&amp;winfont);
</span><del>-            m_smallCapsFontData = new FontData(FontPlatformData(hfont, smallCapsHeight, fontDescription.bold(), fontDescription.italic()));
</del><ins>+            m_smallCapsFontData = new FontData(FontPlatformData(hfont, smallCapsHeight, fontDescription.bold(), fontDescription.italic(), m_font.useGDI()));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return m_smallCapsFontData;
</span><span class="lines">@@ -166,7 +191,7 @@
</span><span class="cx">     if (!langFontLink)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    HDC dc = GetDC((HWND)0);
</del><ins>+    HDC dc = GetDC(0);
</ins><span class="cx">     
</span><span class="cx">     DWORD acpCodePages;
</span><span class="cx">     langFontLink-&gt;CodePageToCodePages(CP_ACP, &amp;acpCodePages);
</span><span class="lines">@@ -197,7 +222,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // TEXTMETRICS have this.  Set m_treatAsFixedPitch based off that.
</span><del>-    HDC dc = GetDC((HWND)0);
</del><ins>+    HDC dc = GetDC(0);
</ins><span class="cx">     SaveDC(dc);
</span><span class="cx">     SelectObject(dc, m_font.hfont());
</span><span class="cx"> 
</span><span class="lines">@@ -213,6 +238,16 @@
</span><span class="cx"> 
</span><span class="cx"> float FontData::platformWidthForGlyph(Glyph glyph) const
</span><span class="cx"> {
</span><ins>+    if (m_font.useGDI()) {
+        HDC hdc = GetDC(0);
+        HGDIOBJ oldFont = SelectObject(hdc, m_font.hfont());
+        int width;
+        GetCharWidthI(hdc, glyph, 1, 0, &amp;width);
+        SelectObject(hdc, oldFont);
+        ReleaseDC(0, hdc);
+        return width;
+    }
+
</ins><span class="cx">     CGFontRef font = m_font.cgFont();
</span><span class="cx">     float pointSize = m_font.size();
</span><span class="cx">     CGSize advance;
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinFontPlatformDatah"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/FontPlatformData.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/FontPlatformData.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/FontPlatformData.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     , m_size(0)
</span><span class="cx">     , m_syntheticBold(false)
</span><span class="cx">     , m_syntheticOblique(false)
</span><ins>+    , m_useGDI(false)
</ins><span class="cx">     {}
</span><span class="cx"> 
</span><span class="cx">     FontPlatformData()
</span><span class="lines">@@ -53,9 +54,10 @@
</span><span class="cx">     , m_size(0)
</span><span class="cx">     , m_syntheticBold(false)
</span><span class="cx">     , m_syntheticOblique(false)
</span><ins>+    , m_useGDI(false)
</ins><span class="cx">     {}
</span><span class="cx"> 
</span><del>-    FontPlatformData(HFONT, float size, bool bold, bool oblique);
</del><ins>+    FontPlatformData(HFONT, float size, bool bold, bool oblique, bool useGDI);
</ins><span class="cx">     FontPlatformData(CGFontRef, float size, bool bold, bool oblique);
</span><span class="cx">     ~FontPlatformData();
</span><span class="cx"> 
</span><span class="lines">@@ -66,6 +68,7 @@
</span><span class="cx">     void setSize(float size) { m_size = size; }
</span><span class="cx">     bool syntheticBold() const { return m_syntheticBold; }
</span><span class="cx">     bool syntheticOblique() const { return m_syntheticOblique; }
</span><ins>+    bool useGDI() const { return m_useGDI; }
</ins><span class="cx"> 
</span><span class="cx">     unsigned hash() const
</span><span class="cx">     {
</span><span class="lines">@@ -75,7 +78,8 @@
</span><span class="cx">     bool operator==(const FontPlatformData&amp; other) const
</span><span class="cx">     { 
</span><span class="cx">         return m_font == other.m_font &amp;&amp; m_cgFont ==other.m_cgFont &amp;&amp; m_size == other.m_size &amp;&amp;
</span><del>-               m_syntheticBold == other.m_syntheticBold &amp;&amp; m_syntheticOblique == other.m_syntheticOblique;
</del><ins>+               m_syntheticBold == other.m_syntheticBold &amp;&amp; m_syntheticOblique == other.m_syntheticOblique &amp;&amp;
+               m_useGDI == other.m_useGDI;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -85,6 +89,7 @@
</span><span class="cx">     float m_size;
</span><span class="cx">     bool m_syntheticBold;
</span><span class="cx">     bool m_syntheticOblique;
</span><ins>+    bool m_useGDI;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinFontPlatformDataWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/FontPlatformDataWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -128,12 +128,13 @@
</span><span class="cx">     return 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique)
</del><ins>+FontPlatformData::FontPlatformData(HFONT font, float size, bool bold, bool oblique, bool useGDI)
</ins><span class="cx">     : m_font(font)
</span><span class="cx">     , m_size(size)
</span><span class="cx">     , m_cgFont(0)
</span><span class="cx">     , m_syntheticBold(false)
</span><span class="cx">     , m_syntheticOblique(false)
</span><ins>+    , m_useGDI(useGDI)
</ins><span class="cx"> {
</span><span class="cx">     HDC hdc = GetDC(0);
</span><span class="cx">     SaveDC(hdc);
</span><span class="lines">@@ -178,6 +179,9 @@
</span><span class="cx">                     m_syntheticOblique = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // For GDI text, synthetic bold and oblique never need to be set.
+        m_syntheticBold = m_syntheticOblique = false;
+
</ins><span class="cx">         // Try the face name first.  Windows may end up localizing this name, and CG doesn't know about
</span><span class="cx">         // the localization.  If the create fails, we'll try the PostScript name.
</span><span class="cx">         RetainPtr&lt;CFStringRef&gt; fullName(AdoptCF, CFStringCreateWithCharacters(NULL, (const UniChar*)faceName, wcslen(faceName)));
</span><span class="lines">@@ -202,6 +206,7 @@
</span><span class="cx">     , m_cgFont(font)
</span><span class="cx">     , m_syntheticBold(bold)
</span><span class="cx">     , m_syntheticOblique(oblique)
</span><ins>+    , m_useGDI(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinFontWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/FontWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/FontWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/FontWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -44,6 +44,88 @@
</span><span class="cx"> void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, const GlyphBuffer&amp; glyphBuffer, 
</span><span class="cx">                       int from, int numGlyphs, const FloatPoint&amp; point) const
</span><span class="cx"> {
</span><ins>+    if (font-&gt;m_font.useGDI()) {
+        // FIXME: Support alpha blending.
+        // FIXME: Support text stroke/fill.
+        // FIXME: Support text shadow.
+        Color fillColor = graphicsContext-&gt;fillColor();
+        if (fillColor.alpha() == 0)
+            return;
+
+        // We have to convert CG's two-dimensional floating point advances to just horizontal integer advances.
+        Vector&lt;int, 2048&gt; gdiAdvances;
+        int totalWidth = 0;
+        for (int i = 0; i &lt; numGlyphs; i++) {
+            gdiAdvances.append(lroundf(glyphBuffer.advanceAt(from + i)));
+            totalWidth += gdiAdvances[i];
+        }
+
+        // We put slop into this rect, since glyphs can overflow the ascent/descent bounds and the left/right edges.
+        IntRect textRect(point.x() - font-&gt;lineGap(), point.y() - font-&gt;ascent() - font-&gt;lineGap(), totalWidth + 2 * font-&gt;lineGap(), font-&gt;lineSpacing());
+        HDC hdc = graphicsContext-&gt;getWindowsContext(textRect);
+        SelectObject(hdc, font-&gt;m_font.hfont());
+
+        // Set the correct color.
+        HDC textDrawingDC = hdc;
+        /*if (fillColor.hasAlpha() || graphicsContext-&gt;inTransparencyLayer()) {
+            // GDI can't handle drawing transparent text.  We have to draw into a mask.  We draw black text on a white-filled background.
+            // We also do this when inside transparency layers, since GDI also can't draw onto a surface with alpha.
+            graphicsContext-&gt;save();
+            graphicsContext-&gt;setFillColor(Color::white);
+            textDrawingDC = graphicsContext-&gt;getWindowsBitmapContext(textRect);
+            SetTextColor(hdc, RGB(0, 0, 0));
+        } else*/
+            SetTextColor(hdc, RGB(fillColor.red(), fillColor.green(), fillColor.blue()));
+
+        SetBkMode(hdc, TRANSPARENT);
+        SetTextAlign(hdc, TA_LEFT | TA_BASELINE);
+
+        // Uniscribe gives us offsets to help refine the positioning of combining glyphs.
+        FloatSize translation = glyphBuffer.offsetAt(from);
+        if (translation.width() || translation.height()) {
+            XFORM xform;
+            xform.eM11 = 1.0;
+            xform.eM12 = 0;
+            xform.eM21 = 0;
+            xform.eM22 = 1.0;
+            xform.eDx = translation.width();
+            xform.eDy = translation.height();
+            ModifyWorldTransform(hdc, &amp;xform, MWT_LEFTMULTIPLY);
+        }
+        ExtTextOut(hdc, point.x(), point.y(), ETO_GLYPH_INDEX, 0, (WCHAR*)glyphBuffer.glyphs(from), numGlyphs, gdiAdvances.data());
+
+        /*if (fillColor.hasAlpha() || graphicsContext-&gt;inTransparencyLayer()) {
+            // TODOD: We have to walk the bits of the bitmap and invert them.  We also copy over the green component value into the alpha value
+            // to keep ClearType looking reasonable.
+
+            // Now that we have drawn the text into a bitmap and inverted it, obtain a CGImageRef mask.
+            CGImageRef mask = graphicsContext-&gt;releaseWindowsBitmapContextIntoMask(textDrawingDC, textRect);
+            
+            // Apply the mask to the fill color.
+            CGContextRef bitmapContext = graphicsContext-&gt;getWindowsCompatibleCGBitmapContext(textRect.size());
+            CGFloat red, green, blue, alpha;
+            color.getRGBA(red, green, blue, alpha);
+            CGContextSetRGBFillColor(context, red, green, blue, alpha);
+            CGContextFillRect(bitmapContext, IntRect(0, 0, textRect.width(), textRect.height()));
+            CGImageRef fillColorImage = CGBitmapContextCreateImage(bitmapContext);
+        
+            // Apply the mask.
+            CGImageRef finalImage = CGImageCreateWithMask(fillColorImage, mask);
+
+            // The bitmap image needs to be drawn into the HDC.
+            graphicsContext-&gt;drawImageIntoWindowsContext(hdc, finalImage);
+
+            // Release our images and contexts.
+            CGImageRelease(mask);
+            CGImageRelease(fillColorImage);
+            CGImageRelease(finalImage);
+            CGContextRelease(bitmapContext);
+        }*/
+
+        graphicsContext-&gt;releaseWindowsContext(hdc, textRect);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef cgContext = graphicsContext-&gt;platformContext();
</span><span class="cx"> 
</span><span class="cx">     uint32_t oldFontSmoothingStyle = wkSetFontSmoothingStyle(cgContext);
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicswinIconWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/win/IconWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/win/IconWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/graphics/win/IconWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -62,11 +62,11 @@
</span><span class="cx">     if (context-&gt;paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    HDC hdc = context-&gt;getWindowsContext();
</del><ins>+    HDC hdc = context-&gt;getWindowsContext(r);
</ins><span class="cx"> 
</span><span class="cx">     DrawIconEx(hdc, r.x(), r.y(), m_hIcon, r.width(), r.height(), 0, 0, DI_NORMAL);
</span><span class="cx"> 
</span><del>-    context-&gt;releaseWindowsContext(hdc);
</del><ins>+    context-&gt;releaseWindowsContext(hdc, r);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoreplatformwinGraphicsContextWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/win/GraphicsContextWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/win/GraphicsContextWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/win/GraphicsContextWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -77,19 +77,17 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HDC GraphicsContext::getWindowsContext(bool supportAlphaBlend, const IntRect* dstRect)
</del><ins>+HDC GraphicsContext::getWindowsContext(const IntRect&amp; dstRect, bool supportAlphaBlend)
</ins><span class="cx"> {
</span><span class="cx">     if (m_data-&gt;m_transparencyCount) {
</span><del>-        // We're in a transparency layer.
-        ASSERT(dstRect);
-        if (!dstRect)
</del><ins>+        if (dstRect.isEmpty())
</ins><span class="cx">             return 0;
</span><del>-    
</del><ins>+
</ins><span class="cx">         // Create a bitmap DC in which to draw.
</span><span class="cx">         BITMAPINFO bitmapInfo;
</span><span class="cx">         bitmapInfo.bmiHeader.biSize          = sizeof(BITMAPINFOHEADER);
</span><del>-        bitmapInfo.bmiHeader.biWidth         = dstRect-&gt;width(); 
-        bitmapInfo.bmiHeader.biHeight        = dstRect-&gt;height();
</del><ins>+        bitmapInfo.bmiHeader.biWidth         = dstRect.width(); 
+        bitmapInfo.bmiHeader.biHeight        = dstRect.height();
</ins><span class="cx">         bitmapInfo.bmiHeader.biPlanes        = 1;
</span><span class="cx">         bitmapInfo.bmiHeader.biBitCount      = 32;
</span><span class="cx">         bitmapInfo.bmiHeader.biCompression   = BI_RGB;
</span><span class="lines">@@ -124,8 +122,8 @@
</span><span class="cx">         xform.eM12 = 0;
</span><span class="cx">         xform.eM21 = 0;
</span><span class="cx">         xform.eM22 = 1.0;
</span><del>-        xform.eDx = -dstRect-&gt;x();
-        xform.eDy = -dstRect-&gt;y();
</del><ins>+        xform.eDx = -dstRect.x();
+        xform.eDy = -dstRect.y();
</ins><span class="cx">         ::SetWorldTransform(bitmapDC, &amp;xform);
</span><span class="cx"> 
</span><span class="cx">         return bitmapDC;
</span><span class="lines">@@ -136,9 +134,12 @@
</span><span class="cx">     return m_data-&gt;m_hdc;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContext::releaseWindowsContext(HDC hdc, bool supportAlphaBlend, const IntRect* dstRect)
</del><ins>+void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect&amp; dstRect, bool supportAlphaBlend)
</ins><span class="cx"> {
</span><span class="cx">     if (hdc &amp;&amp; m_data-&gt;m_transparencyCount) {
</span><ins>+        if (dstRect.isEmpty())
+            return;
+
</ins><span class="cx">         HBITMAP bitmap = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP);
</span><span class="cx"> 
</span><span class="cx">         // Need to make a CGImage out of the bitmap's pixel buffer and then draw
</span><span class="lines">@@ -154,7 +155,7 @@
</span><span class="cx">         CGColorSpaceRelease(deviceRGB);
</span><span class="cx"> 
</span><span class="cx">         CGImageRef image = CGBitmapContextCreateImage(bitmapContext);
</span><del>-        CGContextDrawImage(m_data-&gt;m_cgContext, *dstRect, image);
</del><ins>+        CGContextDrawImage(m_data-&gt;m_cgContext, dstRect, image);
</ins><span class="cx">         
</span><span class="cx">         // Delete all our junk.
</span><span class="cx">         CGImageRelease(image);
</span></span></pre></div>
<a id="trunkWebCoreplatformwinUniscribeControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/win/UniscribeController.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/win/UniscribeController.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/win/UniscribeController.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -253,7 +253,9 @@
</span><span class="cx">     roundingHackCharacters.fill(-1);
</span><span class="cx">     Vector&lt;int&gt; roundingHackWordBoundaries(glyphs.size());
</span><span class="cx">     roundingHackWordBoundaries.fill(-1);
</span><del>-    unsigned logicalSpaceWidth = fontData-&gt;m_spaceWidth * 32.0f;
</del><ins>+
+    const float cLogicalScale = fontData-&gt;m_font.useGDI() ? 1.0f : 32.0f;
+    unsigned logicalSpaceWidth = fontData-&gt;m_spaceWidth * cLogicalScale;
</ins><span class="cx">     float roundedSpaceWidth = roundf(fontData-&gt;m_spaceWidth);
</span><span class="cx"> 
</span><span class="cx">     for (int k = 0; k &lt; len; k++) {
</span><span class="lines">@@ -282,9 +284,9 @@
</span><span class="cx"> 
</span><span class="cx">     for (unsigned k = 0; k &lt; glyphs.size(); k++) {
</span><span class="cx">         Glyph glyph = glyphs[k];
</span><del>-        float advance = advances[k] / 32.0f;
-        float offsetX = offsets[k].du / 32.0f;
-        float offsetY = offsets[k].dv / 32.0f;
</del><ins>+        float advance = advances[k] / cLogicalScale;
+        float offsetX = offsets[k].du / cLogicalScale;
+        float offsetY = offsets[k].dv / cLogicalScale;
</ins><span class="cx"> 
</span><span class="cx">         // Match AppKit's rules for the integer vs. non-integer rendering modes.
</span><span class="cx">         float roundedAdvance = roundf(advance);
</span></span></pre></div>
<a id="trunkWebCoreplatformwinUniscribeControllerh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/win/UniscribeController.h (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/win/UniscribeController.h        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/platform/win/UniscribeController.h        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -29,10 +29,10 @@
</span><span class="cx"> #ifndef UniscribeController_h
</span><span class="cx"> #define UniscribeController_h
</span><span class="cx"> 
</span><ins>+#include &lt;usp10.h&gt;
</ins><span class="cx"> #include &quot;Font.h&quot;
</span><span class="cx"> #include &quot;GlyphBuffer.h&quot;
</span><span class="cx"> #include &quot;Vector.h&quot;
</span><del>-#include &lt;usp10.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorepluginswinPluginViewWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/plugins/win/PluginViewWin.cpp (28866 => 28867)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/plugins/win/PluginViewWin.cpp        2007-12-19 19:13:16 UTC (rev 28866)
+++ trunk/WebCore/plugins/win/PluginViewWin.cpp        2007-12-19 19:24:10 UTC (rev 28867)
</span><span class="lines">@@ -472,8 +472,10 @@
</span><span class="cx">     if (m_isWindowed || context-&gt;paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    HDC hdc = context-&gt;getWindowsContext();
</del><ins>+    HDC hdc = context-&gt;getWindowsContext(frameGeometry());
</ins><span class="cx"> 
</span><ins>+    // FIXME: This is completely wrong and will break in the presence of opacity, SVG transforms
+    // and CSS transforms.
</ins><span class="cx">     // The plugin expects that the passed in DC has window coordinates.
</span><span class="cx">     // (This probably breaks funky SVG transform stuff)
</span><span class="cx">     XFORM transform;
</span><span class="lines">@@ -515,7 +517,7 @@
</span><span class="cx"> 
</span><span class="cx">     dispatchNPEvent(npEvent);
</span><span class="cx"> 
</span><del>-    context-&gt;releaseWindowsContext(hdc);
</del><ins>+    context-&gt;releaseWindowsContext(hdc, frameGeometry());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PluginViewWin::handleKeyboardEvent(KeyboardEvent* event)
</span></span></pre>
</div>
</div>

</body>
</html>