https://bugs.webkit.org/show_bug.cgi?id=81329
Patch by Matt Falkenhagen <falken@chromium.org> on 2012-03-18
Reviewed by Kent Tamura.
Source/WebCore:
Tests: fast/text/international/font-fallback-to-common-script.html
* page/Settings.cpp:
(WebCore::setGenericFontFamilyForScript): Remove the setting when the per-script font family is the empty string.
LayoutTests:
* fast/text/international/font-fallback-to-common-script-expected.html: Added.
* fast/text/international/font-fallback-to-common-script.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111157
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-18 Matt Falkenhagen <falken@chromium.org>
+
+ Fallback to common script when per-script font setting is the empty string
+ https://bugs.webkit.org/show_bug.cgi?id=81329
+
+ Reviewed by Kent Tamura.
+
+ * fast/text/international/font-fallback-to-common-script-expected.html: Added.
+ * fast/text/international/font-fallback-to-common-script.html: Added.
+
2012-03-18 Luke Macpherson <macpherson@chromium.org>
Remove remnants of code that assume Lengths are 28 bit integers.
--- /dev/null
+<html>
+<body>
+<div style="font-size: 20px">
+<div style="font-family: 'Ahem'">this is ahem font</div>
+<div style="font-family: 'Ahem'">this is ahem font</div>
+</div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+ window.internals.settings.setStandardFontFamily("Times", "Hans");
+ window.internals.settings.setStandardFontFamily("", "Hans");
+ window.internals.settings.setStandardFontFamily("Ahem", "Zyyy");
+
+ window.internals.settings.setSansSerifFontFamily("Ahem", "Zyyy");
+}
+</script>
+</head>
+<body>
+<!-- Test for font fallback to the common script when the per-script font setting is missing or the empty string.
+Bug 81329 <https://bugs.webkit.org/show_bug.cgi?id=81329> -->
+<div style="font-size: 20px">
+<div lang="zh-CN">this is ahem font</div>
+<div lang="zh-CN" style="font-family: sans-serif;">this is ahem font</div>
+</div>
+</body>
+</html>
+2012-03-18 Matt Falkenhagen <falken@chromium.org>
+
+ Fallback to common script when per-script font setting is the empty string
+ https://bugs.webkit.org/show_bug.cgi?id=81329
+
+ Reviewed by Kent Tamura.
+
+ Tests: fast/text/international/font-fallback-to-common-script.html
+
+ * page/Settings.cpp:
+ (WebCore::setGenericFontFamilyForScript): Remove the setting when the per-script font family is the empty string.
+
2012-03-18 Luke Macpherson <macpherson@chromium.org>
Remove remnants of code that assume Lengths are 28 bit integers.
frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
}
+// Sets the entry in the font map for the given script. If family is the empty string, removes the entry instead.
static inline void setGenericFontFamilyMap(ScriptFontFamilyMap& fontMap, const AtomicString& family, UScriptCode script, Page* page)
{
ScriptFontFamilyMap::iterator it = fontMap.find(static_cast<int>(script));
- if (it != fontMap.end() && it->second == family)
+ if (family.isEmpty()) {
+ if (it == fontMap.end())
+ return;
+ fontMap.remove(it);
+ } else if (it != fontMap.end() && it->second == family)
return;
- fontMap.set(static_cast<int>(script), family);
+ else
+ fontMap.set(static_cast<int>(script), family);
page->setNeedsRecalcStyleInAllFrames();
}