WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-92000-20121025121210.patch (text/plain), 15.43 KB, created by
Bruno Abinader (history only)
on 2012-10-25 09:13:38 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Bruno Abinader (history only)
Created:
2012-10-25 09:13:38 PDT
Size:
15.43 KB
patch
obsolete
>Subversion Revision: 132476 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7be57292e834dc855649d14a8cee8bfce3d03415..0e6df62d615d0fe95a6746f66667e4341f877e42 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2012-10-25 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> >+ >+ [css3-text] Add support for "text-decoration" using CSS3 spec >+ https://bugs.webkit.org/show_bug.cgi?id=92000 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch intends to implement the shorthand version of "text-decoration" >+ property, as specified by the CSS3 text decoration spec: >+ http://dev.w3.org/csswg/css3-text/#text-decoration >+ >+ Backwards compatiblity with CSS2.1 spec of "text-decoration" is maintained. >+ >+ Test: fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html >+ >+ * css/CSSParser.cpp: >+ (WebCore::CSSParser::parseValue): >+ (WebCore::CSSParser::parseTextDecoration): >+ * css/CSSParser.h: >+ * css/StylePropertyShorthand.cpp: >+ (WebCore::webkitTextDecorationShorthand): >+ * css/StylePropertyShorthand.h: >+ > 2012-10-25 Alexander Pavlov <apavlov@chromium.org> > > Unreviewed, fix Web Inspector frontend compilability >diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp >index 0f0886f343ba7e33be2a7db1cd7defad19ffeae9..c2f427676d3590d5389d354df27c7515051b470f 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -2117,6 +2117,14 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) > } > > case CSSPropertyTextDecoration: >+#if ENABLE(CSS3_TEXT) >+ // <text-decoration-line> || <text-decoration-style> || <text-decoration-color> || blink >+ return parseTextDecorationShorthand(important); >+#else >+ // none | [ underline || overline || line-through || blink ] | inherit >+ return parseTextDecoration(propId, important); >+#endif // CSS3_TEXT >+ > case CSSPropertyWebkitTextDecorationsInEffect: > // none | [ underline || overline || line-through || blink ] | inherit > return parseTextDecoration(propId, important); >@@ -8048,7 +8056,7 @@ void CSSParser::addTextDecorationProperty(CSSPropertyID propId, PassRefPtr<CSSVa > bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) > { > CSSParserValue* value = m_valueList->current(); >- if (value->id == CSSValueNone) { >+ if (value && value->id == CSSValueNone) { > addTextDecorationProperty(propId, cssValuePool().createExplicitInitialValue(), important); > m_valueList->next(); > return true; >@@ -8077,7 +8085,12 @@ bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) > value = m_valueList->next(); > } > >+#if ENABLE(CSS3_TEXT) >+ // Values are valid or in shorthand scope. >+ if (list->length() && (isValid || m_currentShorthand != CSSPropertyInvalid)) { >+#else > if (list->length() && isValid) { >+#endif // CSS3_TEXT > addTextDecorationProperty(propId, list.release(), important); > return true; > } >@@ -8085,6 +8098,39 @@ bool CSSParser::parseTextDecoration(CSSPropertyID propId, bool important) > return false; > } > >+#if ENABLE(CSS3_TEXT) >+bool CSSParser::parseTextDecorationShorthand(bool important) >+{ >+ bool isShorthand = false; >+ int blinkValueIndex = -1; >+ CSSParserValue* value = 0; >+ for (unsigned i = 0; i < m_valueList->size(); ++i) { >+ value = m_valueList->valueAt(i); >+ if (!value) >+ return false; >+ switch (value->id) { >+ case CSSValueNone: >+ case CSSValueUnderline: >+ case CSSValueOverline: >+ case CSSValueLineThrough: >+ continue; >+ case CSSValueBlink: >+ blinkValueIndex = i; >+ continue; >+ default: >+ isShorthand = true; >+ break; >+ } >+ } >+ >+ // Blink value is accepted, but not parsed. >+ if (blinkValueIndex != -1) >+ m_valueList->deleteValueAt(blinkValueIndex); >+ >+ return isShorthand ? parseShorthand(CSSPropertyTextDecoration, webkitTextDecorationShorthand(), important) : parseTextDecoration(CSSPropertyTextDecoration, important); >+} >+#endif // CSS3_TEXT >+ > bool CSSParser::parseTextEmphasisStyle(bool important) > { > unsigned valueListSize = m_valueList->size(); >diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h >index 5f99e6226e0c3be773624515bf1acbf0b318dfdf..ff77b68d1d7f372a27f22b89448f9b0beb22399d 100644 >--- a/Source/WebCore/css/CSSParser.h >+++ b/Source/WebCore/css/CSSParser.h >@@ -241,6 +241,9 @@ public: > > void addTextDecorationProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important); > bool parseTextDecoration(CSSPropertyID propId, bool important); >+#if ENABLE(CSS3_TEXT) >+ bool parseTextDecorationShorthand(bool important); >+#endif // CSS3_TEXT > > bool parseLineBoxContain(bool important); > bool parseCalculation(CSSParserValue*, CalculationPermittedValueRange); >diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp >index 3bff5abde1281bce276368ce2583d73f261349da..84cf212eb041dbedee4da702c8e878bd772496b2 100644 >--- a/Source/WebCore/css/StylePropertyShorthand.cpp >+++ b/Source/WebCore/css/StylePropertyShorthand.cpp >@@ -406,6 +406,19 @@ const StylePropertyShorthand& webkitTextEmphasisShorthand() > return webkitTextEmphasisLonghands; > } > >+#if ENABLE(CSS3_TEXT) >+const StylePropertyShorthand& webkitTextDecorationShorthand() >+{ >+ static const CSSPropertyID textDecorationProperties[] = { >+ CSSPropertyWebkitTextDecorationLine, >+ CSSPropertyWebkitTextDecorationStyle, >+ CSSPropertyWebkitTextDecorationColor >+ }; >+ DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextDecorationLonghands, (textDecorationProperties, WTF_ARRAY_LENGTH(textDecorationProperties))); >+ return webkitTextDecorationLonghands; >+} >+#endif // CSS3_TEXT >+ > const StylePropertyShorthand& webkitTextStrokeShorthand() > { > static const CSSPropertyID textStrokeProperties[] = { CSSPropertyWebkitTextStrokeWidth, CSSPropertyWebkitTextStrokeColor }; >diff --git a/Source/WebCore/css/StylePropertyShorthand.h b/Source/WebCore/css/StylePropertyShorthand.h >index 5ead8ab9ae731241aa167e0db1f1b22d7d81b9bf..e093e2cbf74c264022eab5756f256feff151cd57 100644 >--- a/Source/WebCore/css/StylePropertyShorthand.h >+++ b/Source/WebCore/css/StylePropertyShorthand.h >@@ -96,6 +96,9 @@ const StylePropertyShorthand& webkitMaskShorthand(); > const StylePropertyShorthand& webkitMaskPositionShorthand(); > const StylePropertyShorthand& webkitMaskRepeatShorthand(); > const StylePropertyShorthand& webkitTextEmphasisShorthand(); >+#if ENABLE(CSS3_TEXT) >+const StylePropertyShorthand& webkitTextDecorationShorthand(); >+#endif // CSS3_TEXT > const StylePropertyShorthand& webkitTextStrokeShorthand(); > const StylePropertyShorthand& webkitTransitionShorthand(); > const StylePropertyShorthand& webkitTransformOriginShorthand(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 238061dc013d0916eccc48001d91dc211e5181d5..b981396bd1cd0b27b5d6bb1cb7830013456b0bf4 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2012-10-25 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> >+ >+ [css3-text] Add support for "text-decoration" using CSS3 spec >+ https://bugs.webkit.org/show_bug.cgi?id=92000 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added getComputedStyle layout tests to check both shorthand and CSS2.1 >+ backwards-compatible behavior of "text-decoration" property. >+ >+ * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt: Added. >+ * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html: Added. >+ * fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-shorthand.js: Added. >+ > 2012-10-25 Balazs Kelemen <kbalazs@webkit.org> > > [Qt] Pixel tests need rebaseline >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e24b9eab8d2c94c4956ac874b971719fe241e5f7 >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt >@@ -0,0 +1,39 @@ >+Test to make sure text-decoration property is backwards compatible with CSS 2.1 and CSS 3 shorthand. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Initial values: >+PASS e.style.getPropertyCSSValue('text-decoration') is null >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-line') is null >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-style') is null >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-color') is null >+ >+CSS2.1 backwards compatibility ("text-decoration: underline overline line-through blink;"): >+PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' >+PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-line') is null >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-style') is null >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-color') is null >+PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' >+PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-line').cssText is 'underline overline line-through' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-style').cssText is 'solid' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-color').cssText is 'rgb(0, 0, 0)' >+ >+CSS3 Shorthand: >+PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' >+PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-line').cssText is 'underline overline line-through' >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-style').cssText is 'dashed' >+PASS e.style.getPropertyCSSValue('-webkit-text-decoration-color').cssText is 'red' >+PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' >+PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-line').cssText is 'underline overline line-through' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-style').cssText is 'dashed' >+PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-color').cssText is 'rgb(255, 0, 0)' >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cc2cf4747850f7562a4479dbd8d688dfb3190a06 >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html >@@ -0,0 +1,10 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../js/resources/js-test-pre.js"></script> >+</head> >+<body> >+<script src="script-tests/getComputedStyle-text-decoration-shorthand.js"></script> >+<script src="../../js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-shorthand.js b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-shorthand.js >new file mode 100644 >index 0000000000000000000000000000000000000000..435760625209b518f7bc03d1cff5e349875999af >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-shorthand.js >@@ -0,0 +1,49 @@ >+description("Test to make sure text-decoration property is backwards compatible with CSS 2.1 and CSS 3 shorthand.") >+ >+var testContainer = document.createElement("div"); >+testContainer.contentEditable = true; >+document.body.appendChild(testContainer); >+ >+testContainer.innerHTML = '<div id="test">hello</div>'; >+ >+debug('Initial values:'); >+e = document.getElementById('test'); >+shouldBeNull("e.style.getPropertyCSSValue('text-decoration')"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-line')"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-style')"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-color')"); >+debug(''); >+ >+debug('CSS2.1 backwards compatibility ("text-decoration: underline overline line-through blink;"):'); >+e.style.textDecoration = "underline overline line-through blink"; >+shouldBe("e.style.getPropertyCSSValue('text-decoration').toString()", "'[object CSSValueList]'"); >+shouldBe("e.style.getPropertyCSSValue('text-decoration').cssText", "'underline overline line-through'"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-line')"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-style')"); >+shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-color')"); >+ >+computedStyle = window.getComputedStyle(e, null); >+shouldBe("computedStyle.getPropertyCSSValue('text-decoration').toString()", "'[object CSSValueList]'"); >+shouldBe("computedStyle.getPropertyCSSValue('text-decoration').cssText", "'underline overline line-through'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-line').cssText", "'underline overline line-through'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-style').cssText", "'solid'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-color').cssText", "'rgb(0, 0, 0)'"); >+debug(''); >+ >+debug('CSS3 Shorthand:'); >+e.style.textDecoration = "underline overline line-through dashed red blink"; >+shouldBe("e.style.getPropertyCSSValue('text-decoration').toString()", "'[object CSSValueList]'"); >+shouldBe("e.style.getPropertyCSSValue('text-decoration').cssText", "'underline overline line-through'"); >+shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-line').cssText", "'underline overline line-through'"); >+shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-style').cssText", "'dashed'"); >+shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-color').cssText", "'red'"); >+ >+computedStyle = window.getComputedStyle(e, null); >+shouldBe("computedStyle.getPropertyCSSValue('text-decoration').toString()", "'[object CSSValueList]'"); >+shouldBe("computedStyle.getPropertyCSSValue('text-decoration').cssText", "'underline overline line-through'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-line').cssText", "'underline overline line-through'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-style').cssText", "'dashed'"); >+shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-color').cssText", "'rgb(255, 0, 0)'"); >+debug(''); >+ >+document.body.removeChild(testContainer);
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 92000
:
153811
|
155021
|
155146
|
157234
|
158833
|
159137
|
159170
|
161695
|
161702
|
170667
|
170972
|
171241
|
179064
|
193065
|
204163
|
204164
|
204165
|
204166
|
204338
|
206613
|
206619
|
209114