Changeset 127623 in webkit


Ignore:
Timestamp:
Sep 5, 2012 12:04:08 PM (12 years ago)
Author:
pilgrim@chromium.org
Message:

[Chromium] Remove getRenderStyleForStrike from PlatformSupport
https://bugs.webkit.org/show_bug.cgi?id=95363

Reviewed by Adam Barth.

Part of a refactoring series. See tracking bug 82948.

Source/Platform:

  • Platform.gypi:
  • chromium/public/linux/WebFontInfo.h: Added.

(WebKit):
(WebFontInfo):

  • chromium/public/linux/WebFontRenderStyle.h: Added.

(WebKit):

Source/WebCore:

  • platform/chromium/PlatformSupport.h:

(PlatformSupport):

  • platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:

(WebCore::FontPlatformData::operator==):
(WebCore::FontPlatformData::getRenderStyleForStrike):
(WebCore):
(WebCore::FontPlatformData::querySystemForRenderStyle):

  • platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:

(FontPlatformData):

Source/WebKit/chromium:

  • public/linux/WebFontInfo.h:
  • public/linux/WebFontRenderStyle.h:
  • src/PlatformSupport.cpp:

(WebCore):

Location:
trunk/Source
Files:
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r127612 r127623  
     12012-09-05  Mark Pilgrim  <pilgrim@chromium.org>
     2
     3        [Chromium] Remove getRenderStyleForStrike from PlatformSupport
     4        https://bugs.webkit.org/show_bug.cgi?id=95363
     5
     6        Reviewed by Adam Barth.
     7
     8        Part of a refactoring series. See tracking bug 82948.
     9
     10        * Platform.gypi:
     11        * chromium/public/linux/WebFontInfo.h: Added.
     12        (WebKit):
     13        (WebFontInfo):
     14        * chromium/public/linux/WebFontRenderStyle.h: Added.
     15        (WebKit):
     16
    1172012-09-05  Tommy Widenflycht  <tommyw@google.com>
    218
  • trunk/Source/Platform/Platform.gypi

    r127612 r127623  
    150150            'chromium/public/android/WebSandboxSupport.h',
    151151            'chromium/public/android/WebThemeEngine.h',
     152            'chromium/public/linux/WebFontInfo.h',
     153            'chromium/public/linux/WebFontRenderStyle.h',
    152154            'chromium/public/linux/WebSandboxSupport.h',
    153155            'chromium/public/linux/WebThemeEngine.h',
  • trunk/Source/Platform/chromium/public/linux/WebFontInfo.h

    r127620 r127623  
    3232#define WebFontInfo_h
    3333
    34 #include "../linux/WebFontRenderStyle.h"
    35 #include "../platform/WebCString.h"
    36 #include "../platform/linux/WebFontFamily.h"
     34#include "../WebCString.h"
     35#include "WebFontFamily.h"
     36#include "WebFontRenderStyle.h"
    3737
    3838#include <string.h>
  • trunk/Source/Platform/chromium/public/linux/WebFontRenderStyle.h

    r127620 r127623  
    3232#define WebFontRenderStyle_h
    3333
    34 #include "../platform/WebCommon.h"
     34#include "../WebCommon.h"
    3535
    3636namespace WebCore { struct FontRenderStyle; }
  • trunk/Source/WebCore/ChangeLog

    r127620 r127623  
     12012-09-05  Mark Pilgrim  <pilgrim@chromium.org>
     2
     3        [Chromium] Remove getRenderStyleForStrike from PlatformSupport
     4        https://bugs.webkit.org/show_bug.cgi?id=95363
     5
     6        Reviewed by Adam Barth.
     7
     8        Part of a refactoring series. See tracking bug 82948.
     9
     10        * platform/chromium/PlatformSupport.h:
     11        (PlatformSupport):
     12        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
     13        (WebCore::FontPlatformData::operator==):
     14        (WebCore::FontPlatformData::getRenderStyleForStrike):
     15        (WebCore):
     16        (WebCore::FontPlatformData::querySystemForRenderStyle):
     17        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h:
     18        (FontPlatformData):
     19
    1202012-09-05  Sami Kyostila  <skyostil@google.com>
    221
  • trunk/Source/WebCore/platform/chromium/PlatformSupport.h

    r127535 r127623  
    104104    static bool loadFont(NSFont* srcFont, CGFontRef*, uint32_t* fontID);
    105105#elif OS(UNIX)
    106     static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
    107106    struct FontFamily {
    108107        String name;
  • trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp

    r123586 r127623  
    11/*
    22 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  * 
     17 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    3030
    3131#include "config.h"
    32 #include "FontPlatformData.h"
     32#include "FontPlatformDataHarfBuzz.h"
    3333
    3434#include "NotImplemented.h"
    3535#include "PlatformString.h"
    36 #include "PlatformSupport.h"
    37 
    3836#include "SkAdvancedTypefaceMetrics.h"
    3937#include "SkFontHost.h"
     
    4139#include "SkTypeface.h"
    4240
    43 #include <wtf/text/StringImpl.h>
    44 
    4541#if USE(HARFBUZZ_NG)
    4642#include "HarfBuzzNGFace.h"
     
    4844#include "HarfBuzzSkia.h"
    4945#endif
     46
     47#include <public/linux/WebFontInfo.h>
     48#include <public/linux/WebFontRenderStyle.h>
     49#include <public/linux/WebSandboxSupport.h>
     50#include <public/Platform.h>
     51#include <wtf/text/StringImpl.h>
    5052
    5153namespace WebCore {
     
    249251        typefacesEqual = SkTypeface::Equal(m_typeface, a.m_typeface);
    250252
    251     return typefacesEqual 
     253    return typefacesEqual
    252254        && m_textSize == a.m_textSize
    253255        && m_fakeBold == a.m_fakeBold
     
    297299#endif
    298300
     301void FontPlatformData::getRenderStyleForStrike(const char* font, int sizeAndStyle)
     302{
     303    WebKit::WebFontRenderStyle style;
     304
     305#if OS(ANDROID)
     306    style.setDefaults();
     307#else
     308    if (!font || !*font)
     309        style.setDefaults(); // It's probably a webfont. Take the system defaults.
     310    else if (WebKit::Platform::current()->sandboxSupport())
     311        WebKit::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style);
     312    else
     313        WebKit::WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style);
     314#endif
     315
     316    style.toFontRenderStyle(&m_style);
     317}
     318
    299319void FontPlatformData::querySystemForRenderStyle()
    300320{
    301     PlatformSupport::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style);
     321    getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3));
    302322
    303323    // Fix FontRenderStyle::NoPreference to actual styles.
  • trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h

    r123586 r127623  
    11/*
    22 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  * 
     17 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    127127
    128128private:
     129    void getRenderStyleForStrike(const char*, int);
    129130    void querySystemForRenderStyle();
    130131
  • trunk/Source/WebKit/chromium/ChangeLog

    r127617 r127623  
     12012-09-05  Mark Pilgrim  <pilgrim@chromium.org>
     2
     3        [Chromium] Remove getRenderStyleForStrike from PlatformSupport
     4        https://bugs.webkit.org/show_bug.cgi?id=95363
     5
     6        Reviewed by Adam Barth.
     7
     8        Part of a refactoring series. See tracking bug 82948.
     9
     10        * public/linux/WebFontInfo.h:
     11        * public/linux/WebFontRenderStyle.h:
     12        * src/PlatformSupport.cpp:
     13        (WebCore):
     14
    1152012-09-05  Ilya Tikhonovsky  <loislo@chromium.org>
    216
  • trunk/Source/WebKit/chromium/public/linux/WebFontInfo.h

    r120363 r127623  
    2929 */
    3030
    31 #ifndef WebFontInfo_h
    32 #define WebFontInfo_h
    33 
    34 #include "../linux/WebFontRenderStyle.h"
    35 #include "../platform/WebCString.h"
    36 #include "../platform/linux/WebFontFamily.h"
    37 
    38 #include <string.h>
    39 #include <unistd.h>
    40 
    41 namespace WebKit {
    42 
    43 class WebFontInfo {
    44 public:
    45     // Set a global preference describing whether renderStyleForStrike() should
    46     // enable subpixel positioning or not. FontConfig doesn't currently provide
    47     // a parameter for controlling this.
    48     WEBKIT_EXPORT static void setSubpixelPositioning(bool);
    49 
    50     // Return a font family which provides glyphs for the Unicode code points
    51     // specified by |utf16|
    52     //   characters: a native-endian UTF16 string
    53     //   numCharacters: the number of 16-bit words in |utf16|
    54     //   preferredLocale: preferred locale identifier for the |characters|
    55     //                    (e.g. "en", "ja", "zh-CN")
    56     //
    57     // Returns: the font family or an empty string if the request could not be
    58     // satisfied.
    59     // Returns: the font family instance. The instance has an empty font name if the request could not be satisfied.
    60     WEBKIT_EXPORT static void familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*);
    61 
    62     // Fill out the given WebFontRenderStyle with the user's preferences for
    63     // rendering the given font at the given size (in pixels).
    64     //   family: i.e. "Times New Roman"
    65     //   sizeAndStyle:
    66     //      3322222222221111111111
    67     //      10987654321098765432109876543210
    68     //     +--------------------------------+
    69     //     |..............Size............IB|
    70     //     +--------------------------------+
    71     //     I: italic flag
    72     //     B: bold flag
    73     WEBKIT_EXPORT static void renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* result);
    74 };
    75 
    76 } // namespace WebKit
    77 
    78 #endif
     31#include "../../../../Platform/chromium/public/linux/WebFontInfo.h"
  • trunk/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h

    r121264 r127623  
    2929 */
    3030
    31 #ifndef WebFontRenderStyle_h
    32 #define WebFontRenderStyle_h
    33 
    34 #include "../platform/WebCommon.h"
    35 
    36 namespace WebCore { struct FontRenderStyle; }
    37 
    38 namespace WebKit {
    39 
    40 struct WEBKIT_EXPORT WebFontRenderStyle {
    41     // Each of the use* members below can take one of three values:
    42     //   0: off
    43     //   1: on
    44     //   2: no preference expressed
    45     char useBitmaps; // use embedded bitmap strike if possible
    46     char useAutoHint; // use 'auto' hinting (FreeType specific)
    47     char useHinting; // hint glyphs to the pixel grid
    48     char hintStyle; // level of hinting, 0..3
    49     char useAntiAlias; // antialias glyph shapes
    50     char useSubpixelRendering; // use subpixel rendering (partially-filled pixels)
    51     char useSubpixelPositioning; // use subpixel positioning (fractional X positions for glyphs)
    52 
    53 #if WEBKIT_IMPLEMENTATION
    54     // Translates the members of this struct to a FontRenderStyle
    55     void toFontRenderStyle(WebCore::FontRenderStyle*);
    56 #endif
    57 
    58     void setDefaults();
    59 };
    60 
    61 } // namespace WebKit
    62 
    63 #endif // WebFontRenderStyle_h
     31#include "../../../../Platform/chromium/public/linux/WebFontRenderStyle.h"
  • trunk/Source/WebKit/chromium/src/PlatformSupport.cpp

    r127535 r127623  
    254254}
    255255
    256 void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result)
    257 {
    258     WebFontRenderStyle style;
    259 
    260 #if OS(ANDROID)
    261     style.setDefaults();
    262 #else
    263     if (!font || !*font)
    264         style.setDefaults(); // It's probably a webfont. Take the system defaults.
    265     else if (WebKit::Platform::current()->sandboxSupport())
    266         WebKit::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style);
    267     else
    268         WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style);
    269 #endif
    270 
    271     style.toFontRenderStyle(result);
    272 }
    273256#endif
    274257
Note: See TracChangeset for help on using the changeset viewer.