[Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jun 2012 00:24:09 +0000 (00:24 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Jun 2012 00:24:09 +0000 (00:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89228

Source/WebCore:

Reverse the dependency originally from WebKit::WebFontRendering to WebCore::FontPlatformDataHarfBuzz
so that WebKit::WebFontRendering can be platform-independent.

Reviewed by Tony Chang.

Refactory only. No new tests.

* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
(WebCore::FontPlatformData::setupPaint):
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:
(FontPlatformData):

Source/WebKit/chromium:

Reverse dependency originally from WebCore::FontPlatformDataHarfBuzz to WebKit::WebFontRendering
so that WebKit::WebFontRendering can be platform-independent.

This also avoids the ambiguous name 'linuxish'.

Reviewed by Tony Chang.

* WebKit.gyp:
* public/WebFontRendering.h: Copied from Source/WebKit/chromium/public/linuxish/WebFontRendering.h. Added getters under WEBKIT_IMPLEMENTATION.
(WebFontRendering):
* public/linux/WebFontRendering.h:
* public/linuxish: Removed.
* public/linuxish/WebFontRendering.h: Removed.
* src/WebFontRendering.cpp: Copied from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp. Changed setters to be independent of platform-dependent implementation and added getters.
(WebKit):
(WebKit::WebFontRendering::setHinting):
(WebKit::WebFontRendering::hinting):
(WebKit::WebFontRendering::setAutoHint):
(WebKit::WebFontRendering::autoHint):
(WebKit::WebFontRendering::setUseBitmaps):
(WebKit::WebFontRendering::useBitmaps):
(WebKit::WebFontRendering::setAntiAlias):
(WebKit::WebFontRendering::antiAlias):
(WebKit::WebFontRendering::setSubpixelRendering):
(WebKit::WebFontRendering::subpixelRendering):
(WebKit::WebFontRendering::setSubpixelPositioning):
(WebKit::WebFontRendering::subpixelPositioning):
* src/linuxish: Removed.
* src/linuxish/WebFontRendering.cpp: Removed.

Tools:

Reviewed by Tony Chang.

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::reset):
(LayoutTestController::setTextSubpixelPositioning):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/public/WebFontRendering.h [moved from Source/WebKit/chromium/public/linuxish/WebFontRendering.h with 85% similarity]
Source/WebKit/chromium/public/linux/WebFontRendering.h
Source/WebKit/chromium/src/WebFontRendering.cpp [moved from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp with 71% similarity]
Tools/ChangeLog
Tools/DumpRenderTree/chromium/LayoutTestController.cpp

index b59a671..8a9ace3 100644 (file)
@@ -1,3 +1,20 @@
+2012-06-15  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        [Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
+        https://bugs.webkit.org/show_bug.cgi?id=89228
+
+        Reverse the dependency originally from WebKit::WebFontRendering to WebCore::FontPlatformDataHarfBuzz
+        so that WebKit::WebFontRendering can be platform-independent.
+
+        Reviewed by Tony Chang.
+
+        Refactory only. No new tests.
+
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
+        (WebCore::FontPlatformData::setupPaint):
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:
+        (FontPlatformData):
+
 2012-06-15  Adrienne Walker  <enne@google.com>
 
         [chromium] Fix composited scrollbars with transparent thumbs
index 54df770..c7d7ab8 100644 (file)
 #include "SkPaint.h"
 #include "SkTypeface.h"
 
-#include <wtf/text/StringImpl.h> 
+#include <public/WebFontRendering.h>
+#include <wtf/text/StringImpl.h>
 
-namespace WebCore {
-
-static SkPaint::Hinting skiaHinting = SkPaint::kNormal_Hinting;
-static bool useSkiaAutoHint = true;
-static bool useSkiaBitmaps = true;
-static bool useSkiaAntiAlias = true;
-static bool useSkiaSubpixelRendering = false;
-static bool useSkiaSubpixelPositioning = false;
-
-void FontPlatformData::setHinting(SkPaint::Hinting hinting)
-{
-    skiaHinting = hinting;
-}
-
-void FontPlatformData::setAutoHint(bool useAutoHint)
-{
-    useSkiaAutoHint = useAutoHint;
-}
-
-void FontPlatformData::setUseBitmaps(bool useBitmaps)
-{
-    useSkiaBitmaps = useBitmaps;
-}
-
-void FontPlatformData::setAntiAlias(bool useAntiAlias)
-{
-    useSkiaAntiAlias = useAntiAlias;
-}
-
-void FontPlatformData::setSubpixelRendering(bool useSubpixelRendering)
-{
-    useSkiaSubpixelRendering = useSubpixelRendering;
-}
+using WebKit::WebFontRendering;
 
-void FontPlatformData::setSubpixelPositioning(bool useSubpixelPositioning)
-{
-    useSkiaSubpixelPositioning = useSubpixelPositioning;
-}
+namespace WebCore {
 
 FontPlatformData::FontPlatformData(const FontPlatformData& src)
     : m_typeface(src.m_typeface)
@@ -177,10 +143,10 @@ void FontPlatformData::setupPaint(SkPaint* paint) const
 {
     const float ts = m_textSize >= 0 ? m_textSize : 12;
 
-    paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? useSkiaAntiAlias : m_style.useAntiAlias);
+    paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? WebFontRendering::antiAlias() : m_style.useAntiAlias);
     switch (m_style.useHinting) {
     case FontRenderStyle::NoPreference:
-        paint->setHinting(skiaHinting);
+        paint->setHinting(WebFontRendering::hinting());
         break;
     case 0:
         paint->setHinting(SkPaint::kNo_Hinting);
@@ -190,16 +156,16 @@ void FontPlatformData::setupPaint(SkPaint* paint) const
         break;
     }
 
-    paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? useSkiaBitmaps : m_style.useBitmaps);
+    paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? WebFontRendering::useBitmaps() : m_style.useBitmaps);
     paint->setTextSize(SkFloatToScalar(ts));
     paint->setTypeface(m_typeface);
     paint->setFakeBoldText(m_fakeBold);
     paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0);
-    paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? useSkiaAutoHint : m_style.useAutoHint);
-    paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? useSkiaSubpixelPositioning : m_style.useSubpixelPositioning);
+    paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? WebFontRendering::autoHint() : m_style.useAutoHint);
+    paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? WebFontRendering::subpixelPositioning() : m_style.useSubpixelPositioning);
 
