summaryrefslogtreecommitdiffstats
path: root/webkit/pending
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 22:24:53 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 22:24:53 +0000
commit7451693da9a8b91ff52d4394e3f106e1687fefd2 (patch)
tree30ffa74adfc4a5fd5e30f72a1d1e05103975a095 /webkit/pending
parent4bcce52720cf373e95eb1b54f2cb72fcbecf3713 (diff)
downloadchromium_src-7451693da9a8b91ff52d4394e3f106e1687fefd2.zip
chromium_src-7451693da9a8b91ff52d4394e3f106e1687fefd2.tar.gz
chromium_src-7451693da9a8b91ff52d4394e3f106e1687fefd2.tar.bz2
This adds an additional condition on my previous patch in r183 which tried to fix box characters appearing in some pages, such as Gmail.
The problem is that the newline character is treated as a zero-width space in the old patch, but apparently WebKit relies on this turning into a space (or something, I don't totally understand). I just removed control characters from this condition since we don't actually want to change their behavior in this respect. webkit=https://bugs.webkit.org/show_bug.cgi?id=20237 BUG=1166024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/pending')
-rw-r--r--webkit/pending/SimpleFontData.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/webkit/pending/SimpleFontData.cpp b/webkit/pending/SimpleFontData.cpp
index 9f4037b..7cf3a4d 100644
--- a/webkit/pending/SimpleFontData.cpp
+++ b/webkit/pending/SimpleFontData.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "SimpleFontData.h"
+#include "Font.h"
#include "FontMetrics.h"
#if ENABLE(SVG_FONTS)
@@ -149,6 +150,21 @@ float SimpleFontData::widthForGlyph(UChar32 c, Glyph glyph) const
}
#endif
+ // Some characters should be zero width and we want to ignore whatever
+ // crazy stuff the font may have (or not defined). If the font doesn't
+ // define it, we don't want to measure the width of the "invalid character"
+ // box, for example.
+ //
+ // Note that we have to exempt control characters, which
+ // treatAsZeroWidthSpace would normally return true for. This is primarily
+ // for \n since it will be rendered as a regular space in HTML.
+ //
+ // TODO(brettw): we should have Font::treatAsZeroWidthSpace return true for
+ // zero width spaces (U+200B) just like Font::treatAsSpace will return true
+ // for spaces. Then the additional OR is not necessary.
+ if (c > ' ' && (Font::treatAsZeroWidthSpace(c) || c == 0x200b))
+ return 0.0f;
+
if (width != cGlyphWidthUnknown)
return width;