Title: [131581] trunk
Revision
131581
Author
[email protected]
Date
2012-10-17 03:40:10 -0700 (Wed, 17 Oct 2012)

Log Message

REGRESSION(r131421): Text baseline becomes incorrect after re-layout of input[type=time]
https://bugs.webkit.org/show_bug.cgi?id=99572

Reviewed by Kentaro Hara.

Source/WebCore:

We use flexible box since r131421, and it seems text baseline becomes
incorrect if there are text nodes in a flex container.

Test: fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html

* css/html.css:
(input::-webkit-datetime-edit-text): Added.
* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditBuilder::visitLiteral):
Wrap text with an element with ::-webkit-datetime-edit-text.

LayoutTests:

* fast/forms/time-multiple-fields/time-multiple-fields-static-relayout-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131580 => 131581)


--- trunk/LayoutTests/ChangeLog	2012-10-17 10:34:09 UTC (rev 131580)
+++ trunk/LayoutTests/ChangeLog	2012-10-17 10:40:10 UTC (rev 131581)
@@ -1,3 +1,13 @@
+2012-10-17  Kent Tamura  <[email protected]>
+
+        REGRESSION(r131421): Text baseline becomes incorrect after re-layout of input[type=time]
+        https://bugs.webkit.org/show_bug.cgi?id=99572
+
+        Reviewed by Kentaro Hara.
+
+        * fast/forms/time-multiple-fields/time-multiple-fields-static-relayout-expected.txt: Added.
+        * fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html: Added.
+
 2012-10-17  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout-expected.txt (0 => 131581)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout-expected.txt	2012-10-17 10:40:10 UTC (rev 131581)
@@ -0,0 +1,5 @@
+PASS time1.offsetTop is time2.offsetTop
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html (0 => 131581)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html	2012-10-17 10:40:10 UTC (rev 131581)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<div id="container">
+<span style="font-size: 64px;">Foo</span>
+<input type="time" id="time1">
+<input type="time" id="time2">
+</div>
+<script>
+time1.value = '23:59';
+shouldBe('time1.offsetTop', 'time2.offsetTop');
+container.remove();
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (131580 => 131581)


--- trunk/Source/WebCore/ChangeLog	2012-10-17 10:34:09 UTC (rev 131580)
+++ trunk/Source/WebCore/ChangeLog	2012-10-17 10:40:10 UTC (rev 131581)
@@ -1,3 +1,21 @@
+2012-10-17  Kent Tamura  <[email protected]>
+
+        REGRESSION(r131421): Text baseline becomes incorrect after re-layout of input[type=time]
+        https://bugs.webkit.org/show_bug.cgi?id=99572
+
+        Reviewed by Kentaro Hara.
+
+        We use flexible box since r131421, and it seems text baseline becomes
+        incorrect if there are text nodes in a flex container.
+
+        Test: fast/forms/time-multiple-fields/time-multiple-fields-static-relayout.html
+
+        * css/html.css:
+        (input::-webkit-datetime-edit-text): Added.
+        * html/shadow/DateTimeEditElement.cpp:
+        (WebCore::DateTimeEditBuilder::visitLiteral):
+        Wrap text with an element with ::-webkit-datetime-edit-text.
+
 2012-10-17  Grzegorz Czajkowski  <[email protected]>, Michal Roj <[email protected]>
 
         [WK2][EFL] Implementation of spellchecking feature.

Modified: trunk/Source/WebCore/css/html.css (131580 => 131581)


--- trunk/Source/WebCore/css/html.css	2012-10-17 10:34:09 UTC (rev 131580)
+++ trunk/Source/WebCore/css/html.css	2012-10-17 10:40:10 UTC (rev 131581)
@@ -611,6 +611,11 @@
     padding: 0.15em;
 }
 
+input::-webkit-datetime-edit-text {
+    -webkit-user-modify: read-only !important;
+    display: inline-block;
+}
+
 input::-webkit-datetime-edit-gap {
     -webkit-flex: 1;
     -webkit-user-modify: read-only !important;

Modified: trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp (131580 => 131581)


--- trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp	2012-10-17 10:34:09 UTC (rev 131580)
+++ trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp	2012-10-17 10:40:10 UTC (rev 131581)
@@ -204,8 +204,12 @@
 
 void DateTimeEditBuilder::visitLiteral(const String& text)
 {
+    DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text", AtomicString::ConstructFromLiteral));
     ASSERT(text.length());
-    m_editElement.appendChild(Text::create(m_editElement.document(), text));
+    RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.document());
+    element->setShadowPseudoId(textPseudoId);
+    element->appendChild(Text::create(m_editElement.document(), text));
+    m_editElement.appendChild(element);
 }
 
 // ----------------------------
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to