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-20130124230947.patch (text/plain), 29.01 KB, created by
Lamarque V. Souza
on 2013-01-24 17:13:01 PST
(
hide
)
Description:
CSS3 ch unit patch
Filename:
MIME Type:
Creator:
Lamarque V. Souza
Created:
2013-01-24 17:13:01 PST
Size:
29.01 KB
patch
obsolete
>Subversion Revision: 140327 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4cf365afdda4f8c135d031b8d1c022ba3af7e0df..22ee867080d147acd31237d5750e5ae371262693 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,48 @@ >+2013-01-24 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 NOBODY (OOPS!). >+ >+ 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-01-21 Oleg Smirnov <oleg.smirnov@lge.com> > > [Gtk] [Cairo] Memory leak when is WebView destroy. >diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp >index e90a7d019616b468af6e054491b0c056a8f66d0a..fb7152ceb0dcec7fb707b86ebf2c413e22e98d6c 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 6187d6c1545a8e3c07176420e04a93ed41ec0812..4bbf72ccbdce60657bafafb3cc3be042ee59e798 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 65 >+%expect 66 > > %nonassoc LOWEST_PREC > >@@ -141,6 +141,7 @@ static inline int cssyyerror(void*, const char*) > #endif > > %token <number> REMS >+%token <number> CHS > %token <number> QEMS > %token <number> EMS > %token <number> EXS >@@ -1684,6 +1685,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 592b46799edd6767ab7e86efa09eaa748d3ee424..869603926292fc6904ad7988af9bafba57e2c475 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -1576,6 +1576,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: >@@ -1630,13 +1631,13 @@ 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_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN) >- || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM)); >+ || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_CHS) >+ || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN) >+ || (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_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)); >+ || (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)); > } >@@ -1692,7 +1693,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); >@@ -9776,6 +9777,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 d23b8585d5d7bb8eb0f268234b6ed06a5881df27..b6bb466a63a294f4e3a8345532f8f67b4ffd634d 100644 >--- a/Source/WebCore/css/CSSParserValues.cpp >+++ b/Source/WebCore/css/CSSParserValues.cpp >@@ -113,6 +113,7 @@ PassRefPtr<CSSValue> CSSParserValue::createCSSValue() > case CSSPrimitiveValue::CSS_VMIN: > 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 4804e19843f5ff0520f628175ace922f8b458e6a..a3189931a112b484206acdab476f54d39b492b33 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: >@@ -419,6 +420,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: >@@ -538,6 +540,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; >@@ -895,6 +900,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; >@@ -1216,6 +1224,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 fcc5b83b877e42bd91ee6a4683dd8548bee9851f..ff863c6dcbaca8bca92bae794653610fe1f30cde 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.h >+++ b/Source/WebCore/css/CSSPrimitiveValue.h >@@ -115,22 +115,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 > }; > >@@ -161,13 +162,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 41f8015d13e2e54e69860210332645b9a82e3029..bc3881dac7d39790392e97746a58f69ba534b1eb 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 51dccc0d140e949016271814078c926bfdb46463..df8922c8996e46c0ce2ea90aaae3442fb31d3133 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2013-01-24 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 NOBODY (OOPS!). >+ >+ * fast/css/css3-ch-unit-expected.txt: Added. >+ * fast/css/css3-ch-unit.html: Added. >+ > 2013-01-21 Kent Tamura <tkent@chromium.org> > > INPUT_MULTIPLE_FIELDS_UI: should not dispatch 'input' events if the element value is not updated >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