-    if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && useSkiaAntiAlias))
-        paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? useSkiaSubpixelRendering : m_style.useSubpixelRendering);
+    if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && WebFontRendering::antiAlias()))
+        paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? WebFontRendering::subpixelRendering() : m_style.useSubpixelRendering);
 }
 
 SkFontID FontPlatformData::uniqueID() const
index 246a7a4..1a694f0 100644 (file)
@@ -130,16 +130,6 @@ public:
 
     HarfbuzzFace* harfbuzzFace() const;
 
-    // -------------------------------------------------------------------------
-    // Global font preferences...
-
-    static void setHinting(SkPaint::Hinting);
-    static void setAutoHint(bool);
-    static void setUseBitmaps(bool);
-    static void setAntiAlias(bool);
-    static void setSubpixelRendering(bool);
-    static void setSubpixelPositioning(bool);
-
 private:
     void querySystemForRenderStyle();
 
index 3ef7922..b16ef1a 100644 (file)
@@ -1,3 +1,38 @@
+2012-06-15  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        [Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
+        https://bugs.webkit.org/show_bug.cgi?id=89228
+
+        Reverse dependency originally from WebCore::FontPlatformDataHarfBuzz to WebKit::WebFontRendering
+        so that WebKit::WebFontRendering can be platform-independent.
+
+        This also avoids the ambiguous name 'linuxish'.
+
+        Reviewed by Tony Chang.
+
+        * WebKit.gyp:
+        * public/WebFontRendering.h: Copied from Source/WebKit/chromium/public/linuxish/WebFontRendering.h. Added getters under WEBKIT_IMPLEMENTATION.
+        (WebFontRendering):
+        * public/linux/WebFontRendering.h:
+        * public/linuxish: Removed.
+        * public/linuxish/WebFontRendering.h: Removed.
+        * src/WebFontRendering.cpp: Copied from Source/WebKit/chromium/src/linuxish/WebFontRendering.cpp. Changed setters to be independent of platform-dependent implementation and added getters.
+        (WebKit):
+        (WebKit::WebFontRendering::setHinting):
+        (WebKit::WebFontRendering::hinting):
+        (WebKit::WebFontRendering::setAutoHint):
+        (WebKit::WebFontRendering::autoHint):
+        (WebKit::WebFontRendering::setUseBitmaps):
+        (WebKit::WebFontRendering::useBitmaps):
+        (WebKit::WebFontRendering::setAntiAlias):
+        (WebKit::WebFontRendering::antiAlias):
+        (WebKit::WebFontRendering::setSubpixelRendering):
+        (WebKit::WebFontRendering::subpixelRendering):
+        (WebKit::WebFontRendering::setSubpixelPositioning):
+        (WebKit::WebFontRendering::subpixelPositioning):
+        * src/linuxish: Removed.
+        * src/linuxish/WebFontRendering.cpp: Removed.
+
 2012-06-15  Tony Chang  <tony@chromium.org>
 
         [chromium] Remove WebKit/chromium/public/gtk/WebFontInfo.h since it's no longer referenced.
index 276c5a4..69e2a86 100644 (file)
                 'public/WebFont.h',
                 'public/WebFontCache.h',
                 'public/WebFontDescription.h',
+                'public/WebFontRendering.h',
                 'public/WebFormControlElement.h',
                 'public/WebFormElement.h',
                 'public/WebFrame.h',
                 'public/gtk/WebInputEventFactory.h',
                 'public/linux/WebFontRenderStyle.h',
                 'public/linux/WebRenderTheme.h',
-                'public/linuxish/WebFontRendering.h',
                 'public/mac/WebInputEventFactory.h',
                 'public/mac/WebSandboxSupport.h',
                 'public/mac/WebScreenInfoFactory.h',
                 'src/linux/WebFontInfo.cpp',
                 'src/linux/WebFontRenderStyle.cpp',
                 'src/linux/WebRenderTheme.cpp',
-                'src/linuxish/WebFontRendering.cpp',
                 'src/x11/WebScreenInfoFactory.cpp',
                 'src/mac/WebInputEventFactory.mm',
                 'src/mac/WebScreenInfoFactory.mm',
                 'src/WebFontDescription.cpp',
                 'src/WebFontImpl.cpp',
                 'src/WebFontImpl.h',
+                'src/WebFontRendering.cpp',
                 'src/WebFormControlElement.cpp',
                 'src/WebFormElement.cpp',
                 'src/WebFrameImpl.cpp',
@@ -31,7 +31,7 @@
 #ifndef WebFontRendering_h
 #define WebFontRendering_h
 
-#include "../platform/WebCommon.h"
+#include "platform/WebCommon.h"
 #include <SkFontHost.h>
 #include <SkPaint.h>
 
@@ -40,6 +40,8 @@ namespace WebKit {
 class WebFontRendering {
 public:
     // Set global font renderering preferences.
+    // Whether they work on particular platform depends on the implementation of
+    // Skia on the platform.
 
     WEBKIT_EXPORT static void setHinting(SkPaint::Hinting);
     WEBKIT_EXPORT static void setAutoHint(bool);
@@ -49,6 +51,15 @@ public:
     WEBKIT_EXPORT static void setSubpixelPositioning(bool);
     WEBKIT_EXPORT static void setLCDOrder(SkFontHost::LCDOrder);
     WEBKIT_EXPORT static void setLCDOrientation(SkFontHost::LCDOrientation);
+
+#if WEBKIT_IMPLEMENTATION
+    static SkPaint::Hinting hinting();
+    static bool autoHint();
+    static bool useBitmaps();
+    static bool antiAlias();
+    static bool subpixelRendering();
+    static bool subpixelPositioning();
+#endif
 };
 
 } // namespace WebKit
index 715432c..451c5e3 100644 (file)
@@ -28,4 +28,4 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 // FIXME: Remove once http://codereview.chromium.org/10544103/ is landed.
-#include "../linuxish/WebFontRendering.h"
+#include "../WebFontRendering.h"
 #include "config.h"
 #include "WebFontRendering.h"
 
-#include "FontPlatformData.h"
-
 #if OS(LINUX)
 #include "WebFontInfo.h"
 #endif
 
-using WebCore::FontPlatformData;
+namespace {
+
+SkPaint::Hinting skiaHinting = SkPaint::kNormal_Hinting;
+bool useSkiaAutoHint = true;
+bool useSkiaBitmaps = true;
+bool useSkiaAntiAlias = true;
+bool useSkiaSubpixelRendering = false;
+bool useSkiaSubpixelPositioning = false;
+
+}
 
 namespace WebKit {
 
 // static
 void WebFontRendering::setHinting(SkPaint::Hinting hinting)
 {
-    FontPlatformData::setHinting(hinting);
+    skiaHinting = hinting;
+}
+
+// static
+SkPaint::Hinting WebFontRendering::hinting()
+{
+    return skiaHinting;
 }
 
 // static
 void WebFontRendering::setAutoHint(bool useAutoHint)
 {
-    FontPlatformData::setAutoHint(useAutoHint);
+    useSkiaAutoHint = useAutoHint;
+}
+
+// static
+bool WebFontRendering::autoHint()
+{
+    return useSkiaAutoHint;
 }
 
 // static
 void WebFontRendering::setUseBitmaps(bool useBitmaps)
 {
-    FontPlatformData::setUseBitmaps(useBitmaps);
+    useSkiaBitmaps = useBitmaps;
+}
+
+// static
+bool WebFontRendering::useBitmaps()
+{
+    return useSkiaBitmaps;
 }
 
 // static
 void WebFontRendering::setAntiAlias(bool useAntiAlias)
 {
-    FontPlatformData::setAntiAlias(useAntiAlias);
+    useSkiaAntiAlias = useAntiAlias;
+}
+
+// static
+bool WebFontRendering::antiAlias()
+{
+    return useSkiaAntiAlias;
 }
 
 // static
 void WebFontRendering::setSubpixelRendering(bool useSubpixelRendering)
 {
-    FontPlatformData::setSubpixelRendering(useSubpixelRendering);
+    useSkiaSubpixelRendering = useSubpixelRendering;
+}
+
+// static
+bool WebFontRendering::subpixelRendering()
+{
+    return useSkiaSubpixelRendering;
 }
 
 // static
 void WebFontRendering::setSubpixelPositioning(bool useSubpixelPositioning)
 {
-    FontPlatformData::setSubpixelPositioning(useSubpixelPositioning);
+    useSkiaSubpixelPositioning = useSubpixelPositioning;
 #if OS(LINUX)
     WebFontInfo::setSubpixelPositioning(useSubpixelPositioning);
 #endif
 }
 
 // static
+bool WebFontRendering::subpixelPositioning()
+{
+    return useSkiaSubpixelPositioning;
+}
+
+// static
 void WebFontRendering::setLCDOrder(SkFontHost::LCDOrder order)
 {
     SkFontHost::SetSubpixelOrder(order);
index ca48a03..d87fa5b 100644 (file)
@@ -1,3 +1,14 @@
+2012-06-15  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        [Chromium] Move chromium/public/linuxish/WebFontRendering.h out of linuxish directory
+        https://bugs.webkit.org/show_bug.cgi?id=89228
+
+        Reviewed by Tony Chang.
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::reset):
+        (LayoutTestController::setTextSubpixelPositioning):
+
 2012-06-15  Dirk Pranke  <dpranke@chromium.org>
 
         webkitpy: remove DummyOptions and clean up the code in Port.get_option() and Port.set_option_default()
index 1f64d65..869c9b9 100644 (file)
@@ -46,6 +46,7 @@
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFindOptions.h"
+#include "WebFontRendering.h"
 #include "WebFrame.h"
 #include "WebGeolocationClientMock.h"
 #include "WebIDBFactory.h"
 #include <wtf/OwnArrayPtr.h>
 #endif
 
-#if OS(LINUX) || OS(ANDROID)
-#include "linuxish/WebFontRendering.h"
-#endif
-
 using namespace WebCore;
 using namespace WebKit;
 using namespace std;
@@ -701,9 +698,7 @@ void LayoutTestController::reset()
     m_taskList.revokeAll();
     m_shouldStayOnPageAfterHandlingBeforeUnload = false;
     m_hasCustomFullScreenBehavior = false;
-#if OS(LINUX) || OS(ANDROID)
     WebFontRendering::setSubpixelPositioning(false);
-#endif
 }
 
 void LayoutTestController::locationChangeDone()
@@ -2194,12 +2189,10 @@ void LayoutTestController::deliverWebIntent(const CppArgumentList& arguments, Cp
 
 void LayoutTestController::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result)
 {
-#if OS(LINUX) || OS(ANDROID)
     // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back
     // to setting it globally for all fonts.
     if (arguments.size() > 0 && arguments[0].isBool())
         WebFontRendering::setSubpixelPositioning(arguments[0].value.boolValue);
-#endif
     result->setNull();
 }