[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mitz at apple.com
mitz at apple.com
Wed Dec 22 13:41:24 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 78a6a0e757cdf8260a4b3f40749279e089974e20
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 23 16:18:01 2010 +0000
Address a remaining discrepancy in piecewise text measurement
https://bugs.webkit.org/show_bug.cgi?id=45796
Patch by Brad Moore <bradm at apple.com> on 2010-09-23
Reviewed by Dan Bernstein.
Don't include always-integral space widths in the floating point accumulator designed
to minimize precision loss. This brings whole-string measurement in line with piecewise
text measurement when dealing with fonts with fractional advances.
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advance): Change the associativity of width addition to minimize precision loss.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a181bd9..64f9682 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-23 Brad Moore <bradm at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Address a remaining discrepancy in piecewise text measurement
+ https://bugs.webkit.org/show_bug.cgi?id=45796
+
+ Don't include always-integral space widths in the floating point accumulator designed
+ to minimize precision loss. This brings whole-string measurement in line with piecewise
+ text measurement when dealing with fonts with fractional advances.
+
+ * platform/graphics/WidthIterator.cpp:
+ (WebCore::WidthIterator::advance): Change the associativity of width addition to minimize precision loss.
+
2010-09-23 Patrick Gansterer <paroga at webkit.org>
Reviewed by Adam Roben.
diff --git a/WebCore/platform/graphics/WidthIterator.cpp b/WebCore/platform/graphics/WidthIterator.cpp
index ef047e8..ae58918 100644
--- a/WebCore/platform/graphics/WidthIterator.cpp
+++ b/WebCore/platform/graphics/WidthIterator.cpp
@@ -212,20 +212,29 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
// Force characters that are used to determine word boundaries for the rounding hack
// to be integer width, so following words will start on an integer boundary.
- if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c))
+ if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) {
width = ceilf(width);
- // Check to see if the next character is a "rounding hack character", if so, adjust
- // width so that the total run width will be on an integer boundary.
- if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp))
- || (m_run.applyRunRounding() && currentCharacter >= m_end)) {
- float totalWidth = widthSinceLastRounding + width;
- widthSinceLastRounding = ceilf(totalWidth);
- width += widthSinceLastRounding - totalWidth;
- m_runWidthSoFar += widthSinceLastRounding;
- widthSinceLastRounding = 0;
- } else
- widthSinceLastRounding += width;
+ // Since widthSinceLastRounding can lose precision if we include measurements for
+ // preceding whitespace, we bypass it here.
+ m_runWidthSoFar += width;
+
+ // Since this is a rounding hack character, we should have reset this sum on the previous
+ // iteration.
+ ASSERT(!widthSinceLastRounding);
+ } else {
+ // Check to see if the next character is a "rounding hack character", if so, adjust
+ // width so that the total run width will be on an integer boundary.
+ if ((m_run.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp))
+ || (m_run.applyRunRounding() && currentCharacter >= m_end)) {
+ float totalWidth = widthSinceLastRounding + width;
+ widthSinceLastRounding = ceilf(totalWidth);
+ width += widthSinceLastRounding - totalWidth;
+ m_runWidthSoFar += widthSinceLastRounding;
+ widthSinceLastRounding = 0;
+ } else
+ widthSinceLastRounding += width;
+ }
if (glyphBuffer)
glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width));
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list