WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
CSS3 ch unit patch
0001-Added-support-for-the-drafted-CSS3-ch-unit.patch (text/plain), 20.64 KB, created by
Sumedha Widyadharma
on 2012-07-11 00:58:19 PDT
(
hide
)
Description:
CSS3 ch unit patch
Filename:
MIME Type:
Creator:
Sumedha Widyadharma
Created:
2012-07-11 00:58:19 PDT
Size:
20.64 KB
patch
obsolete
>From d048da1ed9476726dd1977f2580aa5c004dc8d0f Mon Sep 17 00:00:00 2001 >From: Sumedha Widyadharma <sumedha.widyadharma@basyskom.de> >Date: Wed, 11 Jul 2012 09:55:50 +0200 >Subject: [PATCH] Added support for the drafted CSS3 'ch' unit > >https://bugs.webkit.org/show_bug.cgi?id=85755 >--- > LayoutTests/ChangeLog | 13 ++++++ > LayoutTests/fast/css/css3-ch-unit.html | 33 +++++++++++++++ > .../fast/css/css3-ch-unit-expected.txt | 16 +++++++ > .../platform/qt/fast/css/css3-ch-unit-expected.txt | 16 +++++++ > Source/WebCore/ChangeLog | 44 ++++++++++++++++++++ > Source/WebCore/css/CSSCalculationValue.cpp | 1 + > Source/WebCore/css/CSSGrammar.y | 4 +- > Source/WebCore/css/CSSParser.cpp | 9 +++- > Source/WebCore/css/CSSParserValues.cpp | 2 +- > Source/WebCore/css/CSSPrimitiveValue.cpp | 9 ++++ > Source/WebCore/css/CSSPrimitiveValue.h | 22 ++++++---- > Source/WebCore/platform/graphics/Font.h | 1 + > .../WebCore/platform/graphics/SimpleFontData.cpp | 4 ++ > Source/WebCore/platform/graphics/SimpleFontData.h | 5 ++ > .../platform/graphics/qt/SimpleFontDataQt.cpp | 7 +++ > 15 files changed, 173 insertions(+), 13 deletions(-) > create mode 100644 LayoutTests/fast/css/css3-ch-unit.html > create mode 100644 LayoutTests/platform/chromium-linux/fast/css/css3-ch-unit-expected.txt > create mode 100644 LayoutTests/platform/qt/fast/css/css3-ch-unit-expected.txt > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1040317..2bee0b5 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2012-07-10 Sumedha Widyadharma <sumedha.widyadharma@basyskom.de> >+ >+ Added tests for the CSS3 'ch' unit and expected results for >+ chromium-linux and Qt. >+ Chromium result created by Bruno Abinader >+ https://bugs.webkit.org/show_bug.cgi?id=85755 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/css/css3-ch-unit.html: Added. >+ * platform/chromium-linux/fast/css/css3-ch-unit-expected.txt: Added. >+ * platform/qt/fast/css/css3-ch-unit-expected.txt: Added. >+ > 2012-07-05 Yoshifumi Inoue <yosin@chromium.org> > > Unreviewed Chromium gardening - Rebaseline for r121917. >diff --git a/LayoutTests/fast/css/css3-ch-unit.html b/LayoutTests/fast/css/css3-ch-unit.html >new file mode 100644 >index 0000000..b27dcf3 >--- /dev/null >+++ b/LayoutTests/fast/css/css3-ch-unit.html >@@ -0,0 +1,33 @@ >+<html> >+<head> >+<style type="text/css"> >+ .box { >+ font-family: monospace; >+ font-height: 12px; >+ overflow: hidden; >+ height: 12px; >+ } >+ >+ .four { >+ width: 4ch >+ } >+ >+ .zero { >+ width: 0ch >+ } >+ >+ .pass { >+ color: green >+ } >+ >+ .fail { >+ color: red >+ } >+</style> >+</head> >+<body> >+ <p>This is a test to make sure ch units work as intended.</p> >+ <div class="box zero"><span class="fail">FAIL</span></div> >+ <div class="box four"><span class="pass">PASS</span><span class="fail">FAIL</span></div> >+</body> >+</html> >diff --git a/LayoutTests/platform/chromium-linux/fast/css/css3-ch-unit-expected.txt b/LayoutTests/platform/chromium-linux/fast/css/css3-ch-unit-expected.txt >new file mode 100644 >index 0000000..3e8e1ef >--- /dev/null >+++ b/LayoutTests/platform/chromium-linux/fast/css/css3-ch-unit-expected.txt >@@ -0,0 +1,16 @@ >+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 >+ RenderBlock {P} at (0,0) size 784x20 >+ RenderText {#text} at (0,0) size 317x19 >+ text run at (0,0) width 317: "This is a test to make sure ch units work as intended." >+layer at (8,56) size 32x12 scrollWidth 64 scrollHeight 16 >+ RenderBlock {DIV} at (0,48) size 32x12 >+ RenderInline {SPAN} at (0,0) size 32x16 [color=#008000] >+ RenderText {#text} at (0,0) size 32x16 >+ text run at (0,0) width 32: "PASS" >+ RenderInline {SPAN} at (0,0) size 32x16 [color=#FF0000] >+ RenderText {#text} at (32,0) size 32x16 >+ text run at (32,0) width 32: "FAIL" >diff --git a/LayoutTests/platform/qt/fast/css/css3-ch-unit-expected.txt b/LayoutTests/platform/qt/fast/css/css3-ch-unit-expected.txt >new file mode 100644 >index 0000000..d91a9c1 >--- /dev/null >+++ b/LayoutTests/platform/qt/fast/css/css3-ch-unit-expected.txt >@@ -0,0 +1,16 @@ >+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 >+ RenderBlock {P} at (0,0) size 784x21 >+ RenderText {#text} at (0,0) size 372x21 >+ text run at (0,0) width 372: "This is a test to make sure ch units work as intended." >+layer at (8,57) size 28x12 scrollWidth 64 scrollHeight 17 >+ RenderBlock {DIV} at (0,49) size 28x12 >+ RenderInline {SPAN} at (0,0) size 36x17 [color=#008000] >+ RenderText {#text} at (0,0) size 36x17 >+ text run at (0,0) width 36: "PASS" >+ RenderInline {SPAN} at (0,0) size 28x17 [color=#FF0000] >+ RenderText {#text} at (36,0) size 28x17 >+ text run at (36,0) width 28: "FAIL" >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 953eab8..277e41f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,47 @@ >+2012-07-10 Sumedha Widyadharma <sumedha.widyadharma@basyskom.de> >+ >+ [CSS3 Units] Add support for the drafted CSS3 'ch' unit in webkit. >+ https://bugs.webkit.org/show_bug.cgi?id=85755 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: fast/css/css3-ch-unit.html >+ >+ * css/CSSCalculationValue.cpp: >+ (WebCore::unitCategory): >+ * css/CSSGrammar.y: >+ * css/CSSParser.cpp: >+ (WebCore::CSSParser::validUnit): >+ (WebCore::CSSParser::createPrimitiveNumericValue): >+ (WebCore::unitFromString): >+ (WebCore::CSSParser::parseValidPrimitive): >+ (WebCore::CSSParser::detectNumberToken): >+ * css/CSSParserValues.cpp: >+ (WebCore::CSSParserValue::createCSSValue): >+ * css/CSSPrimitiveValue.cpp: >+ (WebCore::isValidCSSUnitTypeForDoubleConversion): >+ (WebCore::CSSPrimitiveValue::cleanup): >+ (WebCore::CSSPrimitiveValue::computeLengthDouble): >+ (WebCore::CSSPrimitiveValue::customCssText): >+ (WebCore::CSSPrimitiveValue::cloneForCSSOM): >+ * css/CSSPrimitiveValue.h: >+ (WebCore::CSSPrimitiveValue::isFontRelativeLength): >+ (WebCore::CSSPrimitiveValue::isLength): >+ * html/parser/HTMLTreeBuilder.cpp: >+ (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): >+ * platform/graphics/Font.h: >+ (WebCore::Font::zeroWidth): >+ * platform/graphics/SimpleFontData.cpp: >+ (WebCore::SimpleFontData::platformGlyphInit): >+ * platform/graphics/SimpleFontData.h: >+ (WebCore::SimpleFontData::zeroWidth): >+ (WebCore::SimpleFontData::zeroGlyph): >+ (WebCore::SimpleFontData::setZeroGlyph): >+ (SimpleFontData): >+ * platform/graphics/qt/SimpleFontDataQt.cpp: >+ (WebCore::SimpleFontData::platformGlyphInit): >+ (WebCore::SimpleFontData::platformInit): >+ > 2012-07-05 Arnaud Renevier <arno@renevier.net> > > [GTK] Showing the context menu in the Web Inspector can crash the browser >diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp >index 54247e0..52c5869 100755 >--- a/Source/WebCore/css/CSSCalculationValue.cpp >+++ b/Source/WebCore/css/CSSCalculationValue.cpp >@@ -66,6 +66,7 @@ static CalculationCategory unitCategory(CSSPrimitiveValue::UnitTypes type) > case CSSPrimitiveValue::CSS_PT: > case CSSPrimitiveValue::CSS_PC: > case CSSPrimitiveValue::CSS_REMS: >+ case CSSPrimitiveValue::CSS_CHS: > return CalcLength; > default: > return CalcOther; >diff --git a/Source/WebCore/css/CSSGrammar.y b/Source/WebCore/css/CSSGrammar.y >index c7c10b5..d33a55c 100644 >--- a/Source/WebCore/css/CSSGrammar.y >+++ b/Source/WebCore/css/CSSGrammar.y >@@ -101,7 +101,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) > > %} > >-%expect 62 >+%expect 63 > > %nonassoc LOWEST_PREC > >@@ -169,6 +169,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) > %token MEDIA_AND > > %token <number> REMS >+%token <number> CHS > %token <number> QEMS > %token <number> EMS > %token <number> EXS >@@ -1549,6 +1550,7 @@ unary_term: > if (p->m_styleSheet) > p->m_styleSheet->parserSetUsesRemUnits(true); > } >+ | CHS maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_CHS; } > | VW maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VW; } > | VH maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; } > | VMIN maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; } >diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp >index 015d930..bc941a5 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -1436,6 +1436,7 @@ bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, CSSParserMode > case CSSParserValue::Q_EMS: > case CSSPrimitiveValue::CSS_EMS: > case CSSPrimitiveValue::CSS_REMS: >+ case CSSPrimitiveValue::CSS_CHS: > case CSSPrimitiveValue::CSS_EXS: > case CSSPrimitiveValue::CSS_PX: > case CSSPrimitiveValue::CSS_CM: >@@ -1495,7 +1496,7 @@ inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveNumericValue(CSSP > || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM)); > #else > ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) >- || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS) >+ || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_CHS) > || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)); > #endif > return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)); >@@ -1516,6 +1517,8 @@ static int unitFromString(CSSParserValue* value) > return CSSPrimitiveValue::CSS_EMS; > if (equal(value->string, "rem")) > return CSSPrimitiveValue::CSS_REMS; >+ if (equal(value->string, "ch")) >+ return CSSPrimitiveValue::CSS_CHS; > if (equal(value->string, "ex")) > return CSSPrimitiveValue::CSS_EXS; > if (equal(value->string, "px")) >@@ -1609,7 +1612,7 @@ inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int identifi > return createPrimitiveStringValue(value); > if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ) > return createPrimitiveNumericValue(value); >- if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS) >+ if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_CHS) > return createPrimitiveNumericValue(value); > if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN) > return createPrimitiveNumericValue(value); >@@ -8522,6 +8525,8 @@ inline void CSSParser::detectNumberToken(UChar* type, int length) > case 'c': > if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'm')) > m_token = CMS; >+ else if (length == 2 && isASCIIAlphaCaselessEqual(type[1], 'h')) >+ m_token = CHS; > return; > > case 'd': >diff --git a/Source/WebCore/css/CSSParserValues.cpp b/Source/WebCore/css/CSSParserValues.cpp >index 37a0d45..4e3aa96 100644 >--- a/Source/WebCore/css/CSSParserValues.cpp >+++ b/Source/WebCore/css/CSSParserValues.cpp >@@ -87,7 +87,7 @@ PassRefPtr<CSSValue> CSSParserValue::createCSSValue() > parsedValue = CSSPrimitiveValue::create(string, (CSSPrimitiveValue::UnitTypes)unit); > else if (unit >= CSSPrimitiveValue::CSS_NUMBER && unit <= CSSPrimitiveValue::CSS_KHZ) > parsedValue = CSSPrimitiveValue::create(fValue, (CSSPrimitiveValue::UnitTypes)unit); >- else if (unit >= CSSPrimitiveValue::CSS_TURN && unit <= CSSPrimitiveValue::CSS_REMS) // CSS3 Values and Units >+ else if (unit >= CSSPrimitiveValue::CSS_TURN && unit <= CSSPrimitiveValue::CSS_CHS) // CSS3 Values and Units > parsedValue = CSSPrimitiveValue::create(fValue, (CSSPrimitiveValue::UnitTypes)unit); > else if (unit >= CSSParserValue::Q_EMS) > parsedValue = CSSPrimitiveValue::createAllowingMarginQuirk(fValue, CSSPrimitiveValue::CSS_EMS); >diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp >index 5718180..6fa0452 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.cpp >+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp >@@ -80,6 +80,7 @@ static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit > case CSSPrimitiveValue:: CSS_PX: > case CSSPrimitiveValue:: CSS_RAD: > case CSSPrimitiveValue:: CSS_REMS: >+ case CSSPrimitiveValue:: CSS_CHS: > case CSSPrimitiveValue:: CSS_S: > case CSSPrimitiveValue:: CSS_TURN: > case CSSPrimitiveValue:: CSS_VW: >@@ -406,6 +407,7 @@ void CSSPrimitiveValue::cleanup() > case CSS_EMS: > case CSS_EXS: > case CSS_REMS: >+ case CSS_CHS: > case CSS_PX: > case CSS_CM: > case CSS_MM: >@@ -514,6 +516,9 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r > else > factor = 1.0; > break; >+ case CSS_CHS: >+ factor = style->font().primaryFont()->zeroWidth(); >+ break; > case CSS_PX: > factor = 1.0; > break; >@@ -869,6 +874,9 @@ String CSSPrimitiveValue::customCssText() const > case CSS_REMS: > text = formatNumber(m_value.num) + "rem"; > break; >+ case CSS_CHS: >+ text = formatNumber(m_value.num) + "ch"; >+ break; > case CSS_PX: > text = formatNumber(m_value.num) + "px"; > break; >@@ -1208,6 +1216,7 @@ PassRefPtr<CSSPrimitiveValue> CSSPrimitiveValue::cloneForCSSOM() const > case CSS_EMS: > case CSS_EXS: > case CSS_REMS: >+ case CSS_CHS: > case CSS_PX: > case CSS_CM: > case CSS_MM: >diff --git a/Source/WebCore/css/CSSPrimitiveValue.h b/Source/WebCore/css/CSSPrimitiveValue.h >index 87069c0..76b1dd9 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.h >+++ b/Source/WebCore/css/CSSPrimitiveValue.h >@@ -113,22 +113,23 @@ public: > // These are from CSS3 Values and Units, but that isn't a finished standard yet > CSS_TURN = 107, > CSS_REMS = 108, >+ CSS_CHS = 109, > > // This is used internally for counter names (as opposed to counter values) >- CSS_COUNTER_NAME = 109, >+ CSS_COUNTER_NAME = 110, > > // This is used by the CSS Exclusions draft >- CSS_SHAPE = 110, >+ CSS_SHAPE = 111, > > // Used by border images. >- CSS_QUAD = 111, >+ CSS_QUAD = 112, > >- CSS_CALC = 112, >- CSS_CALC_PERCENTAGE_WITH_NUMBER = 113, >- CSS_CALC_PERCENTAGE_WITH_LENGTH = 114, >+ CSS_CALC = 113, >+ CSS_CALC_PERCENTAGE_WITH_NUMBER = 114, >+ CSS_CALC_PERCENTAGE_WITH_LENGTH = 115, > > #if ENABLE(CSS_VARIABLES) >- CSS_VARIABLE_NAME = 115, >+ CSS_VARIABLE_NAME = 116, > #endif > }; > >@@ -159,13 +160,16 @@ public: > bool isFontIndependentLength() const { return m_primitiveUnitType >= CSS_PX && m_primitiveUnitType <= CSS_PC; } > bool isFontRelativeLength() const > { >- return m_primitiveUnitType == CSS_EMS || m_primitiveUnitType == CSS_EXS || m_primitiveUnitType == CSS_REMS; >+ return m_primitiveUnitType == CSS_EMS >+ || m_primitiveUnitType == CSS_EXS >+ || m_primitiveUnitType == CSS_REMS >+ || m_primitiveUnitType == CSS_CHS; > } > bool isIdent() const { return m_primitiveUnitType == CSS_IDENT; } > bool isLength() const > { > unsigned short type = primitiveType(); >- return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS; >+ return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS; > } > bool isNumber() const { return primitiveType() == CSS_NUMBER; } > bool isPercentage() const { return primitiveType() == CSS_PERCENTAGE; } >diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h >index d80660d..f554851 100644 >--- a/Source/WebCore/platform/graphics/Font.h >+++ b/Source/WebCore/platform/graphics/Font.h >@@ -160,6 +160,7 @@ public: > // Metrics that we query the FontFallbackList for. > const FontMetrics& fontMetrics() const { return primaryFont()->fontMetrics(); } > float spaceWidth() const { return primaryFont()->spaceWidth() + m_letterSpacing; } >+ float zeroWidth() const { return primaryFont()->zeroWidth() + m_letterSpacing; } > float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const; > float tabWidth(unsigned tabSize, float position) const { return tabWidth(*primaryFont(), tabSize, position); } > >diff --git a/Source/WebCore/platform/graphics/SimpleFontData.cpp b/Source/WebCore/platform/graphics/SimpleFontData.cpp >index 222e433..ee75e82 100644 >--- a/Source/WebCore/platform/graphics/SimpleFontData.cpp >+++ b/Source/WebCore/platform/graphics/SimpleFontData.cpp >@@ -98,6 +98,8 @@ void SimpleFontData::platformGlyphInit() > LOG_ERROR("Failed to get glyph page zero."); > m_spaceGlyph = 0; > m_spaceWidth = 0; >+ m_zeroGlyph = 0; >+ m_zeroWidth = 0; > m_adjustedSpaceWidth = 0; > determinePitch(); > m_zeroWidthSpaceGlyph = 0; >@@ -114,6 +116,8 @@ void SimpleFontData::platformGlyphInit() > m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph; > float width = widthForGlyph(m_spaceGlyph); > m_spaceWidth = width; >+ m_zeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph; >+ m_zeroWidth = widthForGlyph(m_zeroGlyph); > determinePitch(); > m_adjustedSpaceWidth = m_treatAsFixedPitch ? ceilf(width) : roundf(width); > >diff --git a/Source/WebCore/platform/graphics/SimpleFontData.h b/Source/WebCore/platform/graphics/SimpleFontData.h >index 6fc918a..f7ffa79 100644 >--- a/Source/WebCore/platform/graphics/SimpleFontData.h >+++ b/Source/WebCore/platform/graphics/SimpleFontData.h >@@ -136,6 +136,7 @@ public: > float platformWidthForGlyph(Glyph) const; > > float spaceWidth() const { return m_spaceWidth; } >+ float zeroWidth() const { return m_zeroWidth; } > float adjustedSpaceWidth() const { return m_adjustedSpaceWidth; } > void setSpaceWidth(float spaceWidth) { m_spaceWidth = spaceWidth; } > >@@ -145,6 +146,8 @@ public: > > Glyph spaceGlyph() const { return m_spaceGlyph; } > void setSpaceGlyph(Glyph spaceGlyph) { m_spaceGlyph = spaceGlyph; } >+ Glyph zeroGlyph() const { return m_zeroGlyph; } >+ void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; } > void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spaceGlyph; } > bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthSpaceGlyph && glyph; } > >@@ -257,6 +260,8 @@ private: > > Glyph m_spaceGlyph; > float m_spaceWidth; >+ Glyph m_zeroGlyph; >+ float m_zeroWidth; > float m_adjustedSpaceWidth; > > Glyph m_zeroWidthSpaceGlyph; >diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp >index 4c01f1d..3914e8b 100644 >--- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp >+++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp >@@ -113,6 +113,7 @@ void SimpleFontData::platformGlyphInit() > if (!m_platformData.size()) > return; > m_spaceGlyph = 0; >+ m_zeroGlyph = 0; > m_adjustedSpaceWidth = m_spaceWidth; > determinePitch(); > m_missingGlyphData.fontData = this; >@@ -139,6 +140,10 @@ void SimpleFontData::platformInit() > QVector<quint32> indexes = rawFont.glyphIndexesForString(QLatin1String(" ")); > QVector<QPointF> advances = rawFont.advancesForGlyphIndexes(indexes); > float spaceWidth = advances.at(0).x(); >+ >+ indexes = rawFont.glyphIndexesForString(QLatin1String("0")); >+ advances = rawFont.advancesForGlyphIndexes(indexes); >+ float zeroWidth = advances.at(0).x(); > #else > QFontMetricsF fm(m_platformData.font()); > float descent = fm.descent(); >@@ -146,6 +151,7 @@ void SimpleFontData::platformInit() > float xHeight = fm.xHeight(); > float lineSpacing = fm.lineSpacing(); > float spaceWidth = fm.width(QLatin1Char(' ')); >+ float zeroWidth = fm.width(QLatin1Char('0')); > #endif > > #if !HAVE(QT5) >@@ -171,6 +177,7 @@ void SimpleFontData::platformInit() > m_fontMetrics.setXHeight(xHeight); > m_fontMetrics.setLineGap(lineGap); > m_spaceWidth = spaceWidth; >+ m_zeroWidth = zeroWidth; > } > > void SimpleFontData::platformCharWidthInit() >-- >1.7.3.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 85755
:
151038
|
151463
|
151616
|
151623
|
151630
|
153006
|
153012
|
157997
|
158001
|
158042
|
158067
|
174491
|
179815
|
183785
|
183832
|
184100
|
184102
|
184103
|
184214
|
184243
|
184510
|
184616
|
187182
|
187376
|
188399