- Revision
- 215375
- Author
- za...@apple.com
- Date
- 2017-04-14 13:59:36 -0700 (Fri, 14 Apr 2017)
Log Message
text-align start / end failure in table cells
https://bugs.webkit.org/show_bug.cgi?id=141417
<rdar://problem/31051672>
Reviewed by Antti Koivisto.
Source/WebCore:
Apply "text-align: center" on th elements when parent's computed value for the 'text-align' property
is its initial value, unless it is explicitly set.
Test: fast/table/center-th-when-parent-has-initial-text-align.html
* css/CSSProperties.json:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInitialTextAlign):
(WebCore::StyleBuilderCustom::applyValueTextAlign):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::applyProperty):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::hasExplicitlySetTextAlign):
(WebCore::RenderStyle::setHasExplicitlySetTextAlign):
(WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign):
(WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign):
LayoutTests:
* fast/table/center-th-when-parent-has-initial-text-align-expected.html: Added.
* fast/table/center-th-when-parent-has-initial-text-align.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (215374 => 215375)
--- trunk/LayoutTests/ChangeLog 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/LayoutTests/ChangeLog 2017-04-14 20:59:36 UTC (rev 215375)
@@ -1,3 +1,14 @@
+2017-04-14 Zalan Bujtas <za...@apple.com>
+
+ text-align start / end failure in table cells
+ https://bugs.webkit.org/show_bug.cgi?id=141417
+ <rdar://problem/31051672>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/table/center-th-when-parent-has-initial-text-align-expected.html: Added.
+ * fast/table/center-th-when-parent-has-initial-text-align.html: Added.
+
2017-04-13 Saam Barati <sbar...@apple.com>
WebAssembly: We should be able to postMessage a JSWebAssemblyModule
Added: trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align-expected.html (0 => 215375)
--- trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align-expected.html 2017-04-14 20:59:36 UTC (rev 215375)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that th is text-align centered when parent has initial value.</title>
+<style>
+ table {
+ width: 500px; border: 1px solid green;
+}
+</style>
+<table><tbody>
+ <tr><th style="text-align: center">no explicit style</th></tr>
+ <tr><th style="text-align: left">th initial</th></tr>
+ <tr><th style="text-align: left">th start</th></tr>
+ <tr><th style="text-align: center">th center</th></tr>
+ <tr><th style="text-align: right">th end</th></tr>
+ <tr><th style="text-align: center">tr initial</th></tr>
+ <tr><th style="text-align: center">tr start</th></tr>
+ <tr><th style="text-align: center">tr center</th></tr>
+ <tr><th style="text-align: right">tr end</th></tr>
+ <tr><th style="text-align: left">tr initial, th initial</th></tr>
+ <tr><th style="text-align: left">tr initial, th start</th></tr>
+ <tr><th style="text-align: left">tr start, th start</th></tr>
+ <tr><th style="text-align: left">tr end, th initial</th></tr>
+ <tr><th style="text-align: left">tr end, th start</th></tr>
+</tbody></table>
+</body>
+</html>
Added: trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align.html (0 => 215375)
--- trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align.html (rev 0)
+++ trunk/LayoutTests/fast/table/center-th-when-parent-has-initial-text-align.html 2017-04-14 20:59:36 UTC (rev 215375)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that th is text-align centered when parent has initial value.</title>
+<style>
+ table {
+ width: 500px; border: 1px solid green;
+}
+</style>
+<table><tbody>
+ <tr><th>no explicit style</th></tr>
+ <tr><th style="text-align: initial">th initial</th></tr>
+ <tr><th style="text-align: start">th start</th></tr>
+ <tr><th style="text-align: center">th center</th></tr>
+ <tr><th style="text-align: end">th end</th></tr>
+ <tr style="text-align: initial"><th>tr initial</th></tr>
+ <tr style="text-align: start"><th>tr start</th></tr>
+ <tr style="text-align: center"><th>tr center</th></tr>
+ <tr style="text-align: end"><th>tr end</th></tr>
+ <tr style="text-align: initial"><th style="text-align: initial">tr initial, th initial</th></tr>
+ <tr style="text-align: initial"><th style="text-align: start">tr initial, th start</th></tr>
+ <tr style="text-align: start"><th style="text-align: start">tr start, th start</th></tr>
+ <tr style="text-align: end"><th style="text-align: initial">tr end, th initial</th></tr>
+ <tr style="text-align: end"><th style="text-align: start">tr end, th start</th></tr>
+</tbody></table>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (215374 => 215375)
--- trunk/Source/WebCore/ChangeLog 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/Source/WebCore/ChangeLog 2017-04-14 20:59:36 UTC (rev 215375)
@@ -1,3 +1,29 @@
+2017-04-14 Zalan Bujtas <za...@apple.com>
+
+ text-align start / end failure in table cells
+ https://bugs.webkit.org/show_bug.cgi?id=141417
+ <rdar://problem/31051672>
+
+ Reviewed by Antti Koivisto.
+
+ Apply "text-align: center" on th elements when parent's computed value for the 'text-align' property
+ is its initial value, unless it is explicitly set.
+
+ Test: fast/table/center-th-when-parent-has-initial-text-align.html
+
+ * css/CSSProperties.json:
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyInitialTextAlign):
+ (WebCore::StyleBuilderCustom::applyValueTextAlign):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::adjustRenderStyle):
+ (WebCore::StyleResolver::applyProperty):
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::hasExplicitlySetTextAlign):
+ (WebCore::RenderStyle::setHasExplicitlySetTextAlign):
+ (WebCore::RenderStyle::NonInheritedFlags::hasExplicitlySetTextAlign):
+ (WebCore::RenderStyle::NonInheritedFlags::setHasExplicitlySetTextAlign):
+
2017-04-14 Andy Estes <aes...@apple.com>
[ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
Modified: trunk/Source/WebCore/css/CSSProperties.json (215374 => 215375)
--- trunk/Source/WebCore/css/CSSProperties.json 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/Source/WebCore/css/CSSProperties.json 2017-04-14 20:59:36 UTC (rev 215375)
@@ -3140,7 +3140,8 @@
}
],
"codegen-properties": {
- "converter": "TextAlign"
+ "converter": "TextAlign",
+ "custom": "Initial|Value"
},
"specification": {
"category": "css-22",
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (215374 => 215375)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2017-04-14 20:59:36 UTC (rev 215375)
@@ -126,6 +126,8 @@
static void applyValueBaselineShift(StyleResolver&, CSSValue&);
static void applyValueDirection(StyleResolver&, CSSValue&);
static void applyValueVerticalAlign(StyleResolver&, CSSValue&);
+ static void applyInitialTextAlign(StyleResolver&);
+ static void applyValueTextAlign(StyleResolver&, CSSValue&);
#if ENABLE(DASHBOARD_SUPPORT)
static void applyValueWebkitDashboardRegion(StyleResolver&, CSSValue&);
#endif
@@ -170,6 +172,18 @@
styleResolver.style()->setHasExplicitlySetDirection(true);
}
+inline void StyleBuilderCustom::applyInitialTextAlign(StyleResolver& styleResolver)
+{
+ styleResolver.style()->setTextAlign(RenderStyle::initialTextAlign());
+ styleResolver.style()->setHasExplicitlySetTextAlign(true);
+}
+
+inline void StyleBuilderCustom::applyValueTextAlign(StyleResolver& styleResolver, CSSValue& value)
+{
+ styleResolver.style()->setTextAlign(StyleBuilderConverter::convertTextAlign(styleResolver, value));
+ styleResolver.style()->setHasExplicitlySetTextAlign(true);
+}
+
inline void StyleBuilderCustom::resetEffectiveZoom(StyleResolver& styleResolver)
{
// Reset the zoom in effect. This allows the setZoom method to accurately compute a new zoom in effect.
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (215374 => 215375)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2017-04-14 20:59:36 UTC (rev 215375)
@@ -844,9 +844,11 @@
style.setFloating(NoFloat);
}
- // 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 (element->hasTagName(thTag) && style.textAlign() == TASTART)
+ // User agents are expected to have a rule in their user agent stylesheet that matches th elements that have a parent
+ // node whose computed value for the 'text-align' property is its initial value, whose declaration block consists of
+ // just a single declaration that sets the 'text-align' property to the value 'center'.
+ // https://html.spec.whatwg.org/multipage/rendering.html#rendering
+ if (element->hasTagName(thTag) && !style.hasExplicitlySetTextAlign() && parentStyle.textAlign() == RenderStyle::initialTextAlign())
style.setTextAlign(CENTER);
if (element->hasTagName(legendTag))
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (215374 => 215375)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2017-04-14 20:52:36 UTC (rev 215374)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2017-04-14 20:59:36 UTC (rev 215375)
@@ -1393,6 +1393,9 @@
bool hasExplicitlySetWritingMode() const { return m_nonInheritedFlags.hasExplicitlySetWritingMode(); }
void setHasExplicitlySetWritingMode(bool v) { m_nonInheritedFlags.setHasExplicitlySetWritingMode(v); }
+ bool hasExplicitlySetTextAlign() const { return m_nonInheritedFlags.hasExplicitlySetTextAlign(); }
+ void setHasExplicitlySetTextAlign(bool value) { m_nonInheritedFlags.setHasExplicitlySetTextAlign(value); }
+
// A unique style is one that has matches something that makes it impossible to share.
bool unique() const { return m_nonInheritedFlags.isUnique(); }
void setUnique() { m_nonInheritedFlags.setIsUnique(); }
@@ -1806,6 +1809,9 @@
bool hasExplicitlySetWritingMode() const { return getBoolean(hasExplicitlySetWritingModeOffset); }
void setHasExplicitlySetWritingMode(bool value) { updateBoolean(value, hasExplicitlySetWritingModeOffset); }
+ bool hasExplicitlySetTextAlign() const { return getBoolean(hasExplicitlySetTextAlignOffset); }
+ void setHasExplicitlySetTextAlign(bool value) { updateBoolean(value, hasExplicitlySetTextAlignOffset); }
+
static ptrdiff_t flagsMemoryOffset() { return OBJECT_OFFSETOF(NonInheritedFlags, m_flags); }
static uint64_t flagIsaffectedByActive() { return oneBitMask << affectedByActiveOffset; }
static uint64_t flagIsaffectedByHover() { return oneBitMask << affectedByHoverOffset; }
@@ -1880,11 +1886,13 @@
static const unsigned hasViewportUnitsOffset = pseudoBitsOffset + pseudoBitsBitCount;
// Byte 7.
+ static const unsigned hasExplicitlySetTextAlignBitCount = 1;
+ static const unsigned hasExplicitlySetTextAlignOffset = hasViewportUnitsOffset + hasViewportUnitsBitCount;
static const unsigned styleTypeBitCount = 6;
- static const unsigned styleTypePadding = 2;
+ static const unsigned styleTypePadding = 1;
static const unsigned styleTypeAndPaddingBitCount = styleTypeBitCount + styleTypePadding;
static const uint64_t styleTypeMask = (oneBitMask << styleTypeAndPaddingBitCount) - 1;
- static const unsigned styleTypeOffset = hasViewportUnitsBitCount + hasViewportUnitsOffset;
+ static const unsigned styleTypeOffset = hasExplicitlySetTextAlignOffset + hasExplicitlySetTextAlignBitCount;
// Byte 8.
static const unsigned isUniqueOffset = styleTypeOffset + styleTypeAndPaddingBitCount;