Diff
Modified: trunk/Source/WebCore/ChangeLog (127800 => 127801)
--- trunk/Source/WebCore/ChangeLog 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/ChangeLog 2012-09-06 23:52:46 UTC (rev 127801)
@@ -1,3 +1,77 @@
+2012-09-06 Michael Saboff <msab...@apple.com>
+
+ Add 8 bit string data path to TextRun
+ https://bugs.webkit.org/show_bug.cgi?id=95812
+
+ Reviewed by Dan Bernstein.
+
+ Added 8 bit string path to TextRun. Refactored TextRun::data() and ::characters into
+ 8 and 16 bit versions. Made corresponding changes to users of TextRun.
+ For efl, gtk, qt and win platform specific code using TextRun, only the methods have
+ been renamed and the creation of 8 bit TextRuns has been disabled via compilation
+ flags. Someone knowledgeable in those platforms will need to make corresponding changes
+ to enable 8 bit processing of TextRuns.
+
+ No changes to functionality - behavior covered by existing tests.
+
+ * platform/graphics/Font.cpp:
+ (WebCore::normalizeSpacesInternal):
+ (WebCore::Font::normalizeSpaces):
+ (WebCore::Font:normalizeSpaces):
+ (WebCore::Font::codePath):
+ (WebCore::Font::expansionOpportunityCount):
+ * platform/graphics/Font.h:
+ (WebCore::Font::characterRangeCodePath):
+ (WebCore::Font::normalizeSpaces):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::drawBidiText):
+ * platform/graphics/TextRun.cpp:
+ (ExpectedTextRunSize):
+ * platform/graphics/TextRun.h:
+ (WebCore::TextRun::TextRun):
+ (WebCore::TextRun::subRun):
+ (WebCore::TextRun::operator[]):
+ (WebCore::TextRun::data8):
+ (WebCore::TextRun::data16):
+ (WebCore::TextRun::characters8):
+ (WebCore::TextRun::characters16):
+ (WebCore::TextRun::is8Bit):
+ (WebCore::TextRun::setText):
+ (WebCore::TextRun::setCharactersLength):
+ * platform/graphics/WidthIterator.cpp:
+ (WebCore::WidthIterator::WidthIterator):
+ (WebCore::WidthIterator::advance):
+ * platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp:
+ (WebCore::HarfBuzzShaperBase::setNormalizedBuffer):
+ * platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp:
+ (WebCore::HarfBuzzShaper::HarfBuzzShaper):
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::ComplexTextController):
+ (WebCore::ComplexTextController::collectComplexTextRuns):
+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+ * platform/graphics/pango/FontPango.cpp:
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ * platform/graphics/win/UniscribeController.cpp:
+ (WebCore::UniscribeController::advance):
+ (WebCore::UniscribeController::shapeAndPlaceItem):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computeCanUseSimpleFontCodePath):
+ * rendering/svg/SVGTextMetrics.cpp:
+ (WebCore::SVGTextMetrics::SVGTextMetrics):
+ * rendering/svg/SVGTextMetricsBuilder.cpp:
+ (WebCore::SVGTextMetricsBuilder::SVGTextMetricsBuilder):
+ (WebCore::SVGTextMetricsBuilder::measureTextRenderer):
+ * svg/SVGFontData.cpp:
+ (WebCore::SVGFontData::applySVGGlyphSelection):
+
2012-09-06 James Robinson <jam...@chromium.org>
[chromium] Don't link cc in to WebKit.dll when use_libcc_for_compositor=1
@@ -2066,7 +2140,6 @@
(WebCore::RTCPeerConnectionHandlerDummy::RTCPeerConnectionHandlerDummy):
Use ASSERT_UNUSED() to suppress -Wunused-private-field warning
->>>>>>> .r127747
2012-09-05 Patrick Gansterer <par...@webkit.org>
Build fix for Windows.
@@ -2118,6 +2191,7 @@
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
+>>>>>>> .r127797
2012-09-05 Bruno de Oliveira Abinader <bruno.abina...@basyskom.com>
Make RenderStyle::colorIncludingFallback use private getters
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -244,17 +244,28 @@
return offsetForPositionForComplexText(run, x, includePartialGlyphs);
}
-String Font::normalizeSpaces(const UChar* characters, unsigned length)
+template <typename CharacterType>
+static inline String normalizeSpacesInternal(const CharacterType* characters, unsigned length)
{
StringBuilder normalized;
normalized.reserveCapacity(length);
for (unsigned i = 0; i < length; ++i)
- normalized.append(normalizeSpaces(characters[i]));
+ normalized.append(Font::normalizeSpaces(characters[i]));
return normalized.toString();
}
+String Font::normalizeSpaces(const LChar* characters, unsigned length)
+{
+ return normalizeSpacesInternal(characters, length);
+}
+
+String Font::normalizeSpaces(const UChar* characters, unsigned length)
+{
+ return normalizeSpacesInternal(characters, length);
+}
+
static bool shouldUseFontSmoothing = true;
void Font::setShouldUseSmoothing(bool shouldUseSmoothing)
@@ -297,8 +308,11 @@
if (!run.characterScanForCodePath())
return Simple;
+ if (run.is8Bit())
+ return Simple;
+
// Start from 0 since drawing and highlighting also measure the characters before run->from.
- return characterRangeCodePath(run.characters(), run.length());
+ return characterRangeCodePath(run.characters16(), run.length());
}
Font::CodePath Font::characterRangeCodePath(const UChar* characters, unsigned len)
@@ -557,6 +571,29 @@
return isCJKIdeograph(c);
}
+unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
+{
+ unsigned count = 0;
+ if (direction == LTR) {
+ for (size_t i = 0; i < length; ++i) {
+ if (treatAsSpace(characters[i])) {
+ count++;
+ isAfterExpansion = true;
+ } else
+ isAfterExpansion = false;
+ }
+ } else {
+ for (size_t i = length; i > 0; --i) {
+ if (treatAsSpace(characters[i - 1])) {
+ count++;
+ isAfterExpansion = true;
+ } else
+ isAfterExpansion = false;
+ }
+ }
+ return count;
+}
+
unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
{
static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText();
Modified: trunk/Source/WebCore/platform/graphics/Font.h (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/Font.h 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2012-09-06 23:52:46 UTC (rev 127801)
@@ -183,6 +183,7 @@
static bool isCJKIdeograph(UChar32);
static bool isCJKIdeographOrSymbol(UChar32);
+ static unsigned expansionOpportunityCount(const LChar*, size_t length, TextDirection, bool& isAfterExpansion);
static unsigned expansionOpportunityCount(const UChar*, size_t length, TextDirection, bool& isAfterExpansion);
#if PLATFORM(QT)
@@ -195,6 +196,7 @@
enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow };
CodePath codePath(const TextRun&) const;
+ static CodePath characterRangeCodePath(const LChar*, unsigned) { return Simple; }
static CodePath characterRangeCodePath(const UChar*, unsigned len);
private:
@@ -256,6 +258,7 @@
return character;
}
+ static String normalizeSpaces(const LChar*, unsigned length);
static String normalizeSpaces(const UChar*, unsigned length);
bool needsTranscoding() const { return m_needsTranscoding; }
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -413,8 +413,7 @@
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiRuns.firstRun();
while (bidiRun) {
- TextRun subrun = run;
- subrun.setText(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
+ TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
Modified: trunk/Source/WebCore/platform/graphics/TextRun.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/TextRun.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/TextRun.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -36,7 +36,7 @@
float float2;
#endif
float float3;
- uint32_t bitfields : 9;
+ uint32_t bitfields : 10;
unsigned anUnsigned;
RefPtr<TextRun::RenderingContext> renderingContext;
};
Modified: trunk/Source/WebCore/platform/graphics/TextRun.h (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/TextRun.h 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/TextRun.h 2012-09-06 23:52:46 UTC (rev 127801)
@@ -58,9 +58,9 @@
typedef unsigned RoundingHacks;
- TextRun(const UChar* c, int len, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
- : m_characters(c)
- , m_charactersLength(len)
+#if PLATFORM(MAC)
+ TextRun(const LChar* c, unsigned len, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
+ : m_charactersLength(len)
, m_len(len)
, m_xpos(xpos)
#if ENABLE(SVG)
@@ -68,6 +68,7 @@
#endif
, m_expansion(expansion)
, m_expansionBehavior(expansionBehavior)
+ , m_is8Bit(true)
, m_allowTabs(false)
, m_direction(direction)
, m_directionalOverride(directionalOverride)
@@ -77,11 +78,34 @@
, m_disableSpacing(false)
, m_tabSize(0)
{
+ m_data.characters8 = c;
}
+#endif
+ TextRun(const UChar* c, unsigned len, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
+ : m_charactersLength(len)
+ , m_len(len)
+ , m_xpos(xpos)
+#if ENABLE(SVG)
+ , m_horizontalGlyphStretch(1)
+#endif
+ , m_expansion(expansion)
+ , m_expansionBehavior(expansionBehavior)
+ , m_is8Bit(false)
+ , m_allowTabs(false)
+ , m_direction(direction)
+ , m_directionalOverride(directionalOverride)
+ , m_characterScanForCodePath(characterScanForCodePath)
+ , m_applyRunRounding((roundingHacks & RunRounding) && s_allowsRoundingHacks)
+ , m_applyWordRounding((roundingHacks & WordRounding) && s_allowsRoundingHacks)
+ , m_disableSpacing(false)
+ , m_tabSize(0)
+ {
+ m_data.characters16 = c;
+ }
+
TextRun(const String& s, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
- : m_characters(s.characters())
- , m_charactersLength(s.length())
+ : m_charactersLength(s.length())
, m_len(s.length())
, m_xpos(xpos)
#if ENABLE(SVG)
@@ -98,17 +122,52 @@
, m_disableSpacing(false)
, m_tabSize(0)
{
+#if PLATFORM(MAC)
+ if (m_charactersLength && s.is8Bit()) {
+ m_data.characters16 = s.characters();
+ m_is8Bit = false;
+// FIXME: Change this to:
+// m_data.characters8 = s.characters8();
+// m_is8Bit = true;
+// when other 8 bit rendering changes are landed.
+ } else {
+ m_data.characters16 = s.characters();
+ m_is8Bit = false;
+ }
+#else
+ m_data.characters16 = s.characters();
+ m_is8Bit = false;
+#endif
}
- UChar operator[](int i) const { ASSERT(i >= 0 && i < m_len); return m_characters[i]; }
- const UChar* data(int i) const { ASSERT(i >= 0 && i < m_len); return &m_characters[i]; }
+ TextRun subRun(unsigned startOffset, unsigned length) const
+ {
+ ASSERT(startOffset < m_len);
- const UChar* characters() const { return m_characters; }
+ TextRun result = *this;
+
+ if (is8Bit())
+ result.setText(data8(startOffset), length);
+ else
+ result.setText(data16(startOffset), length);
+
+ return result;
+ }
+
+ UChar operator[](unsigned i) const { ASSERT(i < m_len); return is8Bit() ? m_data.characters8[i] :m_data.characters16[i]; }
+ const LChar* data8(unsigned i) const { ASSERT(i < m_len); ASSERT(is8Bit()); return &m_data.characters8[i]; }
+ const UChar* data16(unsigned i) const { ASSERT(i < m_len); ASSERT(!is8Bit()); return &m_data.characters16[i]; }
+
+ const LChar* characters8() const { ASSERT(is8Bit()); return m_data.characters8; }
+ const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.characters16; }
+
+ bool is8Bit() const { return m_is8Bit; }
int length() const { return m_len; }
int charactersLength() const { return m_charactersLength; }
- void setText(const UChar* c, int len) { m_characters = c; m_len = len; }
- void setCharactersLength(int charactersLength) { m_charactersLength = charactersLength; }
+ void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
+ void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;}
+ void setCharactersLength(unsigned charactersLength) { m_charactersLength = charactersLength; }
#if ENABLE(SVG)
float horizontalGlyphStretch() const { return m_horizontalGlyphStretch; }
@@ -159,9 +218,12 @@
private:
static bool s_allowsRoundingHacks;
- const UChar* m_characters;
- int m_charactersLength; // Marks the end of the m_characters buffer. Default equals to m_len.
- int m_len;
+ union {
+ const LChar* characters8;
+ const UChar* characters16;
+ } m_data;
+ unsigned m_charactersLength; // Marks the end of the characters buffer. Default equals to m_len.
+ unsigned m_len;
// m_xpos is the x position relative to the left start of the text line, not relative to the left
// start of the containing block. In the case of right alignment or center alignment, left start of
@@ -173,6 +235,7 @@
float m_expansion;
ExpansionBehavior m_expansionBehavior : 2;
+ unsigned m_is8Bit : 1;
unsigned m_allowTabs : 1;
unsigned m_direction : 1;
unsigned m_directionalOverride : 1; // Was this direction set by an override character.
Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -57,7 +57,7 @@
m_expansionPerOpportunity = 0;
else {
bool isAfterExpansion = m_isAfterExpansion;
- unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters(), m_run.length(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
+ unsigned expansionOpportunityCount = m_run.is8Bit() ? Font::expansionOpportunityCount(m_run.characters8(), m_run.length(), m_run.ltr() ? LTR : RTL, isAfterExpansion) : Font::expansionOpportunityCount(m_run.characters16(), m_run.length(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
@@ -106,7 +106,7 @@
UChar32 character = 0;
unsigned clusterLength = 0;
- SurrogatePairAwareTextIterator textIterator(m_run.data(m_currentCharacter), m_currentCharacter, offset, m_run.length());
+ SurrogatePairAwareTextIterator textIterator(m_run.data16(m_currentCharacter), m_currentCharacter, offset, m_run.length());
while (textIterator.consume(character, clusterLength)) {
unsigned advanceLength = clusterLength;
const GlyphData& glyphData = glyphDataForCharacter(character, rtl, textIterator.currentCharacter(), advanceLength);
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -97,7 +97,7 @@
for (int i = 0; i < m_run.length(); ++i) {
UChar ch = m_run[i];
if (::ublock_getCode(ch) == UBLOCK_COMBINING_DIACRITICAL_MARKS) {
- icu::Normalizer::normalize(icu::UnicodeString(m_run.characters(),
+ icu::Normalizer::normalize(icu::UnicodeString(m_run.characters16(),
m_run.length()), UNORM_NFC, 0 /* no options */,
normalizedString, error);
if (U_FAILURE(error))
@@ -109,7 +109,7 @@
const UChar* sourceText;
if (normalizedString.isEmpty()) {
m_normalizedBufferLength = m_run.length();
- sourceText = m_run.characters();
+ sourceText = m_run.characters16();
} else {
m_normalizedBufferLength = normalizedString.length();
sourceText = normalizedString.getBuffer();
Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -172,7 +172,7 @@
{
m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
m_normalizedBufferLength = m_run.length();
- normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength);
+ normalizeCharacters(m_run.characters16(), m_normalizedBuffer.get(), m_normalizedBufferLength);
setPadding(m_run.expansion());
setFontFeatures();
}
Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -147,7 +147,7 @@
m_expansionPerOpportunity = 0;
else {
bool isAfterExpansion = m_afterExpansion;
- unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters(), m_end, m_run.ltr() ? LTR : RTL, isAfterExpansion);
+ unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters16(), m_end, m_run.ltr() ? LTR : RTL, isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
@@ -289,7 +289,7 @@
return;
// We break up glyph run generation for the string by FontData.
- const UChar* cp = m_run.characters();
+ const UChar* cp = m_run.characters16();
if (m_font.isSmallCaps())
m_smallCapsBuffer.resize(m_end);
@@ -635,7 +635,7 @@
m_afterExpansion = false;
// Account for word-spacing.
- if (treatAsSpace && characterIndex > 0 && !Font::treatAsSpace(*m_run.data(characterIndex - 1)) && m_font.wordSpacing())
+ if (treatAsSpace && characterIndex > 0 && !Font::treatAsSpace(m_run[characterIndex - 1]) && m_font.wordSpacing())
advance.width += m_font.wordSpacing();
} else
m_afterExpansion = false;
Modified: trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/pango/FontPango.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -292,7 +292,7 @@
PangoLayout* layout = pango_cairo_create_layout(cr);
setPangoAttributes(this, run, layout);
- gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
+ gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
pango_layout_set_text(layout, utf8, -1);
// Our layouts are single line
@@ -380,7 +380,7 @@
PangoLayout* layout = getDefaultPangoLayout(run);
setPangoAttributes(this, run, layout);
- gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
+ gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
pango_layout_set_text(layout, utf8, -1);
int width;
@@ -405,7 +405,7 @@
PangoLayout* layout = getDefaultPangoLayout(run);
setPangoAttributes(this, run, layout);
- gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
+ gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
pango_layout_set_text(layout, utf8, -1);
int index, trailing;
@@ -430,7 +430,7 @@
PangoLayout* layout = getDefaultPangoLayout(run);
setPangoAttributes(this, run, layout);
- gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
+ gchar* utf8 = convertUniCharToUTF8(run.characters16(), run.length(), 0, run.length());
pango_layout_set_text(layout, utf8, -1);
char* start = g_utf8_offset_to_pointer(utf8, from);
Modified: trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -178,7 +178,7 @@
void Font::drawComplexText(GraphicsContext* ctx, const TextRun& run, const FloatPoint& point, int from, int to) const
{
- String sanitized = Font::normalizeSpaces(run.characters(), run.length());
+ String sanitized = Font::normalizeSpaces(run.characters16(), run.length());
const QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string);
layout.setRawFont(rawFont());
@@ -201,7 +201,7 @@
if (run.length() == 1 && treatAsSpace(run[0]))
return primaryFont()->spaceWidth() + run.expansion();
- String sanitized = Font::normalizeSpaces(run.characters(), run.length());
+ String sanitized = Font::normalizeSpaces(run.characters16(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string);
@@ -217,7 +217,7 @@
int Font::offsetForPositionForComplexText(const TextRun& run, float position, bool) const
{
- String sanitized = Font::normalizeSpaces(run.characters(), run.length());
+ String sanitized = Font::normalizeSpaces(run.characters16(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string);
@@ -229,7 +229,7 @@
FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& pt, int h, int from, int to) const
{
- String sanitized = Font::normalizeSpaces(run.characters(), run.length());
+ String sanitized = Font::normalizeSpaces(run.characters16(), run.length());
QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string);
Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (127800 => 127801)
--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -109,7 +109,7 @@
return;
// Itemize the string.
- const UChar* cp = m_run.data(m_currentCharacter);
+ const UChar* cp = m_run.data16(m_currentCharacter);
unsigned baseCharacter = m_currentCharacter;
// We break up itemization of the string by fontData and (if needed) the use of small caps.
@@ -330,7 +330,7 @@
}
// Account for word-spacing.
- if (characterIndex > 0 && !Font::treatAsSpace(*m_run.data(characterIndex - 1)) && m_font.wordSpacing())
+ if (characterIndex > 0 && !Font::treatAsSpace(*m_run.data16(characterIndex - 1)) && m_font.wordSpacing())
advance += m_font.wordSpacing();
}
}
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (127800 => 127801)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -1879,7 +1879,7 @@
bool RenderText::computeCanUseSimpleFontCodePath() const
{
- if (isAllASCII())
+ if (isAllASCII() || m_text.is8Bit())
return true;
return Font::characterRangeCodePath(characters(), length()) == Font::Simple;
}
Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp (127800 => 127801)
--- trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -56,7 +56,7 @@
m_width = scaledFont.width(run, length, m_glyph.name) / scalingFactor;
m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
- m_glyph.unicodeString = String(run.characters(), length);
+ m_glyph.unicodeString = run.is8Bit() ? String(run.characters8(), length) : String(run.characters16(), length);
m_glyph.isValid = true;
ASSERT(length >= 0);
Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp (127800 => 127801)
--- trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -30,7 +30,7 @@
SVGTextMetricsBuilder::SVGTextMetricsBuilder()
: m_text(0)
- , m_run(0, 0)
+ , m_run(static_cast<const UChar*>(0), 0)
, m_textPosition(0)
, m_isComplexText(false)
, m_totalWidth(0)
@@ -148,7 +148,7 @@
int surrogatePairCharacters = 0;
while (advance()) {
- const UChar* currentCharacter = m_run.data(m_textPosition);
+ const UChar* currentCharacter = m_run.data16(m_textPosition);
if (*currentCharacter == ' ' && !preserveWhiteSpace && (!data->lastCharacter || *data->lastCharacter == ' ')) {
if (data->processRenderer)
textMetricsValues->append(SVGTextMetrics(SVGTextMetrics::SkippedSpaceMetrics));
Modified: trunk/Source/WebCore/svg/SVGFontData.cpp (127800 => 127801)
--- trunk/Source/WebCore/svg/SVGFontData.cpp 2012-09-06 23:50:59 UTC (rev 127800)
+++ trunk/Source/WebCore/svg/SVGFontData.cpp 2012-09-06 23:52:46 UTC (rev 127801)
@@ -134,7 +134,7 @@
ASSERT(int(run.charactersLength()) >= currentCharacter);
// Associate text with arabic forms, if needed.
- String remainingTextInRun(run.data(currentCharacter), run.charactersLength() - currentCharacter);
+ String remainingTextInRun(run.data16(currentCharacter), run.charactersLength() - currentCharacter);
remainingTextInRun = Font::normalizeSpaces(remainingTextInRun.characters(), remainingTextInRun.length());
if (mirror)
remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun.characters(), remainingTextInRun.length());