Title: [111157] trunk
- Revision
- 111157
- Author
- commit-qu...@webkit.org
- Date
- 2012-03-18 23:58:19 -0700 (Sun, 18 Mar 2012)
Log Message
Fallback to common script when per-script font setting is the empty string
https://bugs.webkit.org/show_bug.cgi?id=81329
Patch by Matt Falkenhagen <fal...@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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (111156 => 111157)
--- trunk/LayoutTests/ChangeLog 2012-03-19 06:37:54 UTC (rev 111156)
+++ trunk/LayoutTests/ChangeLog 2012-03-19 06:58:19 UTC (rev 111157)
@@ -1,3 +1,13 @@
+2012-03-18 Matt Falkenhagen <fal...@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 <macpher...@chromium.org>
Remove remnants of code that assume Lengths are 28 bit integers.
Added: trunk/LayoutTests/fast/text/international/font-fallback-to-common-script-expected.html (0 => 111157)
--- trunk/LayoutTests/fast/text/international/font-fallback-to-common-script-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/font-fallback-to-common-script-expected.html 2012-03-19 06:58:19 UTC (rev 111157)
@@ -0,0 +1,8 @@
+<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>
Added: trunk/LayoutTests/fast/text/international/font-fallback-to-common-script.html (0 => 111157)
--- trunk/LayoutTests/fast/text/international/font-fallback-to-common-script.html (rev 0)
+++ trunk/LayoutTests/fast/text/international/font-fallback-to-common-script.html 2012-03-19 06:58:19 UTC (rev 111157)
@@ -0,0 +1,22 @@
+<!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>
Modified: trunk/Source/WebCore/ChangeLog (111156 => 111157)
--- trunk/Source/WebCore/ChangeLog 2012-03-19 06:37:54 UTC (rev 111156)
+++ trunk/Source/WebCore/ChangeLog 2012-03-19 06:58:19 UTC (rev 111157)
@@ -1,3 +1,15 @@
+2012-03-18 Matt Falkenhagen <fal...@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 <macpher...@chromium.org>
Remove remnants of code that assume Lengths are 28 bit integers.
Modified: trunk/Source/WebCore/page/Settings.cpp (111156 => 111157)
--- trunk/Source/WebCore/page/Settings.cpp 2012-03-19 06:37:54 UTC (rev 111156)
+++ trunk/Source/WebCore/page/Settings.cpp 2012-03-19 06:58:19 UTC (rev 111157)
@@ -52,12 +52,18 @@
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();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes