Title: [89199] trunk
Revision
89199
Author
[email protected]
Date
2011-06-18 12:52:34 -0700 (Sat, 18 Jun 2011)

Log Message

2011-06-18  Jeremy Moskovich  <[email protected]>

        Reviewed by Eric Seidel.

        Set text-align:-webkit-match-parent for li elements in the default style sheet.
        https://bugs.webkit.org/show_bug.cgi?id=57232

        * fast/css/list-item-text-align-expected.txt: Added.
        * fast/css/list-item-text-align.html: Added.
2011-06-18  Jeremy Moskovich  <[email protected]>

        Reviewed by Eric Seidel.

        Set text-align:-webkit-match-parent for li elements in the default style sheet.
        https://bugs.webkit.org/show_bug.cgi?id=57232

        Test: fast/css/list-item-text-align.html

        * css/html.css:
        (li): Specify text-align:-webkit-match-parent .

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89198 => 89199)


--- trunk/LayoutTests/ChangeLog	2011-06-18 19:45:43 UTC (rev 89198)
+++ trunk/LayoutTests/ChangeLog	2011-06-18 19:52:34 UTC (rev 89199)
@@ -1,3 +1,13 @@
+2011-06-18  Jeremy Moskovich  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Set text-align:-webkit-match-parent for li elements in the default style sheet.
+        https://bugs.webkit.org/show_bug.cgi?id=57232
+
+        * fast/css/list-item-text-align-expected.txt: Added.
+        * fast/css/list-item-text-align.html: Added.
+
 2011-06-18  Csaba Osztrogonác  <[email protected]>
 
         [Qt][Mac] Skip failing tests.

Added: trunk/LayoutTests/fast/css/list-item-text-align-expected.txt (0 => 89199)


--- trunk/LayoutTests/fast/css/list-item-text-align-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/list-item-text-align-expected.txt	2011-06-18 19:52:34 UTC (rev 89199)
@@ -0,0 +1,17 @@
+This test verifies that text-align:-webkit-match-parent is the default style for list elements.
+
+The test passes if all the lines containing the text "Left Align" are aligned to the left and vice-versa for "Right Align".
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS

Added: trunk/LayoutTests/fast/css/list-item-text-align.html (0 => 89199)


--- trunk/LayoutTests/fast/css/list-item-text-align.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/list-item-text-align.html	2011-06-18 19:52:34 UTC (rev 89199)
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<h3>
+This test verifies that text-align:-webkit-match-parent is the default style for list elements.
+</h3>
+
+<div>
+The test passes if all the lines containing the text "Left Align" are aligned to the left and vice-versa for "Right Align".
+</div>
+
+<ul dir=ltr>
+  <li dir=ltr class=l><span>Left aligned</span></li>
+  <li dir=rtl class=r><span>Right aligned</span></li>
+</ul>
+
+<ul dir=ltr style="text-align:start">
+  <li dir=ltr class=l>Left aligned</li>
+  <li dir=rtl class=l>Left aligned</li>
+</ul>
+
+<ul dir=ltr style="text-align:end">
+  <li dir=ltr class=r>Right aligned</li>
+  <li dir=rtl class=r>Right aligned</li>
+</ul>
+
+<ul dir=rtl style="text-align:start">
+  <li dir=ltr class=r>Right aligned</li>
+  <li dir=rtl class=r>Right aligned</li>
+</ul>
+
+<ul dir=rtl style="text-align:end">
+  <li dir=ltr class=l>Left aligned</li>
+  <li dir=rtl class=l>Left aligned</li>
+</ul>
+
+<ul dir=rtl style="text-align:left">
+  <li dir=ltr class=l>Left aligned</li>
+  <li dir=rtl class=l>Left aligned</li>
+</ul>
+
+<ul dir=rtl style="text-align:right">
+  <li dir=ltr class=r>Right aligned</li>
+  <li dir=rtl class=r>Right aligned</li>
+</ul>
+
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+// Checks that the given element is left aligned if expectedAlignment is 'left', or right aligned if
+// expectedAlignment is 'right'.
+function assertAlignment(enclosingListElement, i, expectedAlignment)
+{
+    var computedStyle = window.getComputedStyle(enclosingListElement, null);
+    var leftAlign = expectedAlignment == 'left';
+
+    if (window.layoutTestController) {
+        if (computedStyle.textAlign == '-webkit-auto') {
+            // 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;
+            isLeftAligned = elementLeftEdge < document.body.clientWidth/2;
+            enclosingListElement.innerHTML = (leftAlign == isLeftAligned ? 'PASS' : 'FAIL');
+            return;
+        }
+        
+        if (leftAlign && computedStyle.textAlign == 'left')
+            enclosingListElement.innerHTML = 'PASS';
+        else if (!leftAlign && computedStyle.textAlign == 'right')
+            enclosingListElement.innerHTML = 'PASS';
+        else
+            enclosingListElement.innerHTML = 'FAIL';
+    }
+}
+
+// Actual test.
+var leftAlignedDivs = document.querySelectorAll(".l");
+for (var i = 0; i < leftAlignedDivs.length; i++)
+    assertAlignment(leftAlignedDivs[i], i, 'left');
+
+var rightAlignedDivs = document.querySelectorAll(".r");
+for (var i = 0; i < rightAlignedDivs.length; i++)
+    assertAlignment(rightAlignedDivs[i], i, 'right');
+
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (89198 => 89199)


--- trunk/Source/WebCore/ChangeLog	2011-06-18 19:45:43 UTC (rev 89198)
+++ trunk/Source/WebCore/ChangeLog	2011-06-18 19:52:34 UTC (rev 89199)
@@ -1,3 +1,15 @@
+2011-06-18  Jeremy Moskovich  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Set text-align:-webkit-match-parent for li elements in the default style sheet.
+        https://bugs.webkit.org/show_bug.cgi?id=57232
+
+        Test: fast/css/list-item-text-align.html
+
+        * css/html.css:
+        (li): Specify text-align:-webkit-match-parent .
+
 2011-06-18  Holger Hans Peter Freyther  <[email protected]>
 
         Reviewed by Brent Fulgham.

Modified: trunk/Source/WebCore/css/html.css (89198 => 89199)


--- trunk/Source/WebCore/css/html.css	2011-06-18 19:45:43 UTC (rev 89198)
+++ trunk/Source/WebCore/css/html.css	2011-06-18 19:52:34 UTC (rev 89199)
@@ -314,7 +314,8 @@
 }
 
 li {
-    display: list-item
+    display: list-item;
+    text-align: -webkit-match-parent;
 }
 
 ul ul, ol ul {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to