Commit 95d2be07 authored by ddkilzer's avatar ddkilzer

LayoutTests:

        Patch and review by hyatt.  Testing and landing by ddkilzer.

        <rdar://problem/5078866>
        tables don't inherit text-align (in strict mode; they're not supposed to in quirks mode)

        Test tables/mozilla_expected_failures/bugs/bug11384s.html progressed after this fix, so
        it was moved to tables/mozilla/bugs/bug11384s.html.

        * fast/css/table-text-align-quirk-expected.checksum: Added.
        * fast/css/table-text-align-quirk-expected.png: Added.
        * fast/css/table-text-align-quirk-expected.txt: Added.
        * fast/css/table-text-align-quirk.html: Added.
        * fast/css/table-text-align-strict-expected.checksum: Added.
        * fast/css/table-text-align-strict-expected.png: Added.
        * fast/css/table-text-align-strict-expected.txt: Added.
        * fast/css/table-text-align-strict.html: Added.
        * fast/table/border-collapsing/rtl-border-collapsing.html: Replaced "text-align: -khtml-center"
        style with "text-align: center" style.
        * tables/mozilla/bugs/bug11384s-expected.checksum: Added.
        * tables/mozilla/bugs/bug11384s-expected.png: Added.
        * tables/mozilla/bugs/bug11384s-expected.txt: Added.
        * tables/mozilla/bugs/bug11384s.html: Added.
        * tables/mozilla_expected_failures/bugs/bug11384s-expected.checksum: Removed.
        * tables/mozilla_expected_failures/bugs/bug11384s-expected.png: Removed.
        * tables/mozilla_expected_failures/bugs/bug11384s-expected.txt: Removed.
        * tables/mozilla_expected_failures/bugs/bug11384s.html: Removed.

WebCore:

        Patch and review by hyatt.  Testing and landing by ddkilzer.

        <rdar://problem/5078866>
        tables don't inherit text-align (in strict mode; they're not supposed to in quirks mode)

        Test: fast/css/table-text-align-quirk.html
              fast/css/table-text-align-strict.html

        Previous commit (r20731) removed the wrong property from WebCore/css/html4.css.  However,
        when the correct property was removed, it caused tables to inherit alignment properties
        from tags like <center> and <div align="center">.  This is fixed in
        WebCore::CSSStyleSelector::adjustRenderStyle() by special-casing tables to reset the
        text-align property.

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::valueForTextAlign): Renamed KHTML_CENTER, KHTML_LEFT and KHTML_RIGHT to
        WEBKIT_CENTER, WEBKIT_LEFT and WEBKIT_RIGHT.
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseValue): Ditto.
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle): Tables should not support -webkit-center,
        -webkit-left or -webkit-right values for text-align, so reset them back to auto.
        * css/html4.css: Removed "text-align: -webkit-auto;" property from tables selector.  It
        was previously added to css/quirks.css in r20731.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::determineHorizontalPosition): Renamed KHTML_* to WEBKIT_*.
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calcHorizontalMargins): Ditto.
        * rendering/RenderFlow.cpp:
        (WebCore::RenderFlow::caretRect): Ditto.
        * rendering/RenderStyle.h: Ditto.
        (WebCore::):
        * rendering/bidi.cpp:
        (WebCore::RenderBlock::computeHorizontalPositionsForLine): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7c50d652
