Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Unified Diff: third_party/WebKit/WebCore/dom/Document.cpp

Issue 56198: Roll out dominantScript, getGenericFontForScript patches to unfork a bunch of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/WebCore/dom/Document.h ('k') | third_party/WebKit/WebCore/platform/graphics/FontCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/dom/Document.cpp
===================================================================
--- third_party/WebKit/WebCore/dom/Document.cpp (revision 13094)
+++ third_party/WebKit/WebCore/dom/Document.cpp (working copy)
@@ -53,7 +53,6 @@
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FocusController.h"
-#include "FontCache.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameTree.h"
@@ -330,7 +329,6 @@
, m_useSecureKeyboardEntryWhenActive(false)
, m_isXHTML(isXHTML)
, m_numNodeListCaches(0)
- , m_dominantScript(USCRIPT_INVALID_CODE)
#if ENABLE(DATABASE)
, m_hasOpenDatabases(false)
#endif
@@ -443,7 +441,6 @@
removeAllEventListeners();
-
#if USE(JSC)
forgetAllDOMNodesForDocument(this);
#endif
@@ -871,76 +868,6 @@
decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
}
-UScriptCode Document::dominantScript() const
-{
- struct EncodingScript {
- const char* encoding;
- UScriptCode script;
- };
-
- // inputEncoding() always returns a canonical name. We use
- // MIME names and IANA names (if the former is not available).
- static const EncodingScript encodingScriptList[] = {
- { "GB2312", USCRIPT_SIMPLIFIED_HAN },
- { "GBK", USCRIPT_SIMPLIFIED_HAN },
- { "GB18030", USCRIPT_SIMPLIFIED_HAN },
- { "Big5", USCRIPT_TRADITIONAL_HAN },
- { "Big5-HKSCS", USCRIPT_TRADITIONAL_HAN },
- { "Shift_JIS", USCRIPT_HIRAGANA},
- { "EUC-JP", USCRIPT_HIRAGANA }, // Japanese (USCRIPT_JAPANESE)
- { "ISO-2022-KR", USCRIPT_HIRAGANA },
- { "EUC-KR", USCRIPT_HANGUL }, // Korean (USCRIPT_KOREAN)
- { "TIS-620", USCRIPT_THAI },
- { "ISO-8859-1", USCRIPT_LATIN },
- { "ISO-8859-15", USCRIPT_LATIN },
- { "windows-1252", USCRIPT_LATIN },
- { "ISO-8859-2", USCRIPT_LATIN },
- { "windows-1250", USCRIPT_LATIN },
- { "ISO-8859-3", USCRIPT_LATIN },
- { "ISO-8859-4", USCRIPT_LATIN },
- { "ISO-8859-13", USCRIPT_LATIN },
- { "windows-1257", USCRIPT_LATIN },
- { "ISO-8859-5", USCRIPT_CYRILLIC },
- { "windows-1251", USCRIPT_CYRILLIC },
- { "KOI8-R", USCRIPT_CYRILLIC },
- { "KOI8-U", USCRIPT_CYRILLIC },
- { "ISO-8859-6", USCRIPT_ARABIC },
- { "windows-1256", USCRIPT_ARABIC },
- { "ISO-8859-7", USCRIPT_GREEK },
- { "windows-1253", USCRIPT_GREEK },
- { "ISO-8859-8", USCRIPT_HEBREW },
- { "windows-1255", USCRIPT_HEBREW },
- { "ISO-8859-9", USCRIPT_LATIN }, // Turkish
- { "windows-1254", USCRIPT_LATIN },
- { "ISO-8859-10", USCRIPT_LATIN }, // Nordic
- { "ISO-8859-14", USCRIPT_LATIN }, // Celtic
- { "ISO-8859-16", USCRIPT_LATIN }, // Romanian
- { "windows-1258", USCRIPT_LATIN }, // Vietnamese
- };
-
- static HashMap<String, UScriptCode> encodingScriptMap;
-
- if (encodingScriptMap.isEmpty()) {
- for (unsigned i = 0; i < sizeof(encodingScriptList) / sizeof(encodingScriptList[0]); ++i)
- encodingScriptMap.set(encodingScriptList[i].encoding,
- encodingScriptList[i].script);
- }
-
- if (m_dominantScript != USCRIPT_INVALID_CODE)
- return m_dominantScript;
- String encoding = inputEncoding();
- if (encoding.isEmpty())
- return m_dominantScript;
-
- HashMap<String, UScriptCode>::iterator it = encodingScriptMap.find(encoding);
- if (it != encodingScriptMap.end())
- m_dominantScript = it->second;
- else
- // TODO(jungshik) : should return a script corresponding to the locale.
- m_dominantScript = USCRIPT_COMMON;
- return m_dominantScript;
-}
-
void Document::setXMLVersion(const String& version, ExceptionCode& ec)
{
if (!implementation()->hasFeature("XML", String())) {
@@ -1211,21 +1138,6 @@
FontDescription fontDescription;
fontDescription.setUsePrinterFont(printing());
- // TODO(jungshik): Eventually, we need to derive the dominant script
- // for the current node based on 'xml:lang' and 'lang' specified for
- // it or inherited from its parent rather than using the document-wide
- // value (inferred from charset). Note also that it does not work
- // for 'script-agnostic' charsets like UTF-8. In that case, Firefox
- // uses the script corresponding to the application locale.
- // While a document is loaded, this function is called multiple
- // times. At the beginning, the document charset is not known and
- // dominantScript remains invalid. Only when it's determined, we
- // change the font accordingly.
- // See http://bugs.webkit.org/show_bug.cgi?id=10874 and
- // https://bugs.webkit.org/show_bug.cgi?id=18085
- UScriptCode script = dominantScript();
- if (script != USCRIPT_INVALID_CODE)
- fontDescription.setDominantScript(script);
if (Settings* settings = this->settings()) {
fontDescription.setRenderingMode(settings->fontRenderingMode());
if (printing() && !settings->shouldPrintBackgrounds())
@@ -1233,23 +1145,7 @@
const AtomicString& stdfont = settings->standardFontFamily();
if (!stdfont.isEmpty()) {
fontDescription.firstFamily().setFamily(stdfont);
- FontFamily& currFamily = fontDescription.firstFamily();
- if (script != USCRIPT_INVALID_CODE) {
- // TODO(jungshik) : I might as well modify |genericFamily| of
- // |fontDescription| here, but I'm wary of a potential breakage.
- // For now, just use a temporary variable.
- FontDescription tmpDescription;
- tmpDescription.setGenericFamily(FontDescription::StandardFamily);
- AtomicString docFont = FontCache::getGenericFontForScript(
- script, tmpDescription);
- if (!docFont.isEmpty()) {
- RefPtr<SharedFontFamily> newFamily(SharedFontFamily::create());
- newFamily->setFamily(docFont);
- currFamily.appendFamily(newFamily);
- currFamily = *newFamily;
- }
- }
- currFamily.appendFamily(0);
+ fontDescription.firstFamily().appendFamily(0);
}
fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
m_styleSelector->setFontSize(fontDescription, m_styleSelector->fontSizeForKeyword(CSSValueMedium, inCompatMode(), false));
@@ -4523,7 +4419,6 @@
{
if (m_decoder)
m_decoder->encoding().displayBuffer(buffer, len);
-
}
} // namespace WebCore
« no previous file with comments | « third_party/WebKit/WebCore/dom/Document.h ('k') | third_party/WebKit/WebCore/platform/graphics/FontCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698