[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
bdakin at apple.com
bdakin at apple.com
Thu Oct 29 20:37:39 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 3a72daae9f96d8850f40e33e44cb9d8c9ea23e58
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 1 19:19:34 2009 +0000
WebCore: Fix for <rdar://problem/6934421> Support CSS for Text Kerning and
ligature
-and corresponding-
https://bugs.webkit.org/show_bug.cgi?id=6136
Reviewed by Dave Hyatt.
This patch makes the SVG CSS property text-rendering work with any
HTML, much like it does in Firefox. It accepts four possible input
values: auto, optimizeSpeed, optimizeLegibility, and
geometricPrecision. Right now, in this implementation, here is what
those values correspond to:
auto = optimizeSpeed = what we normally when the value's not set
optimizeLegibility = geometricPrecision = ligatures + kerning
Add new file TextRenderingMode.h to the project files.
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
CSS support for the new CSSPropertyTextRendering
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TextRenderingMode):
* css/CSSPropertyNames.in:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* css/CSSValueKeywords.in:
All the old SVG CSS support for this property can go away. When
it's used in SVG, it will just fall into the normal HTML case.
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parseSVGValue):
* css/SVGCSSPropertyNames.in:
* css/SVGCSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applySVGProperty):
* css/SVGCSSValueKeywords.in:
FontDescription stores the m_textRendering bit.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription):
(WebCore::FontDescription::textRenderingMode):
(WebCore::FontDescription::setTextRenderingMode):
(WebCore::FontDescription::operator==):
We want to fall into the complex text rendering code path if
kerning and ligatures have been enabled with this property.
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::canUseGlyphCache):
Now takes a TextRenderingMode as a parameter.
* platform/graphics/SimpleFontData.h:
New header for the enum.
* platform/graphics/TextRenderingMode.h: Added.
(WebCore::):
getCFStringAttributes() now takes a TextRenderingMode as an
attribute.
* platform/graphics/mac/CoreTextController.cpp:
(WebCore::CoreTextController::collectCoreTextRunsForCharacters):
Enable kerning and ligatures whenever the TextRenderingMode is
OptimizeLegibility or GeometricPrecision
* platform/graphics/mac/FontMacATSUI.mm:
(WebCore::disableLigatures):
(WebCore::initializeATSUStyle):
(WebCore::ATSULayoutParameters::initialize):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::getCFStringAttributes):
More SVG CSS stuff that isn't needed anymore since SVG will use the
new HTML CSS implementation.
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::InheritedFlags::operator==):
(WebCore::SVGRenderStyle::setBitDefaults):
* rendering/style/SVGRenderStyleDefs.h:
LayoutTests: Tests for <rdar://problem/6934421> Support CSS for Text Kerning and
ligature
-and corresponding-
https://bugs.webkit.org/show_bug.cgi?id=6136
Reviewed by Dave Hyatt.
New tests.
* fast/css/parsing-text-rendering-expected.txt: Added.
* fast/css/parsing-text-rendering.html: Added.
* fast/css/resources/parsing-text-rendering.js: Added.
(test):
* fast/css/text-rendering.html: Added.
* platform/mac/fast/css/text-rendering-expected.checksum: Added.
* platform/mac/fast/css/text-rendering-expected.png: Added.
* platform/mac/fast/css/text-rendering-expected.txt: Added.
New and improved results.
* platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum:
* platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png:
* platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c870040..c02664f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,30 @@
+2009-10-01 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Tests for <rdar://problem/6934421> Support CSS for Text Kerning and
+ ligature
+ -and corresponding-
+ https://bugs.webkit.org/show_bug.cgi?id=6136
+
+ New tests.
+ * fast/css/parsing-text-rendering-expected.txt: Added.
+ * fast/css/parsing-text-rendering.html: Added.
+ * fast/css/resources/parsing-text-rendering.js: Added.
+ (test):
+ * fast/css/text-rendering.html: Added.
+ * platform/mac/fast/css/text-rendering-expected.checksum: Added.
+ * platform/mac/fast/css/text-rendering-expected.png: Added.
+ * platform/mac/fast/css/text-rendering-expected.txt: Added.
+
+ New and improved results.
+ * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum:
+ * platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png:
+ * platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt:
+ * svg/css/getComputedStyle-basic-expected.txt:
+
2009-10-01 Nate Chapin <japhet at chromium.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/css/parsing-text-rendering-expected.txt b/LayoutTests/fast/css/parsing-text-rendering-expected.txt
new file mode 100644
index 0000000..aab2602
--- /dev/null
+++ b/LayoutTests/fast/css/parsing-text-rendering-expected.txt
@@ -0,0 +1,16 @@
+This tests checks that all of the input values for background-repeat parse correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test("text-rendering: auto;") is "auto"
+PASS test("text-rendering: optimizeSpeed;") is "optimizespeed"
+PASS test("text-rendering: optimizeLegibility;") is "optimizelegibility"
+PASS test("text-rendering: geometricPrecision;") is "geometricprecision"
+PASS test("text-rendering: auto auto;") is null
+PASS test("text-rendering: optimizeCoconuts;") is null
+PASS test("text-rendering: 15;") is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/parsing-text-rendering.html b/LayoutTests/fast/css/parsing-text-rendering.html
new file mode 100644
index 0000000..c1a9e6a
--- /dev/null
+++ b/LayoutTests/fast/css/parsing-text-rendering.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/parsing-text-rendering.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/css/resources/parsing-text-rendering.js b/LayoutTests/fast/css/resources/parsing-text-rendering.js
new file mode 100644
index 0000000..74ecdb0
--- /dev/null
+++ b/LayoutTests/fast/css/resources/parsing-text-rendering.js
@@ -0,0 +1,23 @@
+description("This tests checks that all of the input values for background-repeat parse correctly.");
+
+function test(value)
+{
+ var div = document.createElement("div");
+ div.setAttribute("style", value);
+ document.body.appendChild(div);
+
+ var result = div.style.getPropertyValue("text-rendering");
+ document.body.removeChild(div);
+ return result;
+}
+
+shouldBe('test("text-rendering: auto;")', '"auto"');
+shouldBe('test("text-rendering: optimizeSpeed;")', '"optimizespeed"');
+shouldBe('test("text-rendering: optimizeLegibility;")', '"optimizelegibility"');
+shouldBe('test("text-rendering: geometricPrecision;")', '"geometricprecision"');
+
+shouldBeNull('test("text-rendering: auto auto;")');
+shouldBeNull('test("text-rendering: optimizeCoconuts;")');
+shouldBeNull('test("text-rendering: 15;")');
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/css/text-rendering.html b/LayoutTests/fast/css/text-rendering.html
new file mode 100644
index 0000000..be1c403
--- /dev/null
+++ b/LayoutTests/fast/css/text-rendering.html
@@ -0,0 +1,8 @@
+<span style="font-size:60px; text-rendering: auto">fin LYAWA (No kerning or ligatures)</span>
+<br>
+<span style="font-size:60px; text-rendering: optimizeSpeed">fin LYAWA (No kerning or ligatures)</span>
+<br>
+<span style="font-size:60px; text-rendering: optimizeLegibility">fin LYAWA (Kerning and ligatures)</span>
+<br>
+<span style="font-size:60px; text-rendering: geometricPrecision">fin LYAWA (Kerning and ligatures)</span>
+<br>
diff --git a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
index 25da2ce..3a30015 100644
--- a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
@@ -78,6 +78,7 @@ table-layout: auto;
text-align: auto;
text-decoration: none;
text-indent: 0px;
+text-rendering: auto;
text-shadow: none;
text-overflow: clip;
text-transform: none;
@@ -195,7 +196,6 @@ stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-opacity: 1;
stroke-width: ;
-text-rendering: auto;
alignment-baseline: auto;
baseline-shift: baseline;
dominant-baseline: auto;
diff --git a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
index c01c7f9..fdd123e 100644
--- a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
@@ -77,6 +77,7 @@ Computed style of an element whose parent's 'display' value is 'none':
text-align: auto
text-decoration: none
text-indent: 0px
+ text-rendering: auto
text-shadow: none
text-overflow: clip
text-transform: none
@@ -194,7 +195,6 @@ Computed style of an element whose parent's 'display' value is 'none':
stroke-miterlimit: 4
stroke-opacity: 1
stroke-width:
- text-rendering: auto
alignment-baseline: auto
baseline-shift: baseline
dominant-baseline: auto
diff --git a/LayoutTests/platform/mac/fast/css/text-rendering-expected.checksum b/LayoutTests/platform/mac/fast/css/text-rendering-expected.checksum
new file mode 100644
index 0000000..cce15c7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/text-rendering-expected.checksum
@@ -0,0 +1 @@
+4e5c6286a59b4a606973f7d932046bc3
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/text-rendering-expected.png b/LayoutTests/platform/mac/fast/css/text-rendering-expected.png
new file mode 100644
index 0000000..332e05c
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/text-rendering-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/text-rendering-expected.txt b/LayoutTests/platform/mac/fast/css/text-rendering-expected.txt
new file mode 100644
index 0000000..2414965
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/text-rendering-expected.txt
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderInline {SPAN} at (0,0) size 677x138
+ RenderText {#text} at (0,0) size 677x138
+ text run at (0,0) width 677: "fin LYAWA (No kerning or"
+ text run at (0,69) width 228: "ligatures)"
+ RenderText {#text} at (228,109) size 4x18
+ text run at (228,109) width 4: " "
+ RenderBR {BR} at (232,123) size 0x0
+ RenderInline {SPAN} at (0,0) size 677x138
+ RenderText {#text} at (0,138) size 677x138
+ text run at (0,138) width 677: "fin LYAWA (No kerning or"
+ text run at (0,207) width 228: "ligatures)"
+ RenderText {#text} at (228,247) size 4x18
+ text run at (228,247) width 4: " "
+ RenderBR {BR} at (232,261) size 0x0
+ RenderInline {SPAN} at (0,0) size 609x138
+ RenderText {#text} at (0,276) size 609x138
+ text run at (0,276) width 609: "fin LYAWA (Kerning and"
+ text run at (0,345) width 228: "ligatures)"
+ RenderText {#text} at (228,385) size 4x18
+ text run at (228,385) width 4: " "
+ RenderBR {BR} at (232,399) size 0x0
+ RenderInline {SPAN} at (0,0) size 609x138
+ RenderText {#text} at (0,414) size 609x138
+ text run at (0,414) width 609: "fin LYAWA (Kerning and"
+ text run at (0,483) width 228: "ligatures)"
+ RenderText {#text} at (228,523) size 4x18
+ text run at (228,523) width 4: " "
+ RenderBR {BR} at (232,537) size 0x0
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum
index cce5e05..924cd6e 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.checksum
@@ -1 +1 @@
-1469ff180d877f6e84ea57f95fe607ee
\ No newline at end of file
+f6989b1d7f0b27b4e47df6802ee1cec9
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png
index 7ad6c43..cba8221 100644
Binary files a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt
index 4ee8ace..98ea011 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-conv-01-f-expected.txt
@@ -33,7 +33,7 @@ layer at (0,0) size 480x360
RenderSVGImage {image} at (180,163) size 50x63 [filter=convolve5]
RenderSVGText {text} at (10,20) size 117x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-14) size 117x18
- chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 19 width 117.00: "Vertical blur (1x3)"
+ chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 19 width 115.00: "Vertical blur (1x3)"
RenderSVGContainer {g} at (330,163) size 50x63 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,93.00)}]
RenderSVGImage {image} at (330,163) size 50x63 [filter=convolve6]
RenderSVGText {text} at (10,340) size 264x46 contains 1 chunk(s)
diff --git a/LayoutTests/svg/css/getComputedStyle-basic-expected.txt b/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
index 59b7be2..f80ac23 100644
--- a/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
+++ b/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
@@ -154,6 +154,8 @@ rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-indent) : 0px
rect: style.getPropertyCSSValue(text-indent) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(text-rendering) : auto
+rect: style.getPropertyCSSValue(text-rendering) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-shadow) : none
rect: style.getPropertyCSSValue(text-shadow) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-overflow) : clip
@@ -388,8 +390,6 @@ rect: style.getPropertyValue(stroke-opacity) : 1
rect: style.getPropertyCSSValue(stroke-opacity) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(stroke-width) : 2px
rect: style.getPropertyCSSValue(stroke-width) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-rendering) : auto
-rect: style.getPropertyCSSValue(text-rendering) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(alignment-baseline) : auto
rect: style.getPropertyCSSValue(alignment-baseline) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(baseline-shift) : baseline
@@ -562,6 +562,8 @@ g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-indent) : 0px
g: style.getPropertyCSSValue(text-indent) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(text-rendering) : auto
+g: style.getPropertyCSSValue(text-rendering) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-shadow) : none
g: style.getPropertyCSSValue(text-shadow) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-overflow) : clip
@@ -796,8 +798,6 @@ g: style.getPropertyValue(stroke-opacity) : 1
g: style.getPropertyCSSValue(stroke-opacity) : [object CSSPrimitiveValue]
g: style.getPropertyValue(stroke-width) : 2px
g: style.getPropertyCSSValue(stroke-width) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-rendering) : auto
-g: style.getPropertyCSSValue(text-rendering) : [object CSSPrimitiveValue]
g: style.getPropertyValue(alignment-baseline) : auto
g: style.getPropertyCSSValue(alignment-baseline) : [object CSSPrimitiveValue]
g: style.getPropertyValue(baseline-shift) : baseline
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2d58f14..b06a070 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,90 @@
+2009-10-01 Beth Dakin <bdakin at apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Fix for <rdar://problem/6934421> Support CSS for Text Kerning and
+ ligature
+ -and corresponding-
+ https://bugs.webkit.org/show_bug.cgi?id=6136
+
+ This patch makes the SVG CSS property text-rendering work with any
+ HTML, much like it does in Firefox. It accepts four possible input
+ values: auto, optimizeSpeed, optimizeLegibility, and
+ geometricPrecision. Right now, in this implementation, here is what
+ those values correspond to:
+
+ auto = optimizeSpeed = what we normally when the value's not set
+ optimizeLegibility = geometricPrecision = ligatures + kerning
+
+ Add new file TextRenderingMode.h to the project files.
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+
+ CSS support for the new CSSPropertyTextRendering
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::):
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
+ * css/CSSPropertyNames.in:
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ * css/CSSValueKeywords.in:
+
+ All the old SVG CSS support for this property can go away. When
+ it's used in SVG, it will just fall into the normal HTML case.
+ * css/SVGCSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
+ * css/SVGCSSParser.cpp:
+ (WebCore::CSSParser::parseSVGValue):
+ * css/SVGCSSPropertyNames.in:
+ * css/SVGCSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applySVGProperty):
+ * css/SVGCSSValueKeywords.in:
+
+ FontDescription stores the m_textRendering bit.
+ * platform/graphics/FontDescription.h:
+ (WebCore::FontDescription::FontDescription):
+ (WebCore::FontDescription::textRenderingMode):
+ (WebCore::FontDescription::setTextRenderingMode):
+ (WebCore::FontDescription::operator==):
+
+ We want to fall into the complex text rendering code path if
+ kerning and ligatures have been enabled with this property.
+ * platform/graphics/FontFastPath.cpp:
+ (WebCore::Font::canUseGlyphCache):
+
+ Now takes a TextRenderingMode as a parameter.
+ * platform/graphics/SimpleFontData.h:
+
+ New header for the enum.
+ * platform/graphics/TextRenderingMode.h: Added.
+ (WebCore::):
+
+ getCFStringAttributes() now takes a TextRenderingMode as an
+ attribute.
+ * platform/graphics/mac/CoreTextController.cpp:
+ (WebCore::CoreTextController::collectCoreTextRunsForCharacters):
+
+ Enable kerning and ligatures whenever the TextRenderingMode is
+ OptimizeLegibility or GeometricPrecision
+ * platform/graphics/mac/FontMacATSUI.mm:
+ (WebCore::disableLigatures):
+ (WebCore::initializeATSUStyle):
+ (WebCore::ATSULayoutParameters::initialize):
+ * platform/graphics/mac/SimpleFontDataMac.mm:
+ (WebCore::SimpleFontData::getCFStringAttributes):
+
+ More SVG CSS stuff that isn't needed anymore since SVG will use the
+ new HTML CSS implementation.
+ * rendering/style/SVGRenderStyle.h:
+ (WebCore::SVGRenderStyle::InheritedFlags::operator==):
+ (WebCore::SVGRenderStyle::setBitDefaults):
+ * rendering/style/SVGRenderStyleDefs.h:
+
2009-10-01 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 4bf6689..97bb753 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -32025,6 +32025,10 @@
>
</File>
<File
+ RelativePath="..\platform\graphics\TextRenderingMode.h"
+ >
+ </File>
+ <File
RelativePath="..\WebCorePrefix.cpp"
>
<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 4746cec..701c72a 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2094,6 +2094,7 @@
9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9307F1D50AF2D59000DBA31A /* HitTestResult.cpp */; };
9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 9307F1D60AF2D59000DBA31A /* HitTestResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 930908900AF7EDE40081DF01 /* HitTestRequest.h */; };
+ 930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 930FC6891072B9280045293E /* TextRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AC09D14EE6000E61D7 /* CharsetData.cpp */; };
9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */; };
932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 932871BF0B20DEB70049035A /* PlatformMenuDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7295,6 +7296,7 @@
9307F1D50AF2D59000DBA31A /* HitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResult.cpp; sourceTree = "<group>"; };
9307F1D60AF2D59000DBA31A /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = "<group>"; };
930908900AF7EDE40081DF01 /* HitTestRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestRequest.h; sourceTree = "<group>"; };
+ 930FC6891072B9280045293E /* TextRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextRenderingMode.h; path = platform/graphics/TextRenderingMode.h; sourceTree = "<group>"; };
9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLOptionsCollection.cpp; sourceTree = "<group>"; };
932871BF0B20DEB70049035A /* PlatformMenuDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlatformMenuDescription.h; sourceTree = "<group>"; };
932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = "<group>"; };
@@ -9948,6 +9950,7 @@
034768DFFF38A50411DB9C8B /* Products */,
1CDD44660BA9C80000F90147 /* Configurations */,
449195900FBE175B00D9F824 /* Exports */,
+ 930FC6891072B9280045293E /* TextRenderingMode.h */,
);
name = WebKit;
sourceTree = "<group>";
@@ -17921,6 +17924,7 @@
7693BAD5106C2DCA007B0823 /* PluginHalterClient.h in Headers */,
BCACF3BD1072921A00C0C8A3 /* UserContentURLPattern.h in Headers */,
5DB1BC6A10715A6400EFAA49 /* TransformSource.h in Headers */,
+ 930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 2935c31..5dd9798 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -129,6 +129,7 @@ static const int computedProperties[] = {
CSSPropertyTextAlign,
CSSPropertyTextDecoration,
CSSPropertyTextIndent,
+ CSSPropertyTextRendering,
CSSPropertyTextShadow,
CSSPropertyTextOverflow,
CSSPropertyTextTransform,
@@ -252,7 +253,6 @@ static const int computedProperties[] = {
CSSPropertyStrokeMiterlimit,
CSSPropertyStrokeOpacity,
CSSPropertyStrokeWidth,
- CSSPropertyTextRendering,
CSSPropertyAlignmentBaseline,
CSSPropertyBaselineShift,
CSSPropertyDominantBaseline,
@@ -1052,6 +1052,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return CSSPrimitiveValue::create(style->textIndent());
case CSSPropertyTextShadow:
return valueForShadow(style->textShadow(), static_cast<CSSPropertyID>(propertyID));
+ case CSSPropertyTextRendering:
+ return CSSPrimitiveValue::create(style->fontDescription().textRenderingMode());
case CSSPropertyTextOverflow:
if (style->textOverflow())
return CSSPrimitiveValue::createIdentifier(CSSValueEllipsis);
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index c46bf36..a8b071f 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -1433,6 +1433,11 @@ bool CSSParser::parseValue(int propId, bool important)
id == CSSValueWave)
valid_primitive = true;
break;
+ case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision
+ if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility
+ || id == CSSValueGeometricprecision)
+ valid_primitive = true;
+ break;
case CSSPropertyTextLineThroughWidth:
case CSSPropertyTextOverlineWidth:
case CSSPropertyTextUnderlineWidth:
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index b46322d..31992f5 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -36,6 +36,7 @@
#include "RenderStyleConstants.h"
#include "SVGRenderStyleDefs.h"
#include "TextDirection.h"
+#include "TextRenderingMode.h"
#include "ThemeTypes.h"
namespace WebCore {
@@ -2241,39 +2242,39 @@ template<> inline CSSPrimitiveValue::operator ETextAnchor() const
}
}
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextRendering e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
: m_type(CSS_IDENT)
{
switch (e) {
- case TR_AUTO:
+ case AutoTextRendering:
m_value.ident = CSSValueAuto;
break;
- case TR_OPTIMIZESPEED:
+ case OptimizeSpeed:
m_value.ident = CSSValueOptimizespeed;
break;
- case TR_OPTIMIZELEGIBILITY:
+ case OptimizeLegibility:
m_value.ident = CSSValueOptimizelegibility;
break;
- case TR_GEOMETRICPRECISION:
+ case GeometricPrecision:
m_value.ident = CSSValueGeometricprecision;
break;
}
}
-template<> inline CSSPrimitiveValue::operator ETextRendering() const
+template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
{
switch (m_value.ident) {
case CSSValueAuto:
- return TR_AUTO;
+ return AutoTextRendering;
case CSSValueOptimizespeed:
- return TR_OPTIMIZESPEED;
+ return OptimizeSpeed;
case CSSValueOptimizelegibility:
- return TR_OPTIMIZELEGIBILITY;
+ return OptimizeLegibility;
case CSSValueGeometricprecision:
- return TR_GEOMETRICPRECISION;
+ return GeometricPrecision;
default:
ASSERT_NOT_REACHED();
- return TR_AUTO;
+ return AutoTextRendering;
}
}
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index 1bf526b..f927419 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -127,6 +127,7 @@ text-overline-color
text-overline-mode
text-overline-style
text-overline-width
+text-rendering
text-shadow
text-transform
text-underline
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index dc9f2e5..d4bc0ab 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -4634,7 +4634,21 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
HANDLE_INHERIT_AND_INITIAL(outlineOffset, OutlineOffset)
m_style->setOutlineOffset(primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor));
return;
-
+ case CSSPropertyTextRendering: {
+ FontDescription fontDescription = m_style->fontDescription();
+ if (isInherit)
+ fontDescription.setTextRenderingMode(m_parentStyle->fontDescription().textRenderingMode());
+ else if (isInitial)
+ fontDescription.setTextRenderingMode(AutoTextRendering);
+ else {
+ if (!primitiveValue)
+ return;
+ fontDescription.setTextRenderingMode(*primitiveValue);
+ }
+ if (m_style->setFontDescription(fontDescription))
+ m_fontDirty = true;
+ return;
+ }
case CSSPropertyTextShadow:
case CSSPropertyBoxShadow: {
if (isInherit) {
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index 791f425..c88786e 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -631,3 +631,9 @@ stroke
# none
antialiased
subpixel-antialiased
+
+# text-rendering
+#auto
+optimizeSpeed
+optimizeLegibility
+geometricPrecision
diff --git a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
index 2cd90a9..e8492d4 100644
--- a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
@@ -93,8 +93,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
return CSSPrimitiveValue::create(svgStyle->strokeMiterLimit(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyStrokeOpacity:
return CSSPrimitiveValue::create(svgStyle->strokeOpacity(), CSSPrimitiveValue::CSS_NUMBER);
- case CSSPropertyTextRendering:
- return CSSPrimitiveValue::create(svgStyle->textRendering());
case CSSPropertyAlignmentBaseline:
return CSSPrimitiveValue::create(svgStyle->alignmentBaseline());
case CSSPropertyDominantBaseline:
diff --git a/WebCore/css/SVGCSSParser.cpp b/WebCore/css/SVGCSSParser.cpp
index 04ba185..0ae9fbc 100644
--- a/WebCore/css/SVGCSSParser.cpp
+++ b/WebCore/css/SVGCSSParser.cpp
@@ -132,12 +132,6 @@ bool CSSParser::parseSVGValue(int propId, bool important)
valid_primitive = true;
break;
- case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit
- if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility ||
- id == CSSValueGeometricprecision)
- valid_primitive = true;
- break;
-
case CSSPropertyImageRendering: // auto | optimizeSpeed |
case CSSPropertyColorRendering: // optimizeQuality | inherit
if (id == CSSValueAuto || id == CSSValueOptimizespeed ||
diff --git a/WebCore/css/SVGCSSPropertyNames.in b/WebCore/css/SVGCSSPropertyNames.in
index 965fbbf..e400ffe 100644
--- a/WebCore/css/SVGCSSPropertyNames.in
+++ b/WebCore/css/SVGCSSPropertyNames.in
@@ -37,7 +37,7 @@ stroke-linejoin
stroke-miterlimit
stroke-opacity
stroke-width
-text-rendering
+# text-rendering
alignment-baseline
baseline-shift
dominant-baseline
diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp
index d326dde..b81b4f2 100644
--- a/WebCore/css/SVGCSSStyleSelector.cpp
+++ b/WebCore/css/SVGCSSStyleSelector.cpp
@@ -229,13 +229,6 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
svgstyle->setShapeRendering(*primitiveValue);
break;
}
- case CSSPropertyTextRendering:
- {
- HANDLE_INHERIT_AND_INITIAL(textRendering, TextRendering)
- if (primitiveValue)
- svgstyle->setTextRendering(*primitiveValue);
- break;
- }
// end of ident only properties
case CSSPropertyFill:
{
diff --git a/WebCore/css/SVGCSSValueKeywords.in b/WebCore/css/SVGCSSValueKeywords.in
index c866a17..152a68f 100644
--- a/WebCore/css/SVGCSSValueKeywords.in
+++ b/WebCore/css/SVGCSSValueKeywords.in
@@ -196,7 +196,7 @@ linearRGB
# CSS_PROP_COLOR_RENDERING
#auto
-optimizeSpeed
+#optimizeSpeed
optimizeQuality
## CSS_PROP_FILL
@@ -220,7 +220,7 @@ optimizeQuality
#auto
#optimizeSpeed
crispEdges
-geometricPrecision
+#geometricPrecision
# CSS_PROP_STROKE
# CSS_PROP_STROKE_DASHARRAY
@@ -238,11 +238,6 @@ bevel
# CSS_PROP_STROKE_MITERLIMIT
# CSS_PROP_STROKE_OPACITY
# CSS_PROP_STROKE_WIDTH
-# CSS_PROP_TEXT_RENDERING
-#auto
-#optimizeSpeed
-optimizeLegibility
-#geometricPrecision
# CSS_PROP_ALIGNMENT_BASELINE
#auto
diff --git a/WebCore/platform/graphics/FontDescription.h b/WebCore/platform/graphics/FontDescription.h
index a60af29..fc63db9 100644
--- a/WebCore/platform/graphics/FontDescription.h
+++ b/WebCore/platform/graphics/FontDescription.h
@@ -29,6 +29,7 @@
#include "FontRenderingMode.h"
#include "FontSmoothingMode.h"
#include "FontTraitsMask.h"
+#include "TextRenderingMode.h"
namespace WebCore {
@@ -63,6 +64,7 @@ public:
, m_renderingMode(NormalRenderingMode)
, m_keywordSize(0)
, m_fontSmoothing(AutoSmoothing)
+ , m_textRendering(AutoTextRendering)
{
}
@@ -87,6 +89,7 @@ public:
FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
unsigned keywordSize() const { return m_keywordSize; }
FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); }
+ TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); }
FontTraitsMask traitsMask() const;
@@ -102,6 +105,7 @@ public:
void setRenderingMode(FontRenderingMode mode) { m_renderingMode = mode; }
void setKeywordSize(unsigned s) { m_keywordSize = s; }
void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
+ void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
private:
FontFamily m_familyList; // The list of font families to be used.
@@ -125,6 +129,7 @@ private:
// (e.g., 13px monospace vs. 16px everything else). Sizes are 1-8 (like the HTML size values for <font>).
unsigned m_fontSmoothing : 2; // FontSmoothingMode
+ unsigned m_textRendering : 2; // TextRenderingMode
};
inline bool FontDescription::operator==(const FontDescription& other) const
@@ -140,7 +145,8 @@ inline bool FontDescription::operator==(const FontDescription& other) const
&& m_usePrinterFont == other.m_usePrinterFont
&& m_renderingMode == other.m_renderingMode
&& m_keywordSize == other.m_keywordSize
- && m_fontSmoothing == other.m_fontSmoothing;
+ && m_fontSmoothing == other.m_fontSmoothing
+ && m_textRendering == other.m_textRendering;
}
}
diff --git a/WebCore/platform/graphics/FontFastPath.cpp b/WebCore/platform/graphics/FontFastPath.cpp
index b0e39db..5246593 100644
--- a/WebCore/platform/graphics/FontFastPath.cpp
+++ b/WebCore/platform/graphics/FontFastPath.cpp
@@ -251,6 +251,10 @@ bool Font::canUseGlyphCache(const TextRun& run) const
return false;
}
+ TextRenderingMode textMode = m_fontDescription.textRenderingMode();
+ if (textMode == OptimizeLegibility || textMode == GeometricPrecision)
+ return false;
+
return true;
}
diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h
index d326658..387a5c7 100644
--- a/WebCore/platform/graphics/SimpleFontData.h
+++ b/WebCore/platform/graphics/SimpleFontData.h
@@ -28,6 +28,7 @@
#include "FontPlatformData.h"
#include "GlyphPageTreeNode.h"
#include "GlyphWidthMap.h"
+#include "TextRenderingMode.h"
#include <wtf/OwnPtr.h>
#if USE(ATSUI)
@@ -120,7 +121,7 @@ public:
#if USE(CORE_TEXT)
CTFontRef getCTFont() const;
- CFDictionaryRef getCFStringAttributes() const;
+ CFDictionaryRef getCFStringAttributes(TextRenderingMode) const;
#endif
#if USE(ATSUI)
diff --git a/WebCore/platform/graphics/TextRenderingMode.h b/WebCore/platform/graphics/TextRenderingMode.h
new file mode 100644
index 0000000..4f817a4
--- /dev/null
+++ b/WebCore/platform/graphics/TextRenderingMode.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 TextRenderingMode_h
+#define TextRenderingMode_h
+
+namespace WebCore {
+
+ enum TextRenderingMode { AutoTextRendering, OptimizeSpeed, OptimizeLegibility, GeometricPrecision };
+
+} // namespace WebCore
+
+#endif // TextRenderingMode_h
diff --git a/WebCore/platform/graphics/mac/CoreTextController.cpp b/WebCore/platform/graphics/mac/CoreTextController.cpp
index 05f29b5..b2682e4 100644
--- a/WebCore/platform/graphics/mac/CoreTextController.cpp
+++ b/WebCore/platform/graphics/mac/CoreTextController.cpp
@@ -365,7 +365,7 @@ void CoreTextController::collectCoreTextRunsForCharacters(const UChar* cp, unsig
RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(NULL, cp, length, kCFAllocatorNull));
- RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes()));
+ RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.fontDescription().textRenderingMode())));
RetainPtr<CTTypesetterRef> typesetter;
diff --git a/WebCore/platform/graphics/mac/FontMacATSUI.mm b/WebCore/platform/graphics/mac/FontMacATSUI.mm
index 35c40bf..409bda4 100644
--- a/WebCore/platform/graphics/mac/FontMacATSUI.mm
+++ b/WebCore/platform/graphics/mac/FontMacATSUI.mm
@@ -105,12 +105,12 @@ static bool fontHasMirroringInfo(ATSUFontID fontID)
return false;
}
-static void disableLigatures(const SimpleFontData* fontData)
+static void disableLigatures(const SimpleFontData* fontData, TextRenderingMode textMode)
{
// Don't be too aggressive: if the font doesn't contain 'a', then assume that any ligatures it contains are
// in characters that always go through ATSUI, and therefore allow them. Geeza Pro is an example.
// See bugzilla 5166.
- if (fontData->platformData().allowsLigatures())
+ if (textMode == OptimizeLegibility || textMode == GeometricPrecision || fontData->platformData().allowsLigatures())
return;
ATSUFontFeatureType featureTypes[] = { kLigaturesType };
@@ -120,7 +120,7 @@ static void disableLigatures(const SimpleFontData* fontData)
LOG_ERROR("ATSUSetFontFeatures failed (%d) -- ligatures remain enabled", status);
}
-static void initializeATSUStyle(const SimpleFontData* fontData)
+static void initializeATSUStyle(const SimpleFontData* fontData, TextRenderingMode textMode)
{
if (fontData->m_ATSUStyleInitialized)
return;
@@ -141,19 +141,28 @@ static void initializeATSUStyle(const SimpleFontData* fontData)
transform = CGAffineTransformConcat(transform, CGAffineTransformMake(1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, 0, 0));
Fixed fontSize = FloatToFixed(fontData->platformData().m_size);
ByteCount styleSizes[4] = { sizeof(Fixed), sizeof(ATSUFontID), sizeof(CGAffineTransform), sizeof(Fract) };
- // Turn off automatic kerning until it is supported in the CG code path (bug 6136)
- Fract kerningInhibitFactor = FloatToFract(1.0);
- ATSUAttributeTag styleTags[4] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag, kATSUKerningInhibitFactorTag };
- ATSUAttributeValuePtr styleValues[4] = { &fontSize, &fontID, &transform, &kerningInhibitFactor };
- status = ATSUSetAttributes(fontData->m_ATSUStyle, 4, styleTags, styleSizes, styleValues);
- if (status != noErr)
- LOG_ERROR("ATSUSetAttributes failed (%d)", status);
+ bool allowKerning = textMode == OptimizeLegibility || textMode == GeometricPrecision;
+ if (!allowKerning) {
+ // Turn off automatic kerning until it is supported in the CG code path (bug 6136)
+ Fract kerningInhibitFactor = FloatToFract(1.0);
+ ATSUAttributeTag styleTags[4] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag, kATSUKerningInhibitFactorTag };
+ ATSUAttributeValuePtr styleValues[4] = { &fontSize, &fontID, &transform, &kerningInhibitFactor };
+ status = ATSUSetAttributes(fontData->m_ATSUStyle, 4, styleTags, styleSizes, styleValues);
+ if (status != noErr)
+ LOG_ERROR("ATSUSetAttributes failed (%d)", status);
+ } else {
+ ATSUAttributeTag styleTags[3] = { kATSUSizeTag, kATSUFontTag, kATSUFontMatrixTag };
+ ATSUAttributeValuePtr styleValues[3] = { &fontSize, &fontID, &transform, };
+ status = ATSUSetAttributes(fontData->m_ATSUStyle, 3, styleTags, styleSizes, styleValues);
+ if (status != noErr)
+ LOG_ERROR("ATSUSetAttributes failed (%d)", status);
+ }
fontData->m_ATSUMirrors = fontHasMirroringInfo(fontID);
// Turn off ligatures such as 'fi' to match the CG code path's behavior, until bug 6135 is fixed.
- disableLigatures(fontData);
+ disableLigatures(fontData, textMode);
fontData->m_ATSUStyleInitialized = true;
}
@@ -329,7 +338,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
OSStatus status;
ATSULayoutOperationOverrideSpecifier overrideSpecifier;
- initializeATSUStyle(fontData);
+ initializeATSUStyle(fontData, m_font->fontDescription().textRenderingMode());
// FIXME: This is currently missing the following required features that the CoreGraphics code path has:
// - \n, \t, and nonbreaking space render as a space.
@@ -393,7 +402,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
const FontData* fallbackFontData = m_font->fontDataForCharacters(m_run.characters() + substituteOffset, substituteLength);
substituteFontData = fallbackFontData ? fallbackFontData->fontDataForCharacter(m_run[0]) : 0;
if (substituteFontData) {
- initializeATSUStyle(substituteFontData);
+ initializeATSUStyle(substituteFontData, m_font->fontDescription().textRenderingMode());
if (substituteFontData->m_ATSUStyle)
ATSUSetRunStyle(layout, substituteFontData->m_ATSUStyle, substituteOffset, substituteLength);
} else
@@ -412,7 +421,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
if (i == substituteOffset || i == substituteOffset + substituteLength) {
if (isSmallCap) {
isSmallCap = false;
- initializeATSUStyle(r->smallCapsFontData(m_font->fontDescription()));
+ initializeATSUStyle(r->smallCapsFontData(m_font->fontDescription()), m_font->fontDescription().textRenderingMode());
ATSUSetRunStyle(layout, r->smallCapsFontData(m_font->fontDescription())->m_ATSUStyle, firstSmallCap, i - firstSmallCap);
}
if (i == substituteOffset && substituteLength > 0)
@@ -456,7 +465,7 @@ void ATSULayoutParameters::initialize(const Font* font, const GraphicsContext* g
} else {
if (isSmallCap) {
isSmallCap = false;
- initializeATSUStyle(smallCapsData);
+ initializeATSUStyle(smallCapsData, m_font->fontDescription().textRenderingMode());
ATSUSetRunStyle(layout, smallCapsData->m_ATSUStyle, firstSmallCap, i - firstSmallCap);
}
m_fonts[i] = r;
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index acb97a7..0274d29 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -445,13 +445,13 @@ CTFontRef SimpleFontData::getCTFont() const
return m_CTFont.get();
}
-CFDictionaryRef SimpleFontData::getCFStringAttributes() const
+CFDictionaryRef SimpleFontData::getCFStringAttributes(TextRenderingMode textMode) const
{
if (m_CFStringAttributes)
return m_CFStringAttributes.get();
- static const float kerningAdjustmentValue = 0;
- static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue);
+ bool allowKerning = textMode == OptimizeLegibility || textMode == GeometricPrecision;
+ bool allowLigatures = platformData().allowsLigatures() || allowKerning;
static const int ligaturesNotAllowedValue = 0;
static CFNumberRef ligaturesNotAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesNotAllowedValue);
@@ -459,10 +459,24 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes() const
static const int ligaturesAllowedValue = 1;
static CFNumberRef ligaturesAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesAllowedValue);
- static const void* attributeKeys[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
- const void* attributeValues[] = { getCTFont(), kerningAdjustment, platformData().allowsLigatures() ? ligaturesAllowed : ligaturesNotAllowed };
-
- m_CFStringAttributes.adoptCF(CFDictionaryCreate(NULL, attributeKeys, attributeValues, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ // This is where the if would go.
+ if (!allowKerning) {
+ static const float kerningAdjustmentValue = 0;
+ static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue);
+ static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName };
+ const void* valuesWithKerningDisabled[] = { getCTFont(), kerningAdjustment, allowLigatures
+ ? ligaturesAllowed : ligaturesNotAllowed };
+ m_CFStringAttributes.adoptCF(CFDictionaryCreate(NULL, keysWithKerningDisabled, valuesWithKerningDisabled,
+ sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled),
+ &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ } else {
+ // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning.
+ static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName };
+ const void* valuesWithKerningEnabled[] = { getCTFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed };
+ m_CFStringAttributes.adoptCF(CFDictionaryCreate(NULL, keysWithKerningEnabled, valuesWithKerningEnabled,
+ sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled),
+ &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ }
return m_CFStringAttributes.get();
}
diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h
index 0e9dae4..e50d349 100644
--- a/WebCore/rendering/style/SVGRenderStyle.h
+++ b/WebCore/rendering/style/SVGRenderStyle.h
@@ -65,7 +65,6 @@ namespace WebCore {
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin)
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO)
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START)
- SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextRendering, TextRendering, textRendering, TR_AUTO)
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB)
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG)
SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO)
@@ -113,7 +112,6 @@ namespace WebCore {
return (_colorRendering == other._colorRendering) &&
(_imageRendering == other._imageRendering) &&
(_shapeRendering == other._shapeRendering) &&
- (_textRendering == other._textRendering) &&
(_clipRule == other._clipRule) &&
(_fillRule == other._fillRule) &&
(_capStyle == other._capStyle) &&
@@ -134,7 +132,6 @@ namespace WebCore {
unsigned _colorRendering : 2; // EColorRendering
unsigned _imageRendering : 2; // EImageRendering
unsigned _shapeRendering : 2; // EShapeRendering
- unsigned _textRendering : 2; // ETextRendering
unsigned _clipRule : 1; // WindRule
unsigned _fillRule : 1; // WindRule
unsigned _capStyle : 2; // LineCap
@@ -190,7 +187,6 @@ namespace WebCore {
svg_inherited_flags._fillRule = initialFillRule();
svg_inherited_flags._imageRendering = initialImageRendering();
svg_inherited_flags._shapeRendering = initialShapeRendering();
- svg_inherited_flags._textRendering = initialTextRendering();
svg_inherited_flags._textAnchor = initialTextAnchor();
svg_inherited_flags._capStyle = initialCapStyle();
svg_inherited_flags._joinStyle = initialJoinStyle();
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h
index b7bf026..c0f5d4e 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -95,10 +95,6 @@ namespace WebCore {
SR_AUTO, SR_OPTIMIZESPEED, SR_CRISPEDGES, SR_GEOMETRICPRECISION
};
- enum ETextRendering {
- TR_AUTO, TR_OPTIMIZESPEED, TR_OPTIMIZELEGIBILITY, TR_GEOMETRICPRECISION
- };
-
enum EWritingMode {
WM_LRTB, WM_LR, WM_RLTB, WM_RL, WM_TBRL, WM_TB
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list