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
bug-85755-20130207205030.patch (text/plain), 28.65 KB, created by
Lamarque V. Souza
on 2013-02-07 14:53:56 PST
(
hide
)
Description:
CSS3 ch unit patch
Filename:
MIME Type:
Creator:
Lamarque V. Souza
Created:
2013-02-07 14:53:56 PST
Size:
28.65 KB
patch
obsolete
>Subversion Revision: 142168 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3e3e6935f9e1caec699b21e773c9e154090ff38a..67c10b15fe9ac06f41fac2ef3d1e3e0ad0100a59 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,48 @@ >+2013-02-07 Lamarque V. Souza <Lamarque.Souza@basyskom.com> >+ >+ Support the ch unit from css3-values >+ https://bugs.webkit.org/show_bug.cgi?id=85755 >+ >+ Patch by Sumedha Widyadharma <sumedha.widyadharma@basyskom.com> on 2013-01-21 >+ Reviewed by Dave Hyatt. >+ >+ Test: fast/css/css3-ch-unit.html >+ >+ * css/CSSCalculationValue.cpp: >+ (WebCore::unitCategory): >+ * css/CSSGrammar.y.in: >+ * css/CSSParser.cpp: >+ (WebCore::CSSParser::validUnit): >+ (WebCore::CSSParser::createPrimitiveNumericValue): >+ (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): >+ * platform/graphics/FontMetrics.h: >+ (WebCore::FontMetrics::FontMetrics): >+ (WebCore::FontMetrics::zeroWidth): >+ (WebCore::FontMetrics::setZeroWidth): >+ (FontMetrics): >+ (WebCore::FontMetrics::hasZeroWidth): >+ (WebCore::FontMetrics::setHasZeroWidth): >+ * platform/graphics/SimpleFontData.cpp: >+ (WebCore::SimpleFontData::platformGlyphInit): >+ * platform/graphics/SimpleFontData.h: >+ (WebCore::SimpleFontData::zeroGlyph): >+ (WebCore::SimpleFontData::setZeroGlyph): >+ (SimpleFontData): >+ * platform/graphics/qt/SimpleFontDataQt.cpp: >+ (WebCore::SimpleFontData::platformInit): >+ > 2013-02-07 Rik Cabanier <cabanier@adobe.com> > > Add support for parsing of -webkit-background-blend-mode >diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp >index e87401a0af90e9235177d41dbc824ef78788f47b..c1684c759f00c9e57858e86e07d08bc4fb02a485 100644 >--- a/Source/WebCore/css/CSSCalculationValue.cpp >+++ b/Source/WebCore/css/CSSCalculationValue.cpp >@@ -67,6 +67,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; > #if ENABLE(CSS_VARIABLES) > case CSSPrimitiveValue::CSS_VARIABLE_NAME: >diff --git a/Source/WebCore/css/CSSGrammar.y.in b/Source/WebCore/css/CSSGrammar.y.in >index 4ad333dc7ed13cb0f36d96c6cef53c44d7e15048..e55a6f545414a024d211f4c6e12ec557ddd254f9 100644 >--- a/Source/WebCore/css/CSSGrammar.y.in >+++ b/Source/WebCore/css/CSSGrammar.y.in >@@ -61,7 +61,7 @@ static inline int cssyyerror(void*, const char*) > > %} > >-%expect 66 >+%expect 67 > > %nonassoc LOWEST_PREC > >@@ -144,6 +144,7 @@ static inline int cssyyerror(void*, const char*) > #endif > > %token <number> REMS >+%token <number> CHS > %token <number> QEMS > %token <number> EMS > %token <number> EXS >@@ -1709,6 +1710,7 @@ unary_term: > if (parser->m_styleSheet) > parser->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 2098b1e3157f72011a72565c3bcfe24727022a2e..7236872dd987e1789428904e374ac5b59eacf6cc 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -1588,6 +1588,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: >@@ -1643,12 +1644,12 @@ inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveNumericValue(CSSP > > #if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY) > 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_VMAX) > || (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_VMAX)); > #endif > return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)); >@@ -1705,7 +1706,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_VMAX) > return createPrimitiveNumericValue(value); >@@ -9900,6 +9901,8 @@ inline void CSSParser::detectNumberToken(CharacterType* 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 2d631b1f9f6a4c831ced4495e97ba4b11f7dcdd6..144117d13969dbb005081f95bbafb1a14d096faa 100644 >--- a/Source/WebCore/css/CSSParserValues.cpp >+++ b/Source/WebCore/css/CSSParserValues.cpp >@@ -114,6 +114,7 @@ PassRefPtr<CSSValue> CSSParserValue::createCSSValue() > case CSSPrimitiveValue::CSS_VMAX: > case CSSPrimitiveValue::CSS_TURN: > case CSSPrimitiveValue::CSS_REMS: >+ case CSSPrimitiveValue::CSS_CHS: > return CSSPrimitiveValue::create(fValue, primitiveUnit); > case CSSPrimitiveValue::CSS_UNKNOWN: > case CSSPrimitiveValue::CSS_DIMENSION: >diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp >index e4885c7776856fa66efe08df3918b2e62553fa68..56a8830fad6457bdbb04d02e8e6f3b4eff64d9ea 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.cpp >+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp >@@ -88,6 +88,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: >@@ -425,6 +426,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: >@@ -545,6 +547,9 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r > else > factor = 1.0; > break; >+ case CSS_CHS: >+ factor = style->fontMetrics().zeroWidth(); >+ break; > case CSS_PX: > factor = 1.0; > break; >@@ -902,6 +907,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; >@@ -1229,6 +1237,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 4abb0556c0a9c33605995cf865cc3fa79de4ddf5..fbe1f3cb99d377a8978642462da62a865faa3bc2 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.h >+++ b/Source/WebCore/css/CSSPrimitiveValue.h >@@ -116,22 +116,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 > }; > >@@ -162,13 +163,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/FontMetrics.h b/Source/WebCore/platform/graphics/FontMetrics.h >index 7981d8eead53ad8eb92ffe7561341784fecbfe35..5142ffe2537821b8c84b6a9a7f6d88dde8ea5d4d 100644 >--- a/Source/WebCore/platform/graphics/FontMetrics.h >+++ b/Source/WebCore/platform/graphics/FontMetrics.h >@@ -36,7 +36,9 @@ public: > , m_lineGap(0) > , m_lineSpacing(0) > , m_xHeight(0) >+ , m_zeroWidth(0) > , m_hasXHeight(false) >+ , m_hasZeroWidth(false) > { > } > >@@ -110,6 +112,16 @@ public: > return ascent() == other.ascent() && descent() == other.descent() && lineGap() == other.lineGap(); > } > >+ float zeroWidth() const { return m_zeroWidth; } >+ void setZeroWidth(float zeroWidth) >+ { >+ m_zeroWidth = zeroWidth; >+ m_hasZeroWidth = true; >+ } >+ >+ bool hasZeroWidth() const { return m_hasZeroWidth; } >+ void setHasZeroWidth(bool hasZeroWidth) { m_hasZeroWidth = hasZeroWidth; } >+ > private: > friend class SimpleFontData; > >@@ -130,7 +142,9 @@ private: > float m_lineGap; > float m_lineSpacing; > float m_xHeight; >+ float m_zeroWidth; > bool m_hasXHeight; >+ bool m_hasZeroWidth; > }; > > static inline float scaleEmToUnits(float x, unsigned unitsPerEm) >diff --git a/Source/WebCore/platform/graphics/SimpleFontData.cpp b/Source/WebCore/platform/graphics/SimpleFontData.cpp >index 65194f0120a5f9d9a9b54fa4dcaea3f9c2512c0f..1dded40ebdd4b3308902d9788d6f4d4b7b3c6118 100644 >--- a/Source/WebCore/platform/graphics/SimpleFontData.cpp >+++ b/Source/WebCore/platform/graphics/SimpleFontData.cpp >@@ -113,6 +113,7 @@ void SimpleFontData::platformGlyphInit() > LOG_ERROR("Failed to get glyph page zero."); > m_spaceGlyph = 0; > m_spaceWidth = 0; >+ m_zeroGlyph = 0; > m_adjustedSpaceWidth = 0; > determinePitch(); > m_zeroWidthSpaceGlyph = 0; >@@ -129,6 +130,8 @@ void SimpleFontData::platformGlyphInit() > m_spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph; > float width = widthForGlyph(m_spaceGlyph); > m_spaceWidth = width; >+ m_zeroGlyph = glyphPageZero->glyphDataForCharacter('0').glyph; >+ m_fontMetrics.setZeroWidth(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 97ea5a20190bdf8c411664456fdf861dab5be94d..bd3de670a6ebddb3df19bc7c2932c9f4d413c1dd 100644 >--- a/Source/WebCore/platform/graphics/SimpleFontData.h >+++ b/Source/WebCore/platform/graphics/SimpleFontData.h >@@ -160,6 +160,8 @@ public: > Glyph zeroWidthSpaceGlyph() const { return m_zeroWidthSpaceGlyph; } > void setZeroWidthSpaceGlyph(Glyph spaceGlyph) { m_zeroWidthSpaceGlyph = spaceGlyph; } > bool isZeroWidthSpaceGlyph(Glyph glyph) const { return glyph == m_zeroWidthSpaceGlyph && glyph; } >+ Glyph zeroGlyph() const { return m_zeroGlyph; } >+ void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; } > > virtual const SimpleFontData* fontDataForCharacter(UChar32) const; > virtual bool containsCharacters(const UChar*, int length) const; >@@ -280,6 +282,7 @@ private: > > Glyph m_spaceGlyph; > float m_spaceWidth; >+ Glyph m_zeroGlyph; > 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 44099b3eb2c198dc410bd76cf2fd0e26715f0908..dc9ea9223a1b780eb19c90db70fc215dbc36ffd9 100644 >--- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp >+++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp >@@ -88,6 +88,10 @@ void SimpleFontData::platformInit() > 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(); >+ > // The line spacing should always be >= (ascent + descent), but this > // may be false in some cases due to misbehaving platform libraries. > // Workaround from SimpleFontPango.cpp and SimpleFontFreeType.cpp >@@ -104,6 +108,7 @@ void SimpleFontData::platformInit() > m_fontMetrics.setLineSpacing(lineSpacing); > m_fontMetrics.setXHeight(xHeight); > m_fontMetrics.setLineGap(lineGap); >+ m_fontMetrics.setZeroWidth(zeroWidth); > m_spaceWidth = spaceWidth; > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 0e5845ff96b018d59614735a4c2d1a08b3cbb4f2..c261aecd28e51a3f6f9dfa94cbc259c43fcdb36e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2013-02-07 Lamarque V. Souza <Lamarque.Souza@basyskom.com> >+ >+ Support the ch unit from css3-values >+ https://bugs.webkit.org/show_bug.cgi?id=85755 >+ >+ Patch by Sumedha Widyadharma <sumedha.widyadharma@basyskom.com> on 2013-01-21 >+ Reviewed by Dave Hyatt. >+ >+ * fast/css/css3-ch-unit-expected.txt: Added. >+ * fast/css/css3-ch-unit.html: Added. >+ > 2013-02-07 Rik Cabanier <cabanier@adobe.com> > > Add support for parsing of -webkit-background-blend-mode >diff --git a/LayoutTests/fast/css/css3-ch-unit-expected.txt b/LayoutTests/fast/css/css3-ch-unit-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f87dc94fae710ad4b2d5de4fce0d006bfc76e326 >--- /dev/null >+++ b/LayoutTests/fast/css/css3-ch-unit-expected.txt >@@ -0,0 +1,52 @@ >+This is a test to make sure ch units work as intended. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS document.getElementById("box_mono_zero").clientWidth is 0 >+PASS document.getElementById("box_mono_four1").clientWidth is document.getElementById("box_mono_four2").clientWidth >+PASS document.getElementById("box_monofallthrough_four1").clientWidth is document.getElementById("box_monofallthrough_four2").clientWidth >+PASS document.getElementById("mono_box_alphalen1").clientWidth is document.getElementById("mono_box_alphalen2").clientWidth >+PASS document.getElementById("box_one").clientWidth * 26 is document.getElementById("box_alphalen").clientWidth >+PASS document.getElementById("arial_box_one").clientWidth * 26 is document.getElementById("arial_box_alphalen").clientWidth >+PASS document.getElementById("helvetica_box_one").clientWidth * 26 is document.getElementById("helvetica_box_alphalen").clientWidth >+PASS document.getElementById("times_box_one").clientWidth * 4 is document.getElementById("box_times_four").clientWidth >+PASS document.getElementById("arial_box_one").clientWidth * 4 is document.getElementById("box_arial_four").clientWidth >+PASS document.getElementById("helvetica_box_one").clientWidth * 4 is document.getElementById("box_helvetica_four").clientWidth >+PASS document.getElementById("ref_box_arial_one").clientWidth is >= document.getElementById("box_arial_one").clientWidth >+PASS document.getElementById("ref_box_times_one").clientWidth is >= document.getElementById("box_times_one").clientWidth >+PASS document.getElementById("ref_box_sansserif_one").clientWidth is >= document.getElementById("box_sansserif_one").clientWidth >+PASS w1 !== w2 || h1 !== h2 is false >+PASS ps1h > ps2h && ps1h > ps3h is true >+PASS document.getElementById("box_mono_one").clientWidth is document.getElementById("box_mono").clientWidth >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+This is a test to make sure ch units work as intended. You should not see anything red on this page. >+ >+Only 'PASS' should be visible: >+PASS >+PASS >+PASS >+PASS >+The whole lower case alphabet should be readable: >+abcdefghijklmnopqrstuvwxyz >+abcdefghijklmnopqrstuvwxyz >+abcdefghijklmnopqrstuvwxyz >+abcdefghijklmnopqrstuvwxyz >+abcdefghijklmnopqrstuvwxyz >+Four zeroes should be visible, nothing else: >+0000 >+0000 >+0000 There should be more than one green '|' visible (non-monospaced fonts): >+|||0||| >+|||0||| >+|||0||| >+This box has a 20px font size. The last two '0's should be the same size. >+0 >+0 >+0 >+I'm a pseudo selected first line, I should be bigger than the rest. >+I'm the second line. >+Last in line. But one day... the throne will be mine! >+0 >diff --git a/LayoutTests/fast/css/css3-ch-unit.html b/LayoutTests/fast/css/css3-ch-unit.html >new file mode 100644 >index 0000000000000000000000000000000000000000..050425c00c8a473ecb6d04481a274ff5a3745540 >--- /dev/null >+++ b/LayoutTests/fast/css/css3-ch-unit.html >@@ -0,0 +1,184 @@ >+<!doctype html> >+<html> >+<head> >+<style type="text/css" title="teste"> >+ .box { >+ margin: 0px; >+ padding: 0px; >+ overflow: hidden; >+ } >+ .border { border:1px solid black; } >+ >+ /* font family classes */ >+ .mono { font-family: monospace; } >+ .monofallthrough { font-family: nonexistant, monospace; } >+ .serif { font-family: serif; } >+ .sans-serif { font-family: sans-serif; } >+ .courier { font-family: courier; } >+ .arial { font-family: arial; } >+ .times { font-family: times; } >+ .helvetica { font-family: helvetica; } >+ >+ /* ch-length containers */ >+ .one { width: 1ch; } >+ .four { width: 4ch; } >+ .zero { width: 0ch; } >+ .alphalen { width: 26ch; } >+ >+ /* font sizes for the relative size test */ >+ .large { font-size:20px; } >+ .relative { font-size:1ch; } >+ >+ /* pass/fail colors */ >+ .pass { color: green; } >+ .fail { color: red; } >+ >+ /* pseudo-elements */ >+ #pseudo{ >+ font-size:2ch; >+ } >+ #pseudo:first-line { >+ font-size:3ch; >+ } >+ #pseudo span:last-child { >+ font-size:1ch; >+ } >+</style> >+<script src="../js/resources/js-test-pre.js"></script> >+<script type="text/javascript"> >+</script> >+</head> >+<body id="body"> >+ <p>This is a test to make sure ch units work as intended. You should not see <b>anything</b> red on this page.</p> >+ Only 'PASS' should be visible: >+ <div id="box_mono_zero" class="box mono zero"></div> >+ <script type="text/javascript"> >+ description("This is a test to make sure ch units work as intended.") >+ shouldEvaluateTo('document.getElementById("box_mono_zero").clientWidth', "0"); >+ </script> >+ >+ <div id="box_mono_four1" class="box mono four"><span class="pass">PASS</span><span class="fail">FAIL</span></div> >+ <div id="box_mono_four2" class="box mono four"><span class="pass">PASS</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("box_mono_four1").clientWidth', 'document.getElementById("box_mono_four2").clientWidth'); >+ </script> >+ >+ <div id="box_monofallthrough_four1" class="box monofallthrough four"><span class="pass">PASS</span><span class="fail">FAIL</span></div> >+ <div id="box_monofallthrough_four2" class="box monofallthrough four"><span class="pass">PASS</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("box_monofallthrough_four1").clientWidth', 'document.getElementById("box_monofallthrough_four2").clientWidth'); >+ </script> >+ >+ The whole lower case alphabet should be readable: >+ <div id="mono_box_alphalen1" class="mono box alphalen"><span class="pass">abcdefghijklmnopqrstuvwxyz</span><span class="fail">FAIL</span></div> >+ <div id="mono_box_alphalen2" class="mono box alphalen"><span class="pass">abcdefghijklmnopqrstuvwxyz</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("mono_box_alphalen1").clientWidth', 'document.getElementById("mono_box_alphalen2").clientWidth'); >+ </script> >+ >+ <div id="box_one" class="box one"></div> >+ <div id="box_alphalen" class="box alphalen"><span class="pass">abcdefghijklmnopqrstuvwxyz</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("box_one").clientWidth * 26', 'document.getElementById("box_alphalen").clientWidth'); >+ </script> >+ >+ <div id="arial_box_one" class="arial box one"></div> >+ <div id="arial_box_alphalen" class="arial box alphalen"><span class="pass">abcdefghijklmnopqrstuvwxyz</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("arial_box_one").clientWidth * 26', 'document.getElementById("arial_box_alphalen").clientWidth'); >+ </script> >+ >+ <div id="helvetica_box_one" class="helvetica box one"></div> >+ <div id="helvetica_box_alphalen" class="helvetica box alphalen"><span class="pass">abcdefghijklmnopqrstuvwxyz</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("helvetica_box_one").clientWidth * 26', 'document.getElementById("helvetica_box_alphalen").clientWidth'); >+ </script> >+ >+ Four zeroes should be visible, nothing else: >+ <div id="times_box_one" class="times box one"></div> >+ <div id="box_times_four" class="box times four"><span class="pass">0000</span><span class="fail">FAIL</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("times_box_one").clientWidth * 4', 'document.getElementById("box_times_four").clientWidth'); >+ </script> >+ >+ <div id="box_arial_four" class="box arial four"><span class="pass">0000</span><span class="fail">FAIL</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("arial_box_one").clientWidth * 4', 'document.getElementById("box_arial_four").clientWidth'); >+ </script> >+ >+ <div id="box_helvetica_four" class="box helvetica four"><span class="pass">0000</span><span class="fail">FAIL</span></div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("helvetica_box_one").clientWidth * 4', 'document.getElementById("box_helvetica_four").clientWidth'); >+ </script> >+ >+ There should be more than one green '|' visible (non-monospaced fonts): >+ <div id="box_arial_one" class="box arial one"><span class="pass">|</span><span class="pass">||0</span><span class="fail">||||</span></div> >+ <div id="ref_box_arial_one" class="box arial" style="display:inline-block"><span class="pass">|</span><span class="pass">||</span></div> >+ <script type="text/javascript"> >+ shouldBeGreaterThanOrEqual('document.getElementById("ref_box_arial_one").clientWidth', 'document.getElementById("box_arial_one").clientWidth'); >+ </script> >+ >+ <div id="box_times_one" class="box times one"><span class="pass">|</span><span class="pass">||0</span><span class="fail">||||</span></div> >+ <div id="ref_box_times_one" class="box times" style="display:inline-block"><span class="pass">|</span><span class="pass">||</span></div> >+ <script type="text/javascript"> >+ shouldBeGreaterThanOrEqual('document.getElementById("ref_box_times_one").clientWidth', 'document.getElementById("box_times_one").clientWidth'); >+ </script> >+ >+ <div id="box_sansserif_one" class="box sansserif one"><span class="pass">|</span><span class="pass">||0</span><span class="fail">||||</span></div> >+ <div id="ref_box_sansserif_one" class="box times" style="display:inline-block"><span class="pass">|</span><span class="pass">||</span></div> >+ <script type="text/javascript"> >+ shouldBeGreaterThanOrEqual('document.getElementById("ref_box_sansserif_one").clientWidth', 'document.getElementById("box_sansserif_one").clientWidth'); >+ </script> >+ >+ <div class="border"> >+ This box has a 20px font size. >+ The last two '0's should be the same size. >+ <div class="large pass"> >+ <div id="reference" class="one">0</div> >+ <div id="forcedsmall" class="box one">0</div> >+ <div id="chsmall" class="box one relative">0</div> >+ </div> >+ <script type="text/javascript"> >+ var ref = document.getElementById("reference"); >+ var refWidth = ref.clientWidth; >+ var small = document.getElementById("forcedsmall"); >+ small.style.fontSize = refWidth +"px"; >+ var w1 = small.clientWidth; >+ var h1 = small.clientHeight; >+ var chsmall = document.getElementById("chsmall"); >+ var w2 = chsmall.clientWidth; >+ var h2 = chsmall.clientHeight; >+ shouldBeFalse("w1 !== w2 || h1 !== h2"); >+ </script> >+ </div> >+ <div id="pseudo"> >+ <span id="ps1">I'm a pseudo selected first line, I should be bigger than the rest.</span><br> >+ <span id="ps2">I'm the second line.</span><br> >+ <span id="ps3">Last in line. But one day... the throne will be mine!</span> >+ </div> >+ <script> >+ var ps1h = document.getElementById('ps1').offsetHeight; >+ var ps2h = document.getElementById('ps2').offsetHeight; >+ var ps3h = document.getElementById('ps3').offsetHeight; >+ shouldBeTrue("ps1h > ps2h && ps1h > ps3h"); >+ </script> >+ >+ <div id="box_mono_one" class="box mono one"></div> >+ <div id="box_mono" class="box mono" style="display:inline-block">0</div> >+ <script type="text/javascript"> >+ shouldEvaluateTo('document.getElementById("box_mono_one").clientWidth', 'document.getElementById("box_mono").clientWidth'); >+ </script> >+ <script src="../js/resources/js-test-post.js"></script> >+ <script> >+ // Text with '<span class="fail">' must not appear in DumpRenderTree's output, only when opening this file in a web browser. >+ if (window.testRunner) { >+ var CSSRules = 'rules'; >+ for (var i = 0; i < document.styleSheets[0][CSSRules].length; ++i) >+ if (document.styleSheets[0][CSSRules][i].selectorText === ".fail") { >+ document.styleSheets[0][CSSRules][i].style['display'] = 'none'; >+ break; >+ } >+ } >+ </script> >+</body> >+</html>
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