diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-22 18:48:44 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-22 18:48:44 +0000 |
commit | c01615a10a463957b17a34da1192a4da0d59afaa (patch) | |
tree | 4980775c1ae339420d269bebb6d32c9e4d56c371 /webkit/port | |
parent | a82a5c50e08cb6c0ce08895d4b2fac4f3423d97d (diff) | |
download | chromium_src-c01615a10a463957b17a34da1192a4da0d59afaa.zip chromium_src-c01615a10a463957b17a34da1192a4da0d59afaa.tar.gz chromium_src-c01615a10a463957b17a34da1192a4da0d59afaa.tar.bz2 |
Some cleanup in webkit/.
1. Kill a gtest include in UniscribeHelper.h.
2. Kill a webkit_glue:: type used in MediaPlayerPrivateChromium.h
3. Remove the dummy MediaPlayerPrivateChromium.cpp, which has been superceded by webkit/glue/media_player_private_impl.cc
4. Cleanup some webkit style errors.
R=dglazkov
Review URL: http://codereview.chromium.org/16404
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
9 files changed, 262 insertions, 357 deletions
diff --git a/webkit/port/platform/graphics/chromium/FontCacheChromiumWin.cpp b/webkit/port/platform/graphics/chromium/FontCacheChromiumWin.cpp index 779e3e3..ccbd8447 100644 --- a/webkit/port/platform/graphics/chromium/FontCacheChromiumWin.cpp +++ b/webkit/port/platform/graphics/chromium/FontCacheChromiumWin.cpp @@ -27,15 +27,16 @@ */ #include "config.h" -#include "ChromiumBridge.h" #include "FontCache.h" + +#include "ChromiumBridge.h" #include "Font.h" #include "FontUtilsChromiumWin.h" #include "HashMap.h" #include "HashSet.h" #include "SimpleFontData.h" #include "StringHash.h" -#include "unicode/uniset.h" +#include <unicode/uniset.h> #include <windows.h> #include <objidl.h> @@ -52,7 +53,7 @@ void FontCache::platformInit() } // FIXME(jungshik) : consider adding to WebKit String class -static bool IsStringASCII(const String& s) +static bool isStringASCII(const String& s) { for (int i = 0; i < static_cast<int>(s.length()); ++i) { if (s[i] > 0x7f) @@ -200,10 +201,8 @@ static bool LookupAltName(const String& name, String& altName) if (!fontNameMap) { size_t numElements = sizeof(namePairs) / sizeof(NamePair); fontNameMap = new NameMap; - for (size_t i = 0; i < numElements; ++i) { - fontNameMap->set(String(namePairs[i].name), - &(namePairs[i].altNameCp)); - } + for (size_t i = 0; i < numElements; ++i) + fontNameMap->set(String(namePairs[i].name), &(namePairs[i].altNameCp)); } bool isAscii = false; @@ -211,12 +210,11 @@ static bool LookupAltName(const String& name, String& altName) // use |lower| only for ASCII names // For non-ASCII names, we don't want to invoke an expensive // and unnecessary |lower|. - if (IsStringASCII(name)) { + if (isStringASCII(name)) { isAscii = true; n = name.lower(); - } else { + } else n = name; - } NameMap::iterator iter = fontNameMap->find(n); if (iter == fontNameMap->end()) @@ -225,8 +223,7 @@ static bool LookupAltName(const String& name, String& altName) static int systemCp = ::GetACP(); int fontCp = iter->second->codePage; - if ((isAscii && systemCp == fontCp) || - (!isAscii && systemCp != fontCp)) { + if ((isAscii && systemCp == fontCp) || (!isAscii && systemCp != fontCp)) { altName = String(iter->second->name); return true; } @@ -243,7 +240,7 @@ static HFONT createFontIndirectAndGetWinName(const String& family, HFONT hfont = CreateFontIndirect(winfont); if (!hfont) - return NULL; + return NULL; HDC dc = GetDC(0); HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont)); @@ -287,10 +284,8 @@ static bool fontContainsCharacter(const FontPlatformData* font_data, HDC hdc = GetDC(0); HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(hdc, hfont)); int count = GetFontUnicodeRanges(hdc, 0); - if (count == 0) { - if (ChromiumBridge::ensureFontLoaded(hfont)) - count = GetFontUnicodeRanges(hdc, 0); - } + if (count == 0 && ChromiumBridge::ensureFontLoaded(hfont)) + count = GetFontUnicodeRanges(hdc, 0); if (count == 0) { ASSERT_NOT_REACHED(); SelectObject(hdc, oldFont); @@ -336,9 +331,8 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, FontDescription fontDescription = font.fontDescription(); UChar32 c; UScriptCode script; - const wchar_t* family = GetFallbackFamily(characters, length, - static_cast<GenericFamilyType>(fontDescription.genericFamily()), - &c, &script); + const wchar_t* family = getFallbackFamily(characters, length, + fontDescription.genericFamily(), &c, &script); FontPlatformData* data = NULL; if (family) { data = getCachedFontPlatformData(font.fontDescription(), @@ -466,13 +460,11 @@ FontPlatformData* FontCache::getLastResortFallbackFont( // be more intelligent. // This spot rarely gets reached. GetFontDataForCharacters() gets hit a lot // more often (see TODO comment there). - const wchar_t* family = GetFontFamilyForScript(description.dominantScript(), - static_cast<GenericFamilyType>(generic)); + const wchar_t* family = getFontFamilyForScript(description.dominantScript(), + generic); - if (family) { - return getCachedFontPlatformData(description, - AtomicString(family, wcslen(family))); - } + if (family) + return getCachedFontPlatformData(description, AtomicString(family, wcslen(family))); // FIXME: Would be even better to somehow get the user's default font here. // For now we'll pick the default that the user would get without changing @@ -510,9 +502,8 @@ static LONG toGDIFontWeight(FontWeight fontWeight) // TODO in pending/FontCache.h. AtomicString FontCache::getGenericFontForScript(UScriptCode script, const FontDescription& description) { - FontDescription::GenericFamilyType generic = description.genericFamily(); - const wchar_t* scriptFont = GetFontFamilyForScript( - script, static_cast<GenericFamilyType>(generic)); + const wchar_t* scriptFont = getFontFamilyForScript( + script, description.genericFamily()); return scriptFont ? AtomicString(scriptFont, wcslen(scriptFont)) : emptyAtom; } diff --git a/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp index 3002b97..3128259 100644 --- a/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp +++ b/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp @@ -1,6 +1,30 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +// Copyright (c) 2006-2008, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "config.h" #include "FontUtilsChromiumWin.h" @@ -22,7 +46,7 @@ namespace { // which works well since the range of UScriptCode values is small. typedef const UChar* ScriptToFontMap[USCRIPT_CODE_LIMIT]; -void InitializeScriptFontMap(ScriptToFontMap& scriptFontMap) +void initializeScriptFontMap(ScriptToFontMap& scriptFontMap) { struct FontMap { UScriptCode script; @@ -97,15 +121,15 @@ const int kUndefinedAscent = std::numeric_limits<int>::min(); // Given an HFONT, return the ascent. If GetTextMetrics fails, // kUndefinedAscent is returned, instead. -int GetAscent(HFONT hfont) +int getAscent(HFONT hfont) { HDC dc = GetDC(NULL); HGDIOBJ oldFont = SelectObject(dc, hfont); TEXTMETRIC tm; - BOOL got_metrics = GetTextMetrics(dc, &tm); + BOOL gotMetrics = GetTextMetrics(dc, &tm); SelectObject(dc, oldFont); ReleaseDC(NULL, dc); - return got_metrics ? tm.tmAscent : kUndefinedAscent; + return gotMetrics ? tm.tmAscent : kUndefinedAscent; } struct FontData { @@ -139,12 +163,13 @@ typedef HashMap<String, FontData> FontDataCache; // keep track of which character is supported by which font // - Update script_font_cache in response to WM_FONTCHANGE -const UChar* GetFontFamilyForScript(UScriptCode script, - GenericFamilyType generic) { +const UChar* getFontFamilyForScript(UScriptCode script, + FontDescription::GenericFamilyType generic) +{ static ScriptToFontMap scriptFontMap; static bool initialized = false; if (!initialized) { - InitializeScriptFontMap(scriptFontMap); + initializeScriptFontMap(scriptFontMap); initialized = true; } if (script == USCRIPT_INVALID_CODE) @@ -161,9 +186,9 @@ const UChar* GetFontFamilyForScript(UScriptCode script, // and just return it. // - All the characters (or characters up to the point a single // font can cover) need to be taken into account -const UChar* GetFallbackFamily(const UChar *characters, +const UChar* getFallbackFamily(const UChar *characters, int length, - GenericFamilyType generic, + FontDescription::GenericFamilyType generic, UChar32 *charChecked, UScriptCode *scriptChecked) { @@ -230,7 +255,7 @@ const UChar* GetFallbackFamily(const UChar *characters, } // Another lame work-around to cover non-BMP characters. - const UChar* family = GetFontFamilyForScript(script, generic); + const UChar* family = getFontFamilyForScript(script, generic); if (!family) { int plane = ucs4 >> 16; switch (plane) { @@ -253,7 +278,7 @@ const UChar* GetFallbackFamily(const UChar *characters, } // Be aware that this is not thread-safe. -bool GetDerivedFontData(const UChar *family, +bool getDerivedFontData(const UChar *family, int style, LOGFONT *logfont, int *ascent, @@ -283,14 +308,14 @@ bool GetDerivedFontData(const UChar *family, // GetAscent may return kUndefinedAscent, but we still want to // cache it so that we won't have to call CreateFontIndirect once // more for HFONT next time. - derived->ascent = GetAscent(derived->hfont); + derived->ascent = getAscent(derived->hfont); } else { derived = &iter->second; // Last time, GetAscent failed so that only HFONT was // cached. Try once more assuming that TryPreloadFont // was called by a caller between calls. if (kUndefinedAscent == derived->ascent) - derived->ascent = GetAscent(derived->hfont); + derived->ascent = getAscent(derived->hfont); } *hfont = derived->hfont; *ascent = derived->ascent; @@ -298,16 +323,16 @@ bool GetDerivedFontData(const UChar *family, return *ascent != kUndefinedAscent; } -int GetStyleFromLogfont(const LOGFONT* logfont) { +int getStyleFromLogfont(const LOGFONT* logfont) { // TODO(jungshik) : consider defining UNDEFINED or INVALID for style and // returning it when logfont is NULL if (!logfont) { ASSERT_NOT_REACHED(); - return FONT_STYLE_NORMAL; + return FontStyleNormal; } - return (logfont->lfItalic ? FONT_STYLE_ITALIC : FONT_STYLE_NORMAL) | - (logfont->lfUnderline ? FONT_STYLE_UNDERLINED : FONT_STYLE_NORMAL) | - (logfont->lfWeight >= 700 ? FONT_STYLE_BOLD : FONT_STYLE_NORMAL); + return (logfont->lfItalic ? FontStyleItalic : FontStyleNormal) | + (logfont->lfUnderline ? FontStyleUnderlined : FontStyleNormal) | + (logfont->lfWeight >= 700 ? FontStyleBold : FontStyleNormal); } } // namespace WebCore diff --git a/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.h b/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.h index 1ec49eb..82162f4 100644 --- a/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.h +++ b/webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.h @@ -1,7 +1,31 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// +// Copyright (c) 2006-2008, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // A collection of utilities for font handling. #ifndef FontUtilsWin_h @@ -11,28 +35,15 @@ #include <wchar.h> #include <windows.h> +#include "FontDescription.h" #include <unicode/uscript.h> namespace WebCore { -// The order of family types needs to be exactly the same as -// WebCore::FontDescription::GenericFamilyType. We may lift that restriction -// when we make webkit_glue::WebkitGenericToChromeGenericFamily more -// intelligent. -enum GenericFamilyType { - GENERIC_FAMILY_NONE = 0, - GENERIC_FAMILY_STANDARD, - GENERIC_FAMILY_SERIF, - GENERIC_FAMILY_SANSSERIF, - GENERIC_FAMILY_MONOSPACE, - GENERIC_FAMILY_CURSIVE, - GENERIC_FAMILY_FANTASY -}; - -// Return a font family that supports a script and belongs to |generic| font family. -// It can return NULL and a caller has to implement its own fallback. -const UChar* GetFontFamilyForScript(UScriptCode script, - GenericFamilyType generic); +// Return a font family that supports a script and belongs to |generic| font +// family. It can return NULL and a caller has to implement its own fallback. +const UChar* getFontFamilyForScript(UScriptCode script, + FontDescription::GenericFamilyType generic); // Return a font family that can render |characters| based on // what script characters belong to. When char_checked is non-NULL, @@ -40,11 +51,11 @@ const UChar* GetFontFamilyForScript(UScriptCode script, // When script_checked is non-NULL, the script used to determine // the family is returned. // TODO(jungshik) : This function needs a total overhaul. -const UChar* GetFallbackFamily(const UChar* characters, +const UChar* getFallbackFamily(const UChar* characters, int length, - GenericFamilyType generic, - UChar32 *char_checked, - UScriptCode *script_checked); + FontDescription::GenericFamilyType generic, + UChar32 *charChecked, + UScriptCode *scriptChecked); // Derive a new HFONT by replacing lfFaceName of LOGFONT with |family|, // calculate the ascent for the derived HFONT, and initialize SCRIPT_CACHE @@ -64,23 +75,23 @@ const UChar* GetFallbackFamily(const UChar* characters, // intl2 page-cycler test is noticeably slower with one out param than // the current version although the subsequent 9 passes take about the // same time. -bool GetDerivedFontData(const UChar *family, +bool getDerivedFontData(const UChar *family, int style, LOGFONT *logfont, int *ascent, HFONT *hfont, - SCRIPT_CACHE **script_cache); + SCRIPT_CACHE **scriptCache); enum { - FONT_STYLE_NORMAL = 0, - FONT_STYLE_BOLD = 1, - FONT_STYLE_ITALIC = 2, - FONT_STYLE_UNDERLINED = 4 + FontStyleNormal = 0, + FontStyleBold = 1, + FontStyleItalic = 2, + FontStyleUnderlined = 4 }; // Derive style (bit-wise OR of FONT_STYLE_BOLD, FONT_STYLE_UNDERLINED, and // FONT_STYLE_ITALIC) from LOGFONT. Returns 0 if |*logfont| is NULL. -int GetStyleFromLogfont(const LOGFONT *logfont); +int getStyleFromLogfont(const LOGFONT *logfont); } // namespace WebCore diff --git a/webkit/port/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp b/webkit/port/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp index bf5a6d7..1f29c88 100644 --- a/webkit/port/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp +++ b/webkit/port/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp @@ -42,14 +42,14 @@ namespace WebCore // Fills one page of font data pointers with NULL to indicate that there // are no glyphs for the characters. -static void FillEmptyGlyphs(GlyphPage* page) +static void fillEmptyGlyphs(GlyphPage* page) { for (int i = 0; i < GlyphPage::size; ++i) page->setGlyphDataForIndex(i, NULL, NULL); } // Lazily initializes space glyph -static Glyph InitSpaceGlyph(HDC dc, Glyph* space_glyph) +static Glyph initSpaceGlyph(HDC dc, Glyph* space_glyph) { if (*space_glyph) return *space_glyph; @@ -61,7 +61,7 @@ static Glyph InitSpaceGlyph(HDC dc, Glyph* space_glyph) // Fills a page of glyphs in the Basic Multilingual Plane (<= U+FFFF). We // can use the standard Windows GDI functions here. The input buffer size is // assumed to be GlyphPage::size. Returns true if any glyphs were found. -static bool FillBMPGlyphs(UChar* buffer, +static bool fillBMPGlyphs(UChar* buffer, GlyphPage* page, const SimpleFontData* fontData, bool recurse) @@ -76,9 +76,9 @@ static bool FillBMPGlyphs(UChar* buffer, if (recurse) { if (ChromiumBridge::ensureFontLoaded(fontData->m_font.hfont())) { - return FillBMPGlyphs(buffer, page, fontData, false); + return fillBMPGlyphs(buffer, page, fontData, false); } else { - FillEmptyGlyphs(page); + fillEmptyGlyphs(page); return false; } } else { @@ -86,7 +86,7 @@ static bool FillBMPGlyphs(UChar* buffer, // process and receive a crash dump. We should revisit this code later. // See bug 1136944. ASSERT_NOT_REACHED(); - FillEmptyGlyphs(page); + fillEmptyGlyphs(page); return false; } } @@ -146,13 +146,13 @@ static bool FillBMPGlyphs(UChar* buffer, if (Font::treatAsSpace(c)) { // Hard code the glyph indices for characters that should be // treated like spaces. - glyph = InitSpaceGlyph(dc, &space_glyph); + glyph = initSpaceGlyph(dc, &space_glyph); // TODO(dglazkov): change Font::treatAsZeroWidthSpace to use // u_hasBinaryProperty, per jungshik's comment here: // https://bugs.webkit.org/show_bug.cgi?id=20237#c6. // Then the additional OR won't be necessary. } else if (Font::treatAsZeroWidthSpace(c) || c == 0x200B) { - glyph = InitSpaceGlyph(dc, &space_glyph); + glyph = initSpaceGlyph(dc, &space_glyph); glyphFontData = fontData->zeroWidthFontData(); } else if (glyph == invalid_glyph) { // WebKit expects both the glyph index and FontData @@ -188,11 +188,11 @@ static bool FillBMPGlyphs(UChar* buffer, // since they may be missing. // // Returns true if any glyphs were found. -static bool FillNonBMPGlyphs(UChar* buffer, +static bool fillNonBMPGlyphs(UChar* buffer, GlyphPage* page, const SimpleFontData* fontData) { - bool have_glyphs = false; + bool haveGlyphs = false; UniscribeHelperTextRun state(buffer, GlyphPage::size * 2, false, fontData->m_font.hfont(), @@ -207,19 +207,20 @@ static bool FillNonBMPGlyphs(UChar* buffer, // (i * 2). WORD glyph = state.FirstGlyphForCharacter(i * 2); if (glyph) { - have_glyphs = true; + haveGlyphs = true; page->setGlyphDataForIndex(i, glyph, fontData); } else { // Clear both glyph and fontData fields. page->setGlyphDataForIndex(i, 0, 0); } } - return have_glyphs; + return haveGlyphs; } // We're supposed to return true if there are any glyphs in this page in our // font, false if there are none. -bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer, unsigned bufferLength, const SimpleFontData* fontData) +bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer, + unsigned bufferLength, const SimpleFontData* fontData) { // This function's parameters are kind of stupid. We always fill this page, // which is a fixed size. The source character indices are in the given @@ -229,9 +230,9 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer, u // // We have to handle BMP and non-BMP characters differently anyway... if (bufferLength == GlyphPage::size) { - return FillBMPGlyphs(characterBuffer, this, fontData, true); + return fillBMPGlyphs(characterBuffer, this, fontData, true); } else if (bufferLength == GlyphPage::size * 2) { - return FillNonBMPGlyphs(characterBuffer, this, fontData); + return fillNonBMPGlyphs(characterBuffer, this, fontData); } else { // TODO: http://b/1007391 make use of offset and length return false; diff --git a/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.cpp b/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.cpp deleted file mode 100644 index 6081d2f..0000000 --- a/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file.
-
-#include "config.h"
-
-#if ENABLE(VIDEO)
-
-#include "MediaPlayerPrivateChromium.h"
-
-namespace WebCore {
-
-MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
- : m_player(player)
- , m_networkState(MediaPlayer::Empty)
- , m_readyState(MediaPlayer::DataUnavailable)
-{
-}
-
-MediaPlayerPrivate::~MediaPlayerPrivate()
-{
-}
-
-IntSize MediaPlayerPrivate::naturalSize() const
-{
- return IntSize(0, 0);
-}
-
-bool MediaPlayerPrivate::hasVideo() const
-{
- return false;
-}
-
-void MediaPlayerPrivate::load(const String& url)
-{
- // Always fail for now
- m_networkState = MediaPlayer::LoadFailed;
- m_readyState = MediaPlayer::DataUnavailable;
- m_player->networkStateChanged();
- m_player->readyStateChanged();
-}
-
-void MediaPlayerPrivate::cancelLoad()
-{
-}
-
-void MediaPlayerPrivate::play()
-{
-}
-
-void MediaPlayerPrivate::pause()
-{
-}
-
-bool MediaPlayerPrivate::paused() const
-{
- return true;
-}
-
-bool MediaPlayerPrivate::seeking() const
-{
- return false;
-}
-
-float MediaPlayerPrivate::duration() const
-{
- return 0.0f;
-}
-
-float MediaPlayerPrivate::currentTime() const
-{
- return 0.0f;
-}
-
-void MediaPlayerPrivate::seek(float time)
-{
-}
-
-void MediaPlayerPrivate::setEndTime(float)
-{
-}
-
-void MediaPlayerPrivate::setRate(float)
-{
-}
-
-void MediaPlayerPrivate::setVolume(float)
-{
-}
-
-int MediaPlayerPrivate::dataRate() const
-{
- return 0;
-}
-
-MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const
-{
- return m_networkState;
-}
-
-MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const
-{
- return m_readyState;
-}
-
-float MediaPlayerPrivate::maxTimeBuffered() const
-{
- return 0.0f;
-}
-
-float MediaPlayerPrivate::maxTimeSeekable() const
-{
- return 0.0f;
-}
-
-unsigned MediaPlayerPrivate::bytesLoaded() const
-{
- return 0;
-}
-
-bool MediaPlayerPrivate::totalBytesKnown() const
-{
- return false;
-}
-
-unsigned MediaPlayerPrivate::totalBytes() const
-{
- return 0;
-}
-
-void MediaPlayerPrivate::setVisible(bool)
-{
-}
-
-void MediaPlayerPrivate::setRect(const IntRect&)
-{
-}
-
-void MediaPlayerPrivate::loadStateChanged()
-{
-}
-
-void MediaPlayerPrivate::didEnd()
-{
-}
-
-void MediaPlayerPrivate::paint(GraphicsContext* p, const IntRect& r)
-{
-}
-
-void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& types)
-{
- // We support nothing right now!
-}
-
-bool MediaPlayerPrivate::isAvailable()
-{
- // Must return true in order to build HTMLMedia/Video/AudioElements,
- // otherwise WebKit will replace the tags with an empty tag
- return true;
-}
-
-}
-
-#endif
diff --git a/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.h b/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.h index 06aeeb4..082b6ab 100644 --- a/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.h +++ b/webkit/port/platform/graphics/chromium/MediaPlayerPrivateChromium.h @@ -1,80 +1,98 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MediaPlayerPrivateChromium_h
-#define MediaPlayerPrivateChromium_h
-
-#if ENABLE(VIDEO)
-
-#include "MediaPlayer.h"
-
-namespace webkit_glue {
-class WebMediaPlayerDelegate;
-}
-
-namespace WebCore {
-
- class MediaPlayerPrivate : public Noncopyable {
- public:
- MediaPlayerPrivate(MediaPlayer*);
- ~MediaPlayerPrivate();
-
- IntSize naturalSize() const;
- bool hasVideo() const;
-
- void load(const String& url);
- void cancelLoad();
-
- void play();
- void pause();
-
- bool paused() const;
- bool seeking() const;
-
- float duration() const;
- float currentTime() const;
- void seek(float time);
- void setEndTime(float);
-
- void setRate(float);
- void setVolume(float);
-
- int dataRate() const;
-
- MediaPlayer::NetworkState networkState() const;
- MediaPlayer::ReadyState readyState() const;
-
- float maxTimeBuffered() const;
- float maxTimeSeekable() const;
- unsigned bytesLoaded() const;
- bool totalBytesKnown() const;
- unsigned totalBytes() const;
-
- void setVisible(bool);
- void setRect(const IntRect&);
-
- void paint(GraphicsContext*, const IntRect&);
-
- static void getSupportedTypes(HashSet<String>& types);
- static bool isAvailable();
-
- // Public methods to be called by WebMediaPlayer
- FrameView* frameView();
- void networkStateChanged();
- void readyStateChanged();
- void timeChanged();
- void volumeChanged();
- void repaint();
-
- private:
- MediaPlayer* m_player;
- // TODO(hclam): MediaPlayerPrivateChromium should not know
- // WebMediaPlayerDelegate, will need to get rid of this later.
- webkit_glue::WebMediaPlayerDelegate* m_delegate;
- };
-}
-
-#endif
-
-#endif // MediaPlayerPrivateChromium_h
+// Copyright (c) 2008, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef MediaPlayerPrivateChromium_h +#define MediaPlayerPrivateChromium_h + +#if ENABLE(VIDEO) + +#include "MediaPlayer.h" + +namespace WebCore { + + class MediaPlayerPrivate : public Noncopyable { + public: + MediaPlayerPrivate(MediaPlayer*); + ~MediaPlayerPrivate(); + + IntSize naturalSize() const; + bool hasVideo() const; + + void load(const String& url); + void cancelLoad(); + + void play(); + void pause(); + + bool paused() const; + bool seeking() const; + + float duration() const; + float currentTime() const; + void seek(float time); + void setEndTime(float); + + void setRate(float); + void setVolume(float); + + int dataRate() const; + + MediaPlayer::NetworkState networkState() const; + MediaPlayer::ReadyState readyState() const; + + float maxTimeBuffered() const; + float maxTimeSeekable() const; + unsigned bytesLoaded() const; + bool totalBytesKnown() const; + unsigned totalBytes() const; + + void setVisible(bool); + void setRect(const IntRect&); + + void paint(GraphicsContext*, const IntRect&); + + static void getSupportedTypes(HashSet<String>& types); + static bool isAvailable(); + + // Public methods to be called by WebMediaPlayer + FrameView* frameView(); + void networkStateChanged(); + void readyStateChanged(); + void timeChanged(); + void volumeChanged(); + void repaint(); + + private: + MediaPlayer* m_player; + void* m_data; + }; +} + +#endif + +#endif // MediaPlayerPrivateChromium_h diff --git a/webkit/port/platform/graphics/chromium/UniscribeHelper.cpp b/webkit/port/platform/graphics/chromium/UniscribeHelper.cpp index 6be3a10..1ace87a 100644 --- a/webkit/port/platform/graphics/chromium/UniscribeHelper.cpp +++ b/webkit/port/platform/graphics/chromium/UniscribeHelper.cpp @@ -65,7 +65,7 @@ static void SetLogFontAndStyle(HFONT hfont, LOGFONT *logfont, int *style) logfont->lfQuality = DEFAULT_QUALITY; // Honor user's desktop settings. logfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; if (style) - *style = GetStyleFromLogfont(logfont); + *style = getStyleFromLogfont(logfont); } UniscribeHelper::UniscribeHelper(const UChar* input, @@ -568,9 +568,9 @@ bool UniscribeHelper::Shape(const UChar* input, // TODO(jungshik): generic type should come from webkit for // UniscribeHelperTextRun (a derived class used in webkit). - const UChar *family = GetFallbackFamily(input, itemLength, - GENERIC_FAMILY_STANDARD, NULL, NULL); - bool font_ok = GetDerivedFontData(family, m_style, &m_logfont, + const UChar *family = getFallbackFamily(input, itemLength, + FontDescription::StandardFamily, NULL, NULL); + bool font_ok = getDerivedFontData(family, m_style, &m_logfont, &ascent, &hfont, &scriptCache); if (!font_ok) { @@ -582,7 +582,7 @@ bool UniscribeHelper::Shape(const UChar* input, TryToPreloadFont(hfont); // Try again. - font_ok = GetDerivedFontData(family, m_style, &m_logfont, + font_ok = getDerivedFontData(family, m_style, &m_logfont, &ascent, &hfont, &scriptCache); ASSERT(font_ok); } diff --git a/webkit/port/platform/graphics/chromium/UniscribeHelper.h b/webkit/port/platform/graphics/chromium/UniscribeHelper.h index 27d7961..1079e74 100644 --- a/webkit/port/platform/graphics/chromium/UniscribeHelper.h +++ b/webkit/port/platform/graphics/chromium/UniscribeHelper.h @@ -1,7 +1,31 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// +// Copyright (c) 2006-2008, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // A wrapper around Uniscribe that provides a reasonable API. #ifndef UniscribeHelper_h @@ -11,10 +35,10 @@ #include <usp10.h> #include <map> -#include "wtf/Vector.h" +#include <unicode/uchar.h> +#include <wtf/Vector.h> -#include "testing/gtest/include/gtest/gtest_prod.h" -#include "unicode/uchar.h" +class UniscribeTest_TooBig_Test; // A gunit test for UniscribeHelper. namespace WebCore { @@ -175,7 +199,7 @@ protected: virtual void TryToPreloadFont(HFONT font) {} private: - FRIEND_TEST(UniscribeTest, TooBig); + friend class UniscribeTest_TooBig_Test; // An array corresponding to each item in runs_ containing information // on each of the glyphs that were generated. Like runs_, this is in diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp index aaaba5f..87d1606 100644 --- a/webkit/port/rendering/RenderThemeWin.cpp +++ b/webkit/port/rendering/RenderThemeWin.cpp @@ -166,7 +166,7 @@ static wchar_t* defaultGUIFont(Document* document) dominantScript != USCRIPT_CYRILLIC && dominantScript != USCRIPT_GREEK && dominantScript != USCRIPT_INVALID_CODE) { - family = GetFontFamilyForScript(dominantScript, GENERIC_FAMILY_NONE); + family = getFontFamilyForScript(dominantScript, FontDescription::NoFamily); if (family) return const_cast<wchar_t*>(family); } |