2007-04-13 David Kilzer <ddkilzer@webkit.org>
Patch and review by hyatt. Testing and landing by ddkilzer.
<rdar://problem/5078866>
tables don't inherit text-align (in strict mode; they're not supposed to in quirks mode)
Test tables/mozilla_expected_failures/bugs/bug11384s.html progressed after this fix, so
it was moved to tables/mozilla/bugs/bug11384s.html.
* fast/css/table-text-align-quirk-expected.checksum: Added.
* fast/css/table-text-align-quirk-expected.png: Added.
* fast/css/table-text-align-quirk-expected.txt: Added.
* fast/css/table-text-align-quirk.html: Added.
* fast/css/table-text-align-strict-expected.checksum: Added.
* fast/css/table-text-align-strict-expected.png: Added.
* fast/css/table-text-align-strict-expected.txt: Added.
* fast/css/table-text-align-strict.html: Added.
* fast/table/border-collapsing/rtl-border-collapsing.html: Replaced "text-align: -khtml-center"
style with "text-align: center" style.
* tables/mozilla/bugs/bug11384s-expected.checksum: Added.
* tables/mozilla/bugs/bug11384s-expected.png: Added.
* tables/mozilla/bugs/bug11384s-expected.txt: Added.
* tables/mozilla/bugs/bug11384s.html: Added.
* tables/mozilla_expected_failures/bugs/bug11384s-expected.checksum: Removed.
* tables/mozilla_expected_failures/bugs/bug11384s-expected.png: Removed.
* tables/mozilla_expected_failures/bugs/bug11384s-expected.txt: Removed.
* tables/mozilla_expected_failures/bugs/bug11384s.html: Removed.
2007-04-13 Brady Eidson <beidson@apple.com>
Reviewed by a sanity check
dbabfcc3519bae867d8d2b3763e421b2
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 784x18
RenderText {#text} at (0,0) size 541x18
text run at (0,0) width 541: "The text below should be left-justified since text-align does not inherit in quirks mode."
RenderBlock {DIV} at (0,18) size 784x26
RenderTable {TABLE} at (0,0) size 108x26 [border: (1px solid #000000)]
RenderTableSection {TBODY} at (1,1) size 106x24
RenderTableRow {TR} at (0,2) size 106x20
RenderTableCell {TD} at (2,2) size 102x20 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (1,1) size 35x18
text run at (1,1) width 35: "hello."
<html>
<head>
<title></title>
</head>
<body>
<div>
The text below should be left-justified since text-align does not inherit in quirks mode.
</div>
<div style="text-align: center;">
<table style="border: 1px solid black;">
<tr>
<td style="width: 100px;">hello.</td>
</tr>
</table>
</div>
</body>
</html>
5f17828eb1d2f51d21c302a90949af19
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x60
RenderBlock {HTML} at (0,0) size 800x60
RenderBody {BODY} at (8,8) size 784x44
RenderBlock {DIV} at (0,0) size 784x18
RenderText {#text} at (0,0) size 486x18
text run at (0,0) width 486: "The text below should be centered since text-align does inherit in strict mode."
RenderBlock {DIV} at (0,18) size 784x26
RenderTable {TABLE} at (0,0) size 108x26 [border: (1px solid #000000)]
RenderTableSection {TBODY} at (1,1) size 106x24
RenderTableRow {TR} at (0,2) size 106x20
RenderTableCell {TD} at (2,2) size 102x20 [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (33,1) size 35x18
text run at (33,1) width 35: "hello."
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
<div>
The text below should be centered since text-align does inherit in strict mode.
</div>
<div style="text-align: center;">
<table style="border: 1px solid black;">
<tr>
<td style="width: 100px;">hello.</td>
</tr>
</table>
</div>
</body>
</html>
......@@ -7,7 +7,7 @@ Collapsed borders appear on the wrong side or on the wrong cell in RTL tables</i
The RTL table should be a mirror image of the LTR table.
</p>
<hr>
<table cellpadding="4" cellspacing="0" style="text-align: -khtml-center;">
<table cellpadding="4" cellspacing="0" style="text-align: center;">
<tr>
<td style="border-right: 1px solid black;">RTL</td>
<td>LTR</td>
......
db75d943a4739a8b9666e6b3616a7a8f
\ No newline at end of file
......@@ -10,5 +10,5 @@ layer at (0,0) size 800x115
RenderTableSection {TBODY} at (1,1) size 625x26
RenderTableRow {TR} at (0,2) size 625x22
RenderTableCell {TD} at (2,2) size 621x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 291x18
text run at (2,2) width 291: "The text should be center-aligned not the table"
RenderText {#text} at (165,2) size 291x18
text run at (165,2) width 291: "The text should be center-aligned not the table"
68d1726b6d71564e419ec7a6eb3ab714
\ No newline at end of file
2007-04-13 David Kilzer <ddkilzer@webkit.org>
Patch and review by hyatt. Testing and landing by ddkilzer.
<rdar://problem/5078866>
tables don't inherit text-align (in strict mode; they're not supposed to in quirks mode)
Test: fast/css/table-text-align-quirk.html
fast/css/table-text-align-strict.html
Previous commit (r20731) removed the wrong property from WebCore/css/html4.css. However,
when the correct property was removed, it caused tables to inherit alignment properties
from tags like <center> and <div align="center">. This is fixed in
WebCore::CSSStyleSelector::adjustRenderStyle() by special-casing tables to reset the
text-align property.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForTextAlign): Renamed KHTML_CENTER, KHTML_LEFT and KHTML_RIGHT to
WEBKIT_CENTER, WEBKIT_LEFT and WEBKIT_RIGHT.
* css/cssparser.cpp:
(WebCore::CSSParser::parseValue): Ditto.
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::adjustRenderStyle): Tables should not support -webkit-center,
-webkit-left or -webkit-right values for text-align, so reset them back to auto.
* css/html4.css: Removed "text-align: -webkit-auto;" property from tables selector. It
was previously added to css/quirks.css in r20731.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::determineHorizontalPosition): Renamed KHTML_* to WEBKIT_*.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::calcHorizontalMargins): Ditto.
* rendering/RenderFlow.cpp:
(WebCore::RenderFlow::caretRect): Ditto.
* rendering/RenderStyle.h: Ditto.
(WebCore::):
* rendering/bidi.cpp:
(WebCore::RenderBlock::computeHorizontalPositionsForLine): Ditto.
2007-04-12 Brady Eidson <beidson@apple.com>
Reviewed by Black Sheep
......@@ -242,11 +242,11 @@ static PassRefPtr<CSSValue> valueForTextAlign(ETextAlign align)
return new CSSPrimitiveValue(CSS_VAL_CENTER);
case JUSTIFY:
return new CSSPrimitiveValue(CSS_VAL_JUSTIFY);
case KHTML_LEFT:
case WEBKIT_LEFT:
return new CSSPrimitiveValue(CSS_VAL__WEBKIT_LEFT);
case KHTML_RIGHT:
case WEBKIT_RIGHT:
return new CSSPrimitiveValue(CSS_VAL__WEBKIT_RIGHT);
case KHTML_CENTER:
case WEBKIT_CENTER:
return new CSSPrimitiveValue(CSS_VAL__WEBKIT_CENTER);
}
ASSERT_NOT_REACHED();
......
......@@ -679,7 +679,7 @@ bool CSSParser::parseValue(int propId, bool important)
break;
case CSS_PROP_TEXT_ALIGN:
// left | right | center | justify | khtml_left | khtml_right | khtml_center | <string> | inherit
// left | right | center | justify | webkit_left | webkit_right | webkit_center | <string> | inherit
if ((id >= CSS_VAL__WEBKIT_AUTO && id <= CSS_VAL__WEBKIT_CENTER) ||
value->unit == CSSPrimitiveValue::CSS_STRING)
valid_primitive = true;
......
......@@ -1026,6 +1026,10 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
}
// 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);
// 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.
if (e && (e->hasTagName(frameTag) || e->hasTagName(framesetTag))) {
......
......@@ -165,7 +165,6 @@ h6 {
table {
display: table;
border-collapse: separate;
text-align: -webkit-auto;
border-spacing: 2px;
border-color: gray
}
......
......@@ -1005,7 +1005,7 @@ void RenderBlock::determineHorizontalPosition(RenderObject* child)
// to shift over as necessary to dodge any floats that might get in the way.
if (child->avoidsFloats()) {
int leftOff = leftOffset(m_height);
if (style()->textAlign() != KHTML_CENTER && child->style()->marginLeft().type() != Auto) {
if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginLeft().type() != Auto) {
if (child->marginLeft() < 0)
leftOff += child->marginLeft();
chPos = max(chPos, leftOff); // Let the float sit in the child's margin if it can fit.
......@@ -1027,7 +1027,7 @@ void RenderBlock::determineHorizontalPosition(RenderObject* child)
int chPos = xPos - (child->width() + child->marginRight());
if (child->avoidsFloats()) {
int rightOff = rightOffset(m_height);
if (style()->textAlign() != KHTML_CENTER && child->style()->marginRight().type() != Auto) {
if (style()->textAlign() != WEBKIT_CENTER && child->style()->marginRight().type() != Auto) {
if (child->marginRight() < 0)
rightOff -= child->marginRight();
chPos = min(chPos, rightOff - child->width()); // Let the float sit in the child's margin if it can fit.
......
......@@ -1185,15 +1185,15 @@ void RenderBox::calcHorizontalMargins(const Length& marginLeft, const Length& ma
}
if ((marginLeft.isAuto() && marginRight.isAuto() && m_width < containerWidth)
|| (!marginLeft.isAuto() && !marginRight.isAuto() && containingBlock()->style()->textAlign() == KHTML_CENTER)) {
|| (!marginLeft.isAuto() && !marginRight.isAuto() && containingBlock()->style()->textAlign() == WEBKIT_CENTER)) {
m_marginLeft = max(0, (containerWidth - m_width) / 2);
m_marginRight = containerWidth - m_width - m_marginLeft;
} else if ((marginRight.isAuto() && m_width < containerWidth)
|| (!marginLeft.isAuto() && containingBlock()->style()->direction() == RTL && containingBlock()->style()->textAlign() == KHTML_LEFT)) {
|| (!marginLeft.isAuto() && containingBlock()->style()->direction() == RTL && containingBlock()->style()->textAlign() == WEBKIT_LEFT)) {
m_marginLeft = marginLeft.calcValue(containerWidth);
m_marginRight = containerWidth - m_width - m_marginLeft;
} else if ((marginLeft.isAuto() && m_width < containerWidth)
|| (!marginRight.isAuto() && containingBlock()->style()->direction() == LTR && containingBlock()->style()->textAlign() == KHTML_RIGHT)) {
|| (!marginRight.isAuto() && containingBlock()->style()->direction() == LTR && containingBlock()->style()->textAlign() == WEBKIT_RIGHT)) {
m_marginRight = marginRight.calcValue(containerWidth);
m_marginLeft = containerWidth - m_width - m_marginRight;
} else {
......
......@@ -605,14 +605,14 @@ IntRect RenderFlow::caretRect(int offset, EAffinity affinity, int* extraWidthToE
alignment = alignRight;
break;
case LEFT:
case KHTML_LEFT:
case WEBKIT_LEFT:
break;
case CENTER:
case KHTML_CENTER:
case WEBKIT_CENTER:
alignment = alignCenter;
break;
case RIGHT:
case KHTML_RIGHT:
case WEBKIT_RIGHT:
alignment = alignRight;
break;
}
......
......@@ -896,7 +896,7 @@ enum EWhiteSpace {
};
enum ETextAlign {
TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, KHTML_LEFT, KHTML_RIGHT, KHTML_CENTER
TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER
};
enum ETextTransform {
......
......@@ -978,7 +978,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
int x = leftOffset(m_height);
switch(style()->textAlign()) {
case LEFT:
case KHTML_LEFT:
case WEBKIT_LEFT:
// The direction of the block should determine what happens with wide lines. In
// particular with RTL blocks, wide lines should still spill out to the left.
if (style()->direction() == RTL && totWidth > availableWidth)
......@@ -995,7 +995,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
if (style()->direction() == LTR)
break;
case RIGHT:
case KHTML_RIGHT:
case WEBKIT_RIGHT:
// Wide lines spill out of the block based off direction.
// So even if text-align is right, if direction is LTR, wide lines should overflow out of the right
// side of the block.
......@@ -1004,7 +1004,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
numSpaces = 0;
break;
case CENTER:
case KHTML_CENTER:
case WEBKIT_CENTER:
int xd = (availableWidth - totWidth)/2;
x += xd > 0 ? xd : 0;
numSpaces = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment