Index: third_party/WebKit/WebCore/css/CSSStyleSelector.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/css/CSSStyleSelector.cpp (revision 13094) |
+++ third_party/WebKit/WebCore/css/CSSStyleSelector.cpp (working copy) |
@@ -52,7 +52,6 @@ |
#include "Counter.h" |
#include "CounterContent.h" |
#include "FocusController.h" |
-#include "FontCache.h" |
#include "FontFamilyValue.h" |
#include "FontValue.h" |
#include "Frame.h" |
@@ -2815,30 +2814,6 @@ |
} |
} |
-struct ScriptFamilyState { |
- bool isGenericAdded; |
- bool isPerScriptGenericChecked; |
- ScriptFamilyState() : isGenericAdded(false), isPerScriptGenericChecked(false) |
- {} |
-}; |
- |
-inline static void handleScriptFamily(const char* webkitFamily, UScriptCode script, |
- FontDescription::GenericFamilyType generic, |
- AtomicString& face, ScriptFamilyState& state, FontDescription& fontDescription, |
- int& familyIndex) |
-{ |
- if (!state.isGenericAdded) { |
- face = webkitFamily; |
- state.isGenericAdded = true; |
- fontDescription.setGenericFamily(generic); |
- // go through this once more to add per-script generic family. |
- --familyIndex; |
- } else if (!state.isPerScriptGenericChecked) { |
- face = FontCache::getGenericFontForScript(script, fontDescription); |
- state.isPerScriptGenericChecked = true; |
- } |
-} |
- |
void CSSStyleSelector::applyPropertyToStyle(int id, CSSValue *value, RenderStyle* style) |
{ |
initElementAndPseudoState(0); |
@@ -4111,21 +4086,12 @@ |
bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily; |
fontDescription.setGenericFamily(FontDescription::NoFamily); |
- // |script| is used to add a font per script and per CSS generic family. |
- // Adding it here is not very efficient because we may never use it |
- // if all the characters are covered by fonts specified for this element. |
- // TODO(jungshik): Currently, it's document-wide constant inferred from |
- // the document charset, but we should infer it from the value of |
- // xml:lang or lang for |m_element|. |
- UScriptCode script = m_checker.m_document->dominantScript(); |
- // serif, sans-serif, cursive, fantasy, monospace |
- ScriptFamilyState scriptFamilyStates[5]; |
- Settings* settings = m_checker.m_document->settings(); |
for (int i = 0; i < len; i++) { |
CSSValue *item = list->itemWithoutBoundsCheck(i); |
if (!item->isPrimitiveValue()) continue; |
CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item); |
AtomicString face; |
+ Settings* settings = m_checker.m_document->settings(); |
if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING) |
face = static_cast<FontFamilyValue*>(val)->familyName(); |
else if (val->primitiveType() == CSSPrimitiveValue::CSS_IDENT && settings) { |
@@ -4133,44 +4099,25 @@ |
case CSSValueWebkitBody: |
face = settings->standardFontFamily(); |
break; |
- // For each of 5 CSS generic families, |
- // we add '-webkit-FOO' and a per-script generic family. |
- // When |Settings| becomes expressive enough to support |
- // per-script&per-generic family and we have a UI for |
- // that, we'd just add the latter. Even without that, |
- // I'm tempted to add per-script generic first, but I can't. |
- // If I did, our font-selection UI would be all but |
- // non-functional. Another issue is that we're adding |
- // these fonts without regard for actual need in page |
- // rendering. That is, it's not done in a lazy manner. |
- // Somewhere in getGlyphDataForCharacter() could be |
- // a better place in terms of performance. |
- // See https://bugs.webkit.org/show_bug.cgi?id=18085 |
- // and http://bugs.webkit.org/show_bug.cgi?id=10874 |
case CSSValueSerif: |
- handleScriptFamily("-webkit-serif", script, |
- FontDescription::SerifFamily, face, |
- scriptFamilyStates[0], fontDescription, i); |
+ face = "-webkit-serif"; |
+ fontDescription.setGenericFamily(FontDescription::SerifFamily); |
break; |
case CSSValueSansSerif: |
- handleScriptFamily("-webkit-sans-serif", script, |
- FontDescription::SansSerifFamily, face, |
- scriptFamilyStates[1], fontDescription, i); |
+ face = "-webkit-sans-serif"; |
+ fontDescription.setGenericFamily(FontDescription::SansSerifFamily); |
break; |
case CSSValueCursive: |
- handleScriptFamily("-webkit-cursive", script, |
- FontDescription::CursiveFamily, face, |
- scriptFamilyStates[2], fontDescription, i); |
+ face = "-webkit-cursive"; |
+ fontDescription.setGenericFamily(FontDescription::CursiveFamily); |
break; |
case CSSValueFantasy: |
- handleScriptFamily("-webkit-fantasy", script, |
- FontDescription::FantasyFamily, face, |
- scriptFamilyStates[3], fontDescription, i); |
+ face = "-webkit-fantasy"; |
+ fontDescription.setGenericFamily(FontDescription::FantasyFamily); |
break; |
case CSSValueMonospace: |
- handleScriptFamily("-webkit-monospace", script, |
- FontDescription::MonospaceFamily, face, |
- scriptFamilyStates[4], fontDescription, i); |
+ face = "-webkit-monospace"; |
+ fontDescription.setGenericFamily(FontDescription::MonospaceFamily); |
break; |
} |
} |
@@ -4195,29 +4142,6 @@ |
m_fontDirty = true; |
} |
} |
- |
- if (fontDescription.genericFamily() == FontDescription::NoFamily && currFamily) { |
- FontDescription::GenericFamilyType generic; |
- // TODO(jungshik) : Perhaps, we'd better add isStandardSerif() |
- // method to |Settings| which will be set via WebPreference. |
- if (settings) { |
- if (settings->serifFontFamily() == settings->standardFontFamily()) |
- generic = FontDescription::SerifFamily ; |
- else |
- generic = FontDescription::SansSerifFamily; |
- } else |
- generic = FontDescription::StandardFamily; |
- fontDescription.setGenericFamily(generic); |
- AtomicString face = FontCache::getGenericFontForScript(script, fontDescription); |
- if (!face.isEmpty()) { |
- RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); |
- newFamily->setFamily(face); |
- currFamily->appendFamily(newFamily); |
- currFamily = newFamily.get(); |
- if (m_style->setFontDescription(fontDescription)) |
- m_fontDirty = true; |
- } |
- } |
return; |
} |
case CSSPropertyTextDecoration: { |
@@ -4443,7 +4367,7 @@ |
m_lineHeightValue = 0; |
FontDescription fontDescription; |
- theme()->systemFont(primitiveValue->getIdent(), m_checker.m_document, fontDescription); |
+ theme()->systemFont(primitiveValue->getIdent(), fontDescription); |
// Double-check and see if the theme did anything. If not, don't bother updating the font. |
if (fontDescription.isAbsoluteSize()) { |