Flexbox should ignore firstLine pseudo element.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:16:39 +0000 (21:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 21:16:39 +0000 (21:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104485

Patch by Xueqing Huang <huangxueqing@baidu.com> on 2013-02-15
Reviewed by Tony Chang.

Source/WebCore:

Spec[1] said that "None of the properties defined in this module
apply to '::first-line' or '::first-letter' pseudo-elements." and
css2[2] define "The :first-line pseudo-element can only be attached
to a block container element."
[1]http://dev.w3.org/csswg/css3-flexbox/#display-flex
[2]http://www.w3.org/TR/CSS2/selector.html#first-line-pseudo

tests:
css3/flexbox/flexbox-ignore-firstLine.html
css3/flexbox/flexitem-firstLine-valid.html
css3/flexbox/inline-flexbox-ignore-firstLine.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::firstLineBlock):

LayoutTests:

Spec[1] said that "None of the properties defined in this module
apply to '::first-line' or '::first-letter' pseudo-elements." and
css2[2] define "The :first-line pseudo-element can only be attached
to a block container element."
[1]http://dev.w3.org/csswg/css3-flexbox/#display-flex
[2]http://www.w3.org/TR/CSS2/selector.html#first-line-pseudo

some case by Kenny Lu <kanghaol@oupeng.com>
* css3/flexbox/flex-item-firstLine-valid-expected.txt: Added.
* css3/flexbox/flex-item-firstLine-valid.html: Added.
* css3/flexbox/flexbox-ignore-firstLine-expected.txt: Added.
* css3/flexbox/flexbox-ignore-firstLine.html: Added.
* css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt: Added.
* css3/flexbox/inline-flexbox-ignore-firstLine.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143042 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/css3/flexbox/flex-item-firstLine-valid-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/flex-item-firstLine-valid.html [new file with mode: 0644]
LayoutTests/css3/flexbox/flexbox-ignore-firstLine-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/flexbox-ignore-firstLine.html [new file with mode: 0644]
LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt [new file with mode: 0644]
LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp

index 4227ec9d4bcc30e4270d7806c87c52dadfc4c2d5..808b5d788e203f95f97f888a1116214573c40e6d 100644 (file)
@@ -1,3 +1,25 @@
+2013-02-15  Xueqing Huang  <huangxueqing@baidu.com>
+
+        Flexbox should ignore firstLine pseudo element.
+        https://bugs.webkit.org/show_bug.cgi?id=104485
+
+        Reviewed by Tony Chang.
+
+        Spec[1] said that "None of the properties defined in this module
+        apply to '::first-line' or '::first-letter' pseudo-elements." and
+        css2[2] define "The :first-line pseudo-element can only be attached
+        to a block container element."
+        [1]http://dev.w3.org/csswg/css3-flexbox/#display-flex
+        [2]http://www.w3.org/TR/CSS2/selector.html#first-line-pseudo 
+
+        some case by Kenny Lu <kanghaol@oupeng.com>
+        * css3/flexbox/flex-item-firstLine-valid-expected.txt: Added.
+        * css3/flexbox/flex-item-firstLine-valid.html: Added.
+        * css3/flexbox/flexbox-ignore-firstLine-expected.txt: Added.
+        * css3/flexbox/flexbox-ignore-firstLine.html: Added.
+        * css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt: Added.
+        * css3/flexbox/inline-flexbox-ignore-firstLine.html: Added.
+
 2013-02-15  Philip Rogers  <pdr@google.com>
 
         Rebaseline 7 SVG tests after r142765.
diff --git a/LayoutTests/css3/flexbox/flex-item-firstLine-valid-expected.txt b/LayoutTests/css3/flexbox/flex-item-firstLine-valid-expected.txt
new file mode 100644 (file)
index 0000000..7132c46
--- /dev/null
@@ -0,0 +1,7 @@
+This test flex item should ignore flex container's firstLine pseudo element, but flex item's firstLine should be valid.
+
+The first item.
+
+The second item.
+
+PASS
diff --git a/LayoutTests/css3/flexbox/flex-item-firstLine-valid.html b/LayoutTests/css3/flexbox/flex-item-firstLine-valid.html
new file mode 100644 (file)
index 0000000..fe01e57
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<link href="resources/flexbox.css" rel="stylesheet">
+<style>
+    div::first-line { line-height: 100px; }
+    p::first-line { line-height: 100px;}
+</style>
+
+<script src="../../resources/check-layout.js"></script>
+<body onload="checkLayout('.flexbox')">
+<p>This test flex item should ignore flex container's firstLine pseudo element, but flex item's firstLine should be valid.</p>
+
+<div class="flexbox">
+    <p data-expected-height=100>The first item.</p>
+    <p data-expected-height=100>The second item.</p>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/css3/flexbox/flexbox-ignore-firstLine-expected.txt b/LayoutTests/css3/flexbox/flexbox-ignore-firstLine-expected.txt
new file mode 100644 (file)
index 0000000..d9f38dc
--- /dev/null
@@ -0,0 +1,7 @@
+This test flex item should ignore flex container's firstLine pseudo element.
+
+The first item.
+
+The second item.
+
+PASS
diff --git a/LayoutTests/css3/flexbox/flexbox-ignore-firstLine.html b/LayoutTests/css3/flexbox/flexbox-ignore-firstLine.html
new file mode 100644 (file)
index 0000000..2621d2e
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<link href="resources/flexbox.css" rel="stylesheet">
+<style>
+    div::first-line { line-height: 100px; }
+    p { line-height: 20px; }
+</style>
+
+<script src="../../resources/check-layout.js"></script>
+<body onload="checkLayout('.flexbox')">
+<p>This test flex item should ignore flex container's firstLine pseudo element.</p>
+
+<div class="flexbox">
+    <p data-expected-height=20>The first item.</p>
+    <p data-expected-height=20>The second item.</p>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt b/LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt
new file mode 100644 (file)
index 0000000..97e20f8
--- /dev/null
@@ -0,0 +1,8 @@
+This test inline-flexbox item should ignore flex container's firstLine pseudo element.
+
+The first item.
+
+The second item.
+
+PASS
+
diff --git a/LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine.html b/LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine.html
new file mode 100644 (file)
index 0000000..92079be
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<link href="resources/flexbox.css" rel="stylesheet">
+<style>
+    div::first-line { line-height: 100px; }
+    p { line-height: 20px; }
+</style>
+
+<script src="../../resources/check-layout.js"></script>
+<body onload="checkLayout('.inline-flexbox')">
+<p>This test inline-flexbox item should ignore flex container's firstLine pseudo element.</p>
+
+<div class="inline-flexbox">
+    <p data-expected-height=20>The first item.</p>
+    <p data-expected-height=20>The second item.</p>
+</div>
+</body>
+</html>
index 7d384fbedc85f98d7ba10a9b1edaa10b01dddd19..ded7140247b3da1fa534bf4e602afa4498fc14c9 100644 (file)
@@ -1,3 +1,25 @@
+2013-02-15  Xueqing Huang  <huangxueqing@baidu.com>
+
+        Flexbox should ignore firstLine pseudo element.
+        https://bugs.webkit.org/show_bug.cgi?id=104485
+
+        Reviewed by Tony Chang.
+
+        Spec[1] said that "None of the properties defined in this module
+        apply to '::first-line' or '::first-letter' pseudo-elements." and
+        css2[2] define "The :first-line pseudo-element can only be attached
+        to a block container element." 
+        [1]http://dev.w3.org/csswg/css3-flexbox/#display-flex
+        [2]http://www.w3.org/TR/CSS2/selector.html#first-line-pseudo
+
+        tests:
+        css3/flexbox/flexbox-ignore-firstLine.html
+        css3/flexbox/flexitem-firstLine-valid.html
+        css3/flexbox/inline-flexbox-ignore-firstLine.html 
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::firstLineBlock):
+
 2013-02-15  Alec Flett  <alecflett@chromium.org>
 
         IndexedDB: Implement SharedBuffer version of put()
index 56e6af975dd566adfe60d8e23f70a09304ac821f..ac962e1c31f53b44ebf0c15030be28863d678b92 100644 (file)
@@ -6433,7 +6433,7 @@ RenderBlock* RenderBlock::firstLineBlock() const
             break;
         RenderObject* parentBlock = firstLineBlock->parent();
         if (firstLineBlock->isReplaced() || firstLineBlock->isFloating() || 
-            !parentBlock || parentBlock->firstChild() != firstLineBlock || !parentBlock->isBlockFlow())
+            !parentBlock || parentBlock->firstChild() != firstLineBlock || !parentBlock->isBlockFlow() || parentBlock->isFlexibleBox())
             break;
         ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isRenderBlock());
         firstLineBlock = toRenderBlock(parentBlock);