https://bugs.webkit.org/show_bug.cgi?id=79914
Reviewed by Tony Chang.
Change the initial value of text-align CSS property from -webkit-auto to start as specified in
http://www.w3.org/TR/css3-text/#text-align
In editing, we have to coerce start and end to left and right for now because match-parent,
which is the text-align value of li in UA stylesheet is going to result in the computed values of
left as supposed to start by default, and this causes editing code not being able to remove
text-align: left when computing typing styles and preserving styles.
In the long term, we should detect this specific case and ignore match-parent but that seemed like
too much work to be done in a single patch also because the test result improved because of this change.
This behavior change is covered by existing regression tests.
* accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
(WebCore::getAttributeSetForAccessibilityObject):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): No longer supports TAAUTO since it's identical to TASTART.
(WebCore::CSSPrimitiveValue::operator ETextAlign): Ditto. Parse -webkit-auto as start.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList): Replace TAAUTO by TASTART.
* editing/EditingStyle.cpp:
(WebCore):
(WebCore::textAlignResolvingStartAndEnd): Coerce start and end into left and right based on the directionality
for editing. Otherwise, we end up adding lots of text-align: left due to li's UA style rule having match-parent
as the text alignment and its descendent inherits this style. We need to handle it better in the future
since start and left or end and right are semantically different.
(WebCore::EditingStyle::prepareToApplyAt):
(WebCore::getPropertiesNotIn):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::textAlignmentForLine): Justified text is aligned at start by default.
(WebCore::RenderBlock::updateLogicalWidthForAlignment):
(WebCore::RenderBlock::startAlignedOffsetForLine):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::localCaretRectForEmptyElement):
* rendering/RenderListBox.cpp:
(WebCore::itemOffsetForAlignment):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::updateMarqueeStyle):
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::textAlignmentForLine):
(WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
* rendering/RenderText.cpp:
(WebCore::RenderText::localCaretRect):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
LayoutTests: The default value of text-align should be start instead of -webkit-auto
https://bugs.webkit.org/show_bug.cgi?id=79914
Reviewed by Tony Chang.
Rebaselined tests. For query-text-alignment.html, we now match start and end
with justifyLeft and justifyRight, which appears to be consistent with Firefox for time being.
* editing/execCommand/query-text-alignment-expected.txt:
* editing/execCommand/script-tests/query-text-alignment.js:
(queryTextAlignment):
(selectFirstPosition):
(selectMiddleOfHelloWorld):
(runRangeTests):
* editing/pasteboard/paste-4039777-fix-expected.txt:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/list-item-text-align.html:
* fast/css/text-align-initial-expected.html: Renamed from fast/css/text-align-webkit-auto-expected.html.
* fast/css/text-align-initial.html: Ditto.
* fast/events/ondrop-text-html-expected.txt:
* platform/chromium-linux-x86/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-linux/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-mac-leopard/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/chromium-mac-leopard/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-mac-snowleopard/fast/lists/001-expected.png:
* platform/chromium-mac-snowleopard/fast/lists/001-vertical-expected.png:
* platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-mac/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/chromium-mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/chromium-mac/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-win-vista/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-win-xp/svg/css/getComputedStyle-basic-expected.txt:
* platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
* platform/gtk/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/gtk/svg/css/getComputedStyle-basic-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac/fast/lists/001-expected.txt:
* platform/mac/fast/lists/001-vertical-expected.txt:
* platform/mac/svg/css/getComputedStyle-basic-expected.txt:
* platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/qt/svg/css/getComputedStyle-basic-expected.txt:
* platform/win/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120495
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-14 Ryosuke Niwa <rniwa@webkit.org>
+
+ The default value of text-align should be start instead of -webkit-auto
+ https://bugs.webkit.org/show_bug.cgi?id=79914
+
+ Reviewed by Tony Chang.
+
+ Rebaselined tests. For query-text-alignment.html, we now match start and end
+ with justifyLeft and justifyRight, which appears to be consistent with Firefox for time being.
+
+ * editing/execCommand/query-text-alignment-expected.txt:
+ * editing/execCommand/script-tests/query-text-alignment.js:
+ (queryTextAlignment):
+ (selectFirstPosition):
+ (selectMiddleOfHelloWorld):
+ (runRangeTests):
+ * editing/pasteboard/paste-4039777-fix-expected.txt:
+ * fast/css/getComputedStyle/computed-style-expected.txt:
+ * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * fast/css/list-item-text-align.html:
+ * fast/css/text-align-initial-expected.html: Renamed from fast/css/text-align-webkit-auto-expected.html.
+ * fast/css/text-align-initial.html: Ditto.
+ * fast/events/ondrop-text-html-expected.txt:
+ * platform/chromium-linux-x86/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-linux/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-mac-leopard/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/chromium-mac-leopard/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-mac-snowleopard/fast/lists/001-expected.png:
+ * platform/chromium-mac-snowleopard/fast/lists/001-vertical-expected.png:
+ * platform/chromium-mac-snowleopard/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-mac/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/chromium-mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * platform/chromium-mac/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-win-vista/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-win-xp/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/chromium-win/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/chromium-win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/gtk/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/gtk/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * platform/mac/fast/lists/001-expected.txt:
+ * platform/mac/fast/lists/001-vertical-expected.txt:
+ * platform/mac/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/qt/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * platform/qt/svg/css/getComputedStyle-basic-expected.txt:
+ * platform/win/fast/css/getComputedStyle/computed-style-expected.txt:
+ * platform/win/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * svg/css/getComputedStyle-basic-expected.txt:
+
2012-06-15 Jian Li <jianli@chromium.org>
[File API] FileReader should work in sandbox iframe
Caret
PASS queryCommand('format') returns "" when selecting no selection on of "hello"
-PASS queryCommand('format') returns "" when selecting first position of "hello"
-PASS queryCommand('format') returns "" when selecting first position of "<p>hello</p>"
+PASS queryCommand('format') returns "left" when selecting first position of "hello"
+PASS queryCommand('format') returns "left" when selecting first position of "<p>hello</p>"
PASS queryCommand('format') returns "center" when selecting first position of "<p align="center">hello</p>"
PASS queryCommand('format') returns "full" when selecting first position of "<p align="justify">hello</p>"
PASS queryCommand('format') returns "left" when selecting first position of "<p align="left">hello</p>"
PASS queryCommand('format') returns "left" when selecting first position of "<p align="right" style="text-align: left;">hello</p>"
PASS queryCommand('format') returns "right" when selecting first position of "<p align="center" style="text-align: right;">hello</p>"
PASS queryCommand('format') returns "center" when selecting first position of "<p align="left" style="text-align: center;">hello</p>"
-PASS queryCommand('format') returns "" when selecting first position of "<h1>hello</h1>"
+PASS queryCommand('format') returns "left" when selecting first position of "<h1>hello</h1>"
PASS queryCommand('format') returns "center" when selecting first position of "<h1 align="center">hello</h1>"
PASS queryCommand('format') returns "full" when selecting first position of "<h1 align="justify">hello</h1>"
PASS queryCommand('format') returns "left" when selecting first position of "<h2 align="left">hello</h2>"
PASS queryCommand('format') returns "right" when selecting first position of "<div align="right">hello</div>"
Tests for win
-PASS queryCommand('format') returns "" when selecting middle of "<p>hello</p><p>world</p>"
-PASS queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p>world</p>"
-PASS queryCommand('format') returns "" when selecting middle of "<p>hello</p><p align="left">world</p>"
+PASS queryCommand('format') returns "left" when selecting middle of "<p>hello</p><p>world</p>"
+PASS queryCommand('format') returns "" when selecting middle of "<p align="right">hello</p><p>world</p>"
+PASS queryCommand('format') returns "left" when selecting middle of "<p>hello</p><p align="left">world</p>"
PASS queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p align="right">world</p>"
PASS queryCommand('format') returns "center" when selecting middle of "<p align="center">hello</p><p align="center">world</p>"
PASS queryCommand('format') returns "full" when selecting middle of "<p align="justify">hello</p><p align="justify">world</p>"
PASS queryCommand('format') returns "right" when selecting middle of "<p align="right">hello</p><p align="right">world</p>"
PASS queryCommand('format') returns "" when selecting middle of "<div align="right">hello<p align="left">world</p></div>"
PASS queryCommand('format') returns "" when selecting middle of "<div align="left"><p align="center">world</p>hello</div>"
-PASS queryCommand('format') returns "" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>"
+PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p>w</p><p align="left">orld</p>"
PASS queryCommand('format') returns "" when selecting middle of "<p align="justify">hello</p><p>w</p><p align="center">orld</p>"
Tests for mac
-PASS queryCommand('format') returns "" when selecting middle of "<p>hello</p><p>world</p>"
-PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p>world</p>"
-PASS queryCommand('format') returns "" when selecting middle of "<p>hello</p><p align="left">world</p>"
+PASS queryCommand('format') returns "left" when selecting middle of "<p>hello</p><p>world</p>"
+PASS queryCommand('format') returns "right" when selecting middle of "<p align="right">hello</p><p>world</p>"
+PASS queryCommand('format') returns "left" when selecting middle of "<p>hello</p><p align="left">world</p>"
PASS queryCommand('format') returns "left" when selecting middle of "<p align="left">hello</p><p align="right">world</p>"
PASS queryCommand('format') returns "center" when selecting middle of "<p align="center">hello</p><p align="center">world</p>"
PASS queryCommand('format') returns "full" when selecting middle of "<p align="justify">hello</p><p align="justify">world</p>"
function selectFirstPosition(container) {
while (container.firstChild)
container = container.firstChild;
- window.getSelection().setPosition(container, 0);
+ window.getSelection().collapse(container, 0);
return 'first position';
}
function selectMiddleOfHelloWorld(container) {
- window.getSelection().setPosition(container, 0);
+ window.getSelection().collapse(container, 0);
window.getSelection().modify('move', 'forward', 'character');
window.getSelection().modify('move', 'forward', 'character');
window.getSelection().modify('extend', 'forward', 'word');
debug('Caret');
queryTextAlignment(function () {return 'no selection on'}, 'hello', '');
-queryTextAlignment(selectFirstPosition, 'hello', '');
-queryTextAlignment(selectFirstPosition, '<p>hello</p>', '');
+queryTextAlignment(selectFirstPosition, 'hello', 'left');
+queryTextAlignment(selectFirstPosition, '<p>hello</p>', 'left');
queryTextAlignment(selectFirstPosition, '<p align="center">hello</p>', 'center');
queryTextAlignment(selectFirstPosition, '<p align="justify">hello</p>', 'full');
queryTextAlignment(selectFirstPosition, '<p align="left">hello</p>', 'left');
queryTextAlignment(selectFirstPosition, '<p align="right" style="text-align: left;">hello</p>', 'left');
queryTextAlignment(selectFirstPosition, '<p align="center" style="text-align: right;">hello</p>', 'right');
queryTextAlignment(selectFirstPosition, '<p align="left" style="text-align: center;">hello</p>', 'center');
-queryTextAlignment(selectFirstPosition, '<h1>hello</h1>', '');
+queryTextAlignment(selectFirstPosition, '<h1>hello</h1>', 'left');
queryTextAlignment(selectFirstPosition, '<h1 align="center">hello</h1>', 'center');
queryTextAlignment(selectFirstPosition, '<h1 align="justify">hello</h1>', 'full');
queryTextAlignment(selectFirstPosition, '<h2 align="left">hello</h2>', 'left');
internals.settings.setEditingBehavior(editingBehavior);
debug('Tests for ' + editingBehavior);
- queryTextAlignment(selectMiddleOfHelloWorld, '<p>hello</p><p>world</p>', '');
- queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p>world</p>', {'mac': 'left', 'win': ''}[editingBehavior]);
- queryTextAlignment(selectMiddleOfHelloWorld, '<p>hello</p><p align="left">world</p>', '');
+ queryTextAlignment(selectMiddleOfHelloWorld, '<p>hello</p><p>world</p>', 'left');
+ queryTextAlignment(selectMiddleOfHelloWorld, '<p align="right">hello</p><p>world</p>', {'mac': 'right', 'win': ''}[editingBehavior]);
+ queryTextAlignment(selectMiddleOfHelloWorld, '<p>hello</p><p align="left">world</p>', 'left');
queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p align="right">world</p>', {'mac': 'left', 'win': ''}[editingBehavior]);
queryTextAlignment(selectMiddleOfHelloWorld, '<p align="center">hello</p><p align="center">world</p>', 'center');
queryTextAlignment(selectMiddleOfHelloWorld, '<p align="justify">hello</p><p align="justify">world</p>', 'full');
queryTextAlignment(selectMiddleOfHelloWorld, '<p align="right">hello</p><p align="right">world</p>', 'right');
queryTextAlignment(selectMiddleOfHelloWorld, '<div align="right">hello<p align="left">world</p></div>', {'mac': 'right', 'win': ''}[editingBehavior]);
queryTextAlignment(selectMiddleOfHelloWorld, '<div align="left"><p align="center">world</p>hello</div>', {'mac': 'center', 'win': ''}[editingBehavior]);
- queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p>w</p><p align="left">orld</p>', {'mac': 'left', 'win': ''}[editingBehavior]);
+ queryTextAlignment(selectMiddleOfHelloWorld, '<p align="left">hello</p><p>w</p><p align="left">orld</p>', {'mac': 'left', 'win': 'left'}[editingBehavior]);
queryTextAlignment(selectMiddleOfHelloWorld, '<p align="justify">hello</p><p>w</p><p align="center">orld</p>', {'mac': 'full', 'win': ''}[editingBehavior]);
}
DataTransferItem accessed outside event handler!
copy: items[0] value: Hello World!
copy: items[1] value: <b>Hello World!
-paste: items[0] value: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
+paste: items[0] value: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
paste: items[1] value: This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.
CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the clipboard during an onpaste event.
-CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space">Â </span></span>
+CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space">Â </span></span>
This test verifies that we can get text/html from the clipboard during an onpaste event. This test requires DRT.
Paste content in this div.This test verifies that we can get text/html from the clipboard during an onpaste event.Â
PASS
| <li>
| "A"
| <div>
-| style="text-align: -webkit-auto; "
+| style="text-align: start; "
| <ul>
| <li>
| <a>
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
<ul dir=ltr>
<li dir=ltr class=l><span>Left aligned</span></li>
- <li dir=rtl class=r><span>Right aligned</span></li>
+ <li dir=rtl class=l><span>Left aligned although this li has dir=rtl because li's text-align is match-parent by default.</span></li>
</ul>
<ul dir=ltr style="text-align:start">
var leftAlign = expectedAlignment == 'left';
if (window.layoutTestController) {
- if (computedStyle.textAlign == '-webkit-auto') {
+ if (computedStyle.textAlign == 'start') {
// For the case of -webkit-auto check the offset of the text on screen
// rather than examining the computed style.
var elementLeftEdge = enclosingListElement.children[0].offsetLeft;
window.layoutTestController.dumpAsText();
var textAlign = window.getComputedStyle(document.getElementById("div")).textAlign;
- if (textAlign == "-webkit-auto")
+ if (textAlign == "start")
document.body.innerText = "SUCCESS";
else
- document.body.innerText = "FAILURE. text-align was " + textAlign + ", it should have been -webkit-auto";
+ document.body.innerText = "FAILURE. text-align was " + textAlign + ", it should have been start";
}
</script>
</head>
CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the drag object during an ondrop event.
-CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space">Â </span></span>
+CONSOLE MESSAGE: line 23: text/html: <span style="color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space">Â </span></span>
This test verifies that we can get text/html from the drag object during an ondrop event. This test requires DRT.
PASS
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
RenderBlock {UL} at (0,124) size 784x124
RenderListItem {LI} at (40,0) size 744x124 [border: (2px solid #FF0000)]
RenderListMarker at (755,52) size 7x19: bullet
- RenderText {#text} at (215,52) size 477x19
- text run at (215,52) width 477: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl asjdlksajdk"
+ RenderText {#text} at (52,52) size 477x19
+ text run at (52,52) width 477: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl asjdlksajdk"
RenderBlock {UL} at (124,0) size 144x584
RenderListItem {LI} at (0,40) size 144x544 [border: (2px solid #FF0000)]
RenderListMarker at (52,555) size 19x7: bullet
- RenderText {#text} at (52,88) size 39x404
- text run at (52,88) width 404: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl"
- text run at (72,423) width 69: "asjdlksajdk"
+ RenderText {#text} at (52,52) size 39x404
+ text run at (52,52) width 404: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl"
+ text run at (72,52) width 69: "asjdlksajdk"
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
RenderBlock {UL} at (0,122) size 784x122
RenderListItem {LI} at (40,0) size 744x122 [border: (2px solid #FF0000)]
RenderListMarker at (754,52) size 7x18: bullet
- RenderText {#text} at (201,52) size 491x18
- text run at (201,52) width 491: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl asjdlksajdk"
+ RenderText {#text} at (52,52) size 491x18
+ text run at (52,52) width 491: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl asjdlksajdk"
RenderBlock {UL} at (122,0) size 140x584
RenderListItem {LI} at (0,40) size 140x544 [border: (2px solid #FF0000)]
RenderListMarker at (52,554) size 18x7: bullet
- RenderText {#text} at (52,75) size 36x417
- text run at (52,75) width 417: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl"
- text run at (70,422) width 70: "asjdlksajdk"
+ RenderText {#text} at (52,52) size 36x417
+ text run at (52,52) width 417: "Foo fofodfosjlkdf dslkdjlk asdlksjald djklsd klasjdkas sdajd lsadjkl"
+ text run at (70,52) width 70: "asjdlksajdk"
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
copy: items[0] value: Hello World!
copy: items[1] value: <b>Hello World!
paste: items[0] value: This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.
-paste: items[1] value: <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
+paste: items[1] value: <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">This file tests the basic functionality and properties of DataTransferItems. This test requires DRT.</span>
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(tab-size) : 8
rect: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
g: style.getPropertyValue(tab-size) : 8
g: style.getPropertyCSSValue(tab-size) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
speak: normal;
table-layout: auto;
tab-size: 8;
-text-align: -webkit-auto;
+text-align: start;
text-decoration: none;
text-indent: 0px;
text-rendering: auto;
speak: normal
table-layout: auto
tab-size: 8
- text-align: -webkit-auto
+ text-align: start
text-decoration: none
text-indent: 0px
text-rendering: auto
rect: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(table-layout) : auto
rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(text-align) : -webkit-auto
+rect: style.getPropertyValue(text-align) : start
rect: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-decoration) : none
rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
g: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
g: style.getPropertyValue(table-layout) : auto
g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(text-align) : -webkit-auto
+g: style.getPropertyValue(text-align) : start
g: style.getPropertyCSSValue(text-align) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-decoration) : none
g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue]
+2012-06-14 Ryosuke Niwa <rniwa@webkit.org>
+
+ The initial value of text-align should be start instead of -webkit-auto
+ https://bugs.webkit.org/show_bug.cgi?id=79914
+
+ Reviewed by Tony Chang.
+
+ Change the initial value of text-align CSS property from -webkit-auto to start as specified in
+ http://www.w3.org/TR/css3-text/#text-align
+
+ In editing, we have to coerce start and end to left and right for now because match-parent,
+ which is the text-align value of li in UA stylesheet is going to result in the computed values of
+ left as supposed to start by default, and this causes editing code not being able to remove
+ text-align: left when computing typing styles and preserving styles.
+
+ In the long term, we should detect this specific case and ignore match-parent but that seemed like
+ too much work to be done in a single patch also because the test result improved because of this change.
+
+ This behavior change is covered by existing regression tests.
+
+ * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
+ (WebCore::getAttributeSetForAccessibilityObject):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): No longer supports TAAUTO since it's identical to TASTART.
+ (WebCore::CSSPrimitiveValue::operator ETextAlign): Ditto. Parse -webkit-auto as start.
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::collectMatchingRulesForList): Replace TAAUTO by TASTART.
+ * editing/EditingStyle.cpp:
+ (WebCore):
+ (WebCore::textAlignResolvingStartAndEnd): Coerce start and end into left and right based on the directionality
+ for editing. Otherwise, we end up adding lots of text-align: left due to li's UA style rule having match-parent
+ as the text alignment and its descendent inherits this style. We need to handle it better in the future
+ since start and left or end and right are semantically different.
+ (WebCore::EditingStyle::prepareToApplyAt):
+ (WebCore::getPropertiesNotIn):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::textAlignmentForLine): Justified text is aligned at start by default.
+ (WebCore::RenderBlock::updateLogicalWidthForAlignment):
+ (WebCore::RenderBlock::startAlignedOffsetForLine):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::localCaretRectForEmptyElement):
+ * rendering/RenderListBox.cpp:
+ (WebCore::itemOffsetForAlignment):
+ * rendering/RenderMarquee.cpp:
+ (WebCore::RenderMarquee::updateMarqueeStyle):
+ * rendering/RenderRubyText.cpp:
+ (WebCore::RenderRubyText::textAlignmentForLine):
+ (WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::localCaretRect):
+ * rendering/style/RenderStyle.h:
+ * rendering/style/RenderStyleConstants.h:
+
2012-06-15 Jian Li <jianli@chromium.org>
[File API] FileReader should work in sandbox iframe
}
switch (style->textAlign()) {
- case TAAUTO:
case TASTART:
case TAEND:
break;
}
case CSSPropertyTextAlign:
- // left | right | center | justify | webkit_left | webkit_right | webkit_center | webkit_match_parent |
- // start | end | <string> | inherit
+ // left | right | center | justify | -webkit-left | -webkit-right | -webkit-center | -webkit-match-parent
+ // | start | end | <string> | inherit | -webkit-auto (converted to start)
if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd
|| value->unit == CSSPrimitiveValue::CSS_STRING)
validPrimitive = true;
{
m_primitiveUnitType = CSS_IDENT;
switch (e) {
- case TAAUTO:
- m_value.ident = CSSValueWebkitAuto;
- break;
case TASTART:
m_value.ident = CSSValueStart;
break;
template<> inline CSSPrimitiveValue::operator ETextAlign() const
{
switch (m_value.ident) {
- case CSSValueStart:
- return TASTART;
- case CSSValueEnd:
- return TAEND;
- default:
- return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto);
+ case CSSValueWebkitAuto: // Legacy -webkit-auto. Eqiuvalent to start.
+ case CSSValueStart:
+ return TASTART;
+ case CSSValueEnd:
+ return TAEND;
+ default:
+ return static_cast<ETextAlign>(m_value.ident - CSSValueLeft);
}
}
// Tables never support the -webkit-* values for text-align and will reset back to the default.
if (e && e->hasTagName(tableTag) && (style->textAlign() == WEBKIT_LEFT || style->textAlign() == WEBKIT_CENTER || style->textAlign() == WEBKIT_RIGHT))
- style->setTextAlign(TAAUTO);
+ style->setTextAlign(TASTART);
// Frames and framesets never honor position:relative or position:absolute. This is necessary to
// fix a crash where a site tries to position these objects. They also never honor display.
style->setFloating(NoFloat);
}
- // Table headers with a text-align of auto will change the text-align to center.
- if (e && e->hasTagName(thTag) && style->textAlign() == TAAUTO)
+ // FIXME: We shouldn't be overriding start/-webkit-auto like this. Do it in html.css instead.
+ // Table headers with a text-align of -webkit-auto will change the text-align to center.
+ if (e && e->hasTagName(thTag) && style->textAlign() == TASTART)
style->setTextAlign(CENTER);
if (e && e->hasTagName(legendTag))
return cssValueToRGBA(backgroundColorInEffect(node).get());
}
+static int textAlignResolvingStartAndEnd(int textAlign, int direction)
+{
+ switch (textAlign) {
+ case CSSValueCenter:
+ case CSSValueWebkitCenter:
+ return CSSValueCenter;
+ case CSSValueJustify:
+ return CSSValueJustify;
+ case CSSValueLeft:
+ case CSSValueWebkitLeft:
+ return CSSValueLeft;
+ case CSSValueRight:
+ case CSSValueWebkitRight:
+ return CSSValueRight;
+ case CSSValueStart:
+ return direction != CSSValueRtl ? CSSValueLeft : CSSValueRight;
+ case CSSValueEnd:
+ return direction == CSSValueRtl ? CSSValueRight : CSSValueLeft;
+ }
+ return CSSValueInvalid;
+}
+
+template<typename T>
+static int textAlignResolvingStartAndEnd(T* style)
+{
+ return textAlignResolvingStartAndEnd(getIdentifierValue(style, CSSPropertyTextAlign), getIdentifierValue(style, CSSPropertyDirection));
+}
+
void EditingStyle::init(Node* node, PropertiesToInclude propertiesToInclude)
{
if (isTabSpanTextNode(node))
// ReplaceSelectionCommand::handleStyleSpans() requires that this function only removes the editing style.
// If this function was modified in the future to delete all redundant properties, then add a boolean value to indicate
// which one of editingStyleAtPosition or computedStyle is called.
- RefPtr<EditingStyle> style = EditingStyle::create(position, EditingPropertiesInEffect);
+ RefPtr<EditingStyle> editingStyleAtPosition = EditingStyle::create(position, EditingPropertiesInEffect);
+ StylePropertySet* styleAtPosition = editingStyleAtPosition->m_mutableStyle.get();
RefPtr<CSSValue> unicodeBidi;
RefPtr<CSSValue> direction;
direction = m_mutableStyle->getPropertyCSSValue(CSSPropertyDirection);
}
- m_mutableStyle->removeEquivalentProperties(style->m_mutableStyle.get());
+ m_mutableStyle->removeEquivalentProperties(styleAtPosition);
- if (getRGBAFontColor(m_mutableStyle.get()) == getRGBAFontColor(style->m_mutableStyle.get()))
+ if (textAlignResolvingStartAndEnd(m_mutableStyle.get()) == textAlignResolvingStartAndEnd(styleAtPosition))
+ m_mutableStyle->removeProperty(CSSPropertyTextAlign);
+
+ if (getRGBAFontColor(m_mutableStyle.get()) == getRGBAFontColor(styleAtPosition))
m_mutableStyle->removeProperty(CSSPropertyColor);
if (hasTransparentBackgroundColor(m_mutableStyle.get())
return fontWeightIsBold(fontWeight.get());
}
-static int getTextAlignment(int textAlignIdentifierValue)
-{
- switch (textAlignIdentifierValue) {
- case CSSValueCenter:
- case CSSValueWebkitCenter:
- return CSSValueCenter;
- case CSSValueJustify:
- return CSSValueJustify;
- case CSSValueLeft:
- case CSSValueWebkitLeft:
- return CSSValueLeft;
- case CSSValueRight:
- case CSSValueWebkitRight:
- return CSSValueRight;
- }
- return CSSValueInvalid;
-}
-
-static int getTextAlignment(CSSStyleDeclaration* style)
-{
- return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign));
-}
-
-static int getTextAlignment(StylePropertySet* style)
-{
- return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign));
-}
-
PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle)
{
ASSERT(styleWithRedundantProperties);
if (baseStyle->getPropertyCSSValueInternal(CSSPropertyColor) && getRGBAFontColor(result.get()) == getRGBAFontColor(baseStyle))
result->removeProperty(CSSPropertyColor);
- if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign) && getTextAlignment(result.get()) == getTextAlignment(baseStyle))
+ if (baseStyle->getPropertyCSSValueInternal(CSSPropertyTextAlign)
+ && textAlignResolvingStartAndEnd(result.get()) == textAlignResolvingStartAndEnd(baseStyle))
result->removeProperty(CSSPropertyTextAlign);
return result;
{
ETextAlign alignment = style()->textAlign();
if (!endsWithSoftBreak && alignment == JUSTIFY)
- alignment = TAAUTO;
+ alignment = TASTART;
return alignment;
}
case WEBKIT_LEFT:
updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
break;
+ case RIGHT:
+ case WEBKIT_RIGHT:
+ updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
+ break;
+ case CENTER:
+ case WEBKIT_CENTER:
+ updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
+ break;
case JUSTIFY:
adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, availableLogicalWidth);
if (expansionOpportunityCount) {
}
break;
}
- // fall through
- case TAAUTO:
- // for right to left fall through to right aligned
- if (style()->isLeftToRightDirection()) {
- if (totalLogicalWidth > availableLogicalWidth && trailingSpaceRun)
- trailingSpaceRun->m_box->setLogicalWidth(max<float>(0, trailingSpaceRun->m_box->logicalWidth() - totalLogicalWidth + availableLogicalWidth));
- break;
- }
- case RIGHT:
- case WEBKIT_RIGHT:
- updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
- break;
- case CENTER:
- case WEBKIT_CENTER:
- updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
- break;
+ // Fall through
case TASTART:
if (style()->isLeftToRightDirection())
updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
{
ETextAlign textAlign = style()->textAlign();
- if (textAlign == TAAUTO)
+ if (textAlign == TASTART) // FIXME: Handle TAEND here
return startOffsetForLine(position, firstLine);
// updateLogicalWidthForAlignment() handles the direction of the block so no need to consider it here
CaretAlignment alignment = alignLeft;
switch (currentStyle->textAlign()) {
- case TAAUTO:
- case JUSTIFY:
- if (!currentStyle->isLeftToRightDirection())
- alignment = alignRight;
- break;
case LEFT:
case WEBKIT_LEFT:
break;
case WEBKIT_RIGHT:
alignment = alignRight;
break;
+ case JUSTIFY:
case TASTART:
if (!currentStyle->isLeftToRightDirection())
alignment = alignRight;
{
ETextAlign actualAlignment = itemStyle->textAlign();
// FIXME: Firefox doesn't respect JUSTIFY. Should we?
- if (actualAlignment == TAAUTO || actualAlignment == JUSTIFY)
+ // FIXME: Handle TAEND here
+ if (actualAlignment == TASTART || actualAlignment == JUSTIFY)
actualAlignment = itemStyle->isLeftToRightDirection() ? LEFT : RIGHT;
LayoutSize offset = LayoutSize(0, itemFont.fontMetrics().ascent());
// FIXME: Bring these up with the CSS WG.
if (isHorizontal() && m_layer->renderer()->childrenInline()) {
s->setWhiteSpace(NOWRAP);
- s->setTextAlign(TAAUTO);
+ s->setTextAlign(TASTART);
}
}
ETextAlign RenderRubyText::textAlignmentForLine(bool endsWithSoftBreak) const
{
ETextAlign textAlign = style()->textAlign();
- if (textAlign != TAAUTO)
+ // FIXME: This check is bogus since user can set the initial value.
+ if (textAlign != RenderStyle::initialTextAlign())
return RenderBlock::textAlignmentForLine(endsWithSoftBreak);
// The default behavior is to allow ruby text to expand if it is shorter than the ruby base.
void RenderRubyText::adjustInlineDirectionLineBounds(int expansionOpportunityCount, float& logicalLeft, float& logicalWidth) const
{
ETextAlign textAlign = style()->textAlign();
- if (textAlign != TAAUTO)
+ // FIXME: This check is bogus since user can set the initial value.
+ if (textAlign != RenderStyle::initialTextAlign())
return RenderBlock::adjustInlineDirectionLineBounds(expansionOpportunityCount, logicalLeft, logicalWidth);
int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth();
bool rightAligned = false;
switch (cbStyle->textAlign()) {
- case TAAUTO:
- case JUSTIFY:
- rightAligned = !cbStyle->isLeftToRightDirection();
- break;
case RIGHT:
case WEBKIT_RIGHT:
rightAligned = true;
case CENTER:
case WEBKIT_CENTER:
break;
+ case JUSTIFY:
case TASTART:
rightAligned = !cbStyle->isLeftToRightDirection();
break;
static short initialWidows() { return 2; }
static short initialOrphans() { return 2; }
static Length initialLineHeight() { return Length(-100.0, Percent); }
- static ETextAlign initialTextAlign() { return TAAUTO; }
+ static ETextAlign initialTextAlign() { return TASTART; }
static ETextDecoration initialTextDecoration() { return TDNONE; }
static float initialZoom() { return 1.0f; }
static int initialOutlineOffset() { return 0; }
// The order of this enum must match the order of the text align values in CSSValueKeywords.in.
enum ETextAlign {
- TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
+ LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
};
enum ETextTransform {