<https://webkit.org/b/119795> Propagate writing-mode from the first region to the...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Aug 2013 12:31:39 +0000 (12:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Aug 2013 12:31:39 +0000 (12:31 +0000)
Patch by Morten Stenshorne <mstensho@opera.com> on 2013-08-17
Reviewed by Darin Adler.

Source/WebCore:

Since the flow thread is a direct child of RenderView, it doesn't inherit
proper writing-mode automatically. It should be mentioned that if the thread's
contents' writing-mode differs from that of the first region, things are
typically going to look useless (although perhaps that's how it should be),
but as long as writing-mode is only specified on a common parent of the
thread's contents and the regions, things look fine, and also, we're now
following what the spec has to say on the matter:

http://www.w3.org/TR/2013/WD-css3-regions-20130528/#the-flow-into-property

    "The first region defines the principal writing mode for the entire flow.
     The writing mode on subsequent regions is ignored."

This is a back-port of the fix for Blink bug 257965.
Reviewed by esprehn and mihnea there.
Blink review URL: https://chromiumcodereview.appspot.com/18374008

Tests: fast/regions/changing-writing-mode-2.html
       fast/regions/changing-writing-mode-3.html
       fast/regions/changing-writing-mode-4.html
       fast/regions/changing-writing-mode-5.html
       fast/regions/changing-writing-mode.html
       fast/regions/invalid-first-region-with-writing-mode-2.html
       fast/regions/invalid-first-region-with-writing-mode.html
       fast/regions/subtree-with-horiz-bt.html
       fast/regions/subtree-with-horiz-tb.html
       fast/regions/subtree-with-vert-lr.html
       fast/regions/subtree-with-vert-rl.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::styleDidChange):
* rendering/RenderFlowThread.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::updateWritingMode):
(WebCore::RenderNamedFlowThread::addRegionToNamedFlowThread):
(WebCore::RenderNamedFlowThread::removeRegionFromThread):
(WebCore::RenderNamedFlowThread::regionChangedWritingMode):
* rendering/RenderNamedFlowThread.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::styleDidChange):

LayoutTests:

* fast/regions/changing-writing-mode-2-expected.html: Added.
* fast/regions/changing-writing-mode-2.html: Added.
* fast/regions/changing-writing-mode-3-expected.html: Added.
* fast/regions/changing-writing-mode-3.html: Added.
* fast/regions/changing-writing-mode-4-expected.html: Added.
* fast/regions/changing-writing-mode-4.html: Added.
* fast/regions/changing-writing-mode-5-expected.html: Added.
* fast/regions/changing-writing-mode-5.html: Added.
* fast/regions/changing-writing-mode-expected.html: Added.
* fast/regions/changing-writing-mode.html: Added.
* fast/regions/invalid-first-region-with-writing-mode-2-expected.html: Added.
* fast/regions/invalid-first-region-with-writing-mode-2.html: Added.
* fast/regions/invalid-first-region-with-writing-mode-expected.html: Added.
* fast/regions/invalid-first-region-with-writing-mode.html: Added.
* fast/regions/subtree-with-horiz-bt-expected.html: Added.
* fast/regions/subtree-with-horiz-bt.html: Added.
* fast/regions/subtree-with-horiz-tb-expected.html: Added.
* fast/regions/subtree-with-horiz-tb.html: Added.
* fast/regions/subtree-with-vert-lr-expected.html: Added.
* fast/regions/subtree-with-vert-lr.html: Added.
* fast/regions/subtree-with-vert-rl-expected.html: Added.
* fast/regions/subtree-with-vert-rl.html: Added.

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

29 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/regions/changing-writing-mode-2-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-2.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-3-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-3.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-4-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-4.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-5-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-5.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/changing-writing-mode.html [new file with mode: 0644]
LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2.html [new file with mode: 0644]
LayoutTests/fast/regions/invalid-first-region-with-writing-mode-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/invalid-first-region-with-writing-mode.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-horiz-bt-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-horiz-bt.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-horiz-tb-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-horiz-tb.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-vert-lr-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-vert-lr.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-vert-rl-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/subtree-with-vert-rl.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFlowThread.cpp
Source/WebCore/rendering/RenderFlowThread.h
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderRegion.cpp

index 4f882ee..78917f9 100644 (file)
@@ -1,3 +1,32 @@
+2013-08-17  Morten Stenshorne  <mstensho@opera.com>
+
+        <https://webkit.org/b/119795> Propagate writing-mode from the first region to the flow thread
+
+        Reviewed by Darin Adler.
+
+        * fast/regions/changing-writing-mode-2-expected.html: Added.
+        * fast/regions/changing-writing-mode-2.html: Added.
+        * fast/regions/changing-writing-mode-3-expected.html: Added.
+        * fast/regions/changing-writing-mode-3.html: Added.
+        * fast/regions/changing-writing-mode-4-expected.html: Added.
+        * fast/regions/changing-writing-mode-4.html: Added.
+        * fast/regions/changing-writing-mode-5-expected.html: Added.
+        * fast/regions/changing-writing-mode-5.html: Added.
+        * fast/regions/changing-writing-mode-expected.html: Added.
+        * fast/regions/changing-writing-mode.html: Added.
+        * fast/regions/invalid-first-region-with-writing-mode-2-expected.html: Added.
+        * fast/regions/invalid-first-region-with-writing-mode-2.html: Added.
+        * fast/regions/invalid-first-region-with-writing-mode-expected.html: Added.
+        * fast/regions/invalid-first-region-with-writing-mode.html: Added.
+        * fast/regions/subtree-with-horiz-bt-expected.html: Added.
+        * fast/regions/subtree-with-horiz-bt.html: Added.
+        * fast/regions/subtree-with-horiz-tb-expected.html: Added.
+        * fast/regions/subtree-with-horiz-tb.html: Added.
+        * fast/regions/subtree-with-vert-lr-expected.html: Added.
+        * fast/regions/subtree-with-vert-lr.html: Added.
+        * fast/regions/subtree-with-vert-rl-expected.html: Added.
+        * fast/regions/subtree-with-vert-rl.html: Added.
+
 2013-08-17  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed GTK gardening.
diff --git a/LayoutTests/fast/regions/changing-writing-mode-2-expected.html b/LayoutTests/fast/regions/changing-writing-mode-2-expected.html
new file mode 100644 (file)
index 0000000..1aea4b6
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-2.html b/LayoutTests/fast/regions/changing-writing-mode-2.html
new file mode 100644 (file)
index 0000000..1c5b481
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="-webkit-flow-from:thread; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+        <script>
+            document.getElementById('firstregion').offsetLeft; // Make sure we have laid out.
+            document.getElementById('firstregion').style.display = 'none';
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-3-expected.html b/LayoutTests/fast/regions/changing-writing-mode-3-expected.html
new file mode 100644 (file)
index 0000000..0d294e4
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="-webkit-flow-from:thread; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-3.html b/LayoutTests/fast/regions/changing-writing-mode-3.html
new file mode 100644 (file)
index 0000000..8916095
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="display:none; -webkit-flow-from:thread; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+        <script>
+            document.body.offsetLeft; // Make sure we have laid out.
+            document.getElementById('firstregion').style.display = 'block';
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-4-expected.html b/LayoutTests/fast/regions/changing-writing-mode-4-expected.html
new file mode 100644 (file)
index 0000000..297104f
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="display:none; -webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-4.html b/LayoutTests/fast/regions/changing-writing-mode-4.html
new file mode 100644 (file)
index 0000000..8d0032a
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+        <script>
+            document.body.offsetLeft; // Make sure we have laid out.
+            document.getElementById('firstregion').style.display = 'none';
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-5-expected.html b/LayoutTests/fast/regions/changing-writing-mode-5-expected.html
new file mode 100644 (file)
index 0000000..9117a7b
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="-webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-5.html b/LayoutTests/fast/regions/changing-writing-mode-5.html
new file mode 100644 (file)
index 0000000..6d6e790
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <div style="-webkit-flow-into:thread;">
+            <!-- Note: this test doesn't necessarily render according to the spec. All we're
+                 interested in testing is that changing styles dynamically results in the same
+                 rendering as if the styles were like that in the first place. -->
+
+            Tenderloin ham boudin tongue sausage venison short ribs sirloin, kielbasa beef
+            ribs. Strip steak shank bresaola salami spare ribs kielbasa fatback, cow t-bone flank
+            leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin chicken salami tail. Rump
+            swine ham shank corned beef short loin, speck turkey pancetta shankle
+            frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter turkey. Ham
+            hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami pork loin
+            turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage venison short
+            ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare ribs kielbasa
+            fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned beef sirloin
+            chicken salami tail. Rump swine ham shank corned beef short loin, speck turkey pancetta
+            shankle frankfurter. Pancetta tail fatback, ground round brisket biltong frankfurter
+            turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork sirloin pastrami
+            pork loin turducken rump brisket andouille.  Tenderloin ham boudin tongue sausage
+            venison short ribs sirloin, kielbasa beef ribs. Strip steak shank bresaola salami spare
+            ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl pork belly ribeye, corned
+            beef sirloin chicken salami tail. Rump swine ham shank corned beef short loin, speck
+            turkey pancetta shankle frankfurter. Pancetta tail fatback, ground round brisket biltong
+            frankfurter turkey. Ham hock chicken strip steak, salami short ribs beef ribs pork
+            sirloin pastrami pork loin turducken rump brisket andouille.  Tenderloin ham boudin
+            tongue sausage venison short ribs sirloin, kielbasa beef ribs. Strip steak shank
+            bresaola salami spare ribs kielbasa fatback, cow t-bone flank leberkas sirloin. Jowl
+            pork belly ribeye, corned beef sirloin chicken salami tail. Rump swine ham shank corned
+            beef short loin, speck turkey pancetta shankle frankfurter. Pancetta tail fatback,
+            ground round brisket biltong frankfurter turkey. Ham hock chicken strip steak, salami
+            short ribs beef ribs pork sirloin pastrami pork loin turducken rump brisket andouille.
+        </div>
+
+        <div id="firstregion" style="display:none; -webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; -webkit-logical-width:15em; -webkit-logical-height:5em; background:salmon;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:20em; -webkit-logical-height:8em; background:wheat;"></div>
+        Bekkestua!
+        <div style="-webkit-flow-from:thread; -webkit-logical-width:10em; -webkit-logical-height:20em; background:olive;"></div>
+        <script>
+            document.body.offsetLeft; // Make sure we have laid out.
+            document.getElementById('firstregion').style.display = 'block';
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode-expected.html b/LayoutTests/fast/regions/changing-writing-mode-expected.html
new file mode 100644 (file)
index 0000000..e9db909
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Changing writing mode on the first region</title>
+    </head>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div id="container" style="width:20em; height:20em; line-height:2em; -webkit-writing-mode:vertical-rl;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/changing-writing-mode.html b/LayoutTests/fast/regions/changing-writing-mode.html
new file mode 100644 (file)
index 0000000..9f4b950
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Changing writing mode on the first region</title>
+    </head>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div id="container" style="width:20em; height:20em; line-height:2em;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+        <script>
+            document.getElementById('container').offsetLeft; // Make sure we have laid out.
+            document.getElementById('container').style.WebkitWritingMode = 'vertical-rl';
+        </script>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2-expected.html b/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2-expected.html
new file mode 100644 (file)
index 0000000..573ad15
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Invalid region specifying writing-mode</title>
+    </head>
+    <body style="background:white; color:black; overflow:hidden;">
+        <p>You should see the word 'PASS' below.</p>
+        <div style="height:100px;"></div>
+        <div style="width:4em; height:2em; color:white; background:black;">PASS</div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2.html b/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-2.html
new file mode 100644 (file)
index 0000000..3914d95
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Flow thread trying to flow from itself specifying writing-mode</title>
+    </head>
+    <body style="background:white; color:black;">
+        <p>You should see the word 'PASS' below.</p>
+        <div style="-webkit-flow-into:thread; -webkit-flow-from:thread; -webkit-writing-mode:vertical-rl; background:red;">
+            FAIL
+        </div>
+        <div style="-webkit-flow-into:thread; color:white;">
+            <div style="height:100px;"></div>
+            PASS
+        </div>
+        <div style="-webkit-flow-from:thread; height:100px;"></div>
+        <div style="-webkit-flow-from:thread; width:4em; height:2em; background:black;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-expected.html b/LayoutTests/fast/regions/invalid-first-region-with-writing-mode-expected.html
new file mode 100644 (file)
index 0000000..573ad15
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Invalid region specifying writing-mode</title>
+    </head>
+    <body style="background:white; color:black; overflow:hidden;">
+        <p>You should see the word 'PASS' below.</p>
+        <div style="height:100px;"></div>
+        <div style="width:4em; height:2em; color:white; background:black;">PASS</div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/invalid-first-region-with-writing-mode.html b/LayoutTests/fast/regions/invalid-first-region-with-writing-mode.html
new file mode 100644 (file)
index 0000000..9c9064c
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Invalid region specifying writing-mode</title>
+    </head>
+    <body style="background:white; color:black; overflow:hidden;">
+        <p>You should see the word 'PASS' below.</p>
+        <div style="-webkit-flow-into:thread; color:white;">
+            <div style="height:100px;"></div>
+            PASS
+            <div style="-webkit-flow-from:thread; height:1000px; -webkit-writing-mode:vertical-rl;"></div>
+        </div>
+        <div style="-webkit-flow-from:thread; height:100px;"></div>
+        <div style="-webkit-flow-from:thread; width:4em; height:2em; background:black;"></div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-horiz-bt-expected.html b/LayoutTests/fast/regions/subtree-with-horiz-bt-expected.html
new file mode 100644 (file)
index 0000000..776aa78
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:horizontal-bt; line-height:2em;">
+            <div style="background:black;"><br></div>
+            <div style="background:lime;">PASS</div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-horiz-bt.html b/LayoutTests/fast/regions/subtree-with-horiz-bt.html
new file mode 100644 (file)
index 0000000..9e49b3f
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:horizontal-bt; line-height:2em;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                PASS
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-horiz-tb-expected.html b/LayoutTests/fast/regions/subtree-with-horiz-tb-expected.html
new file mode 100644 (file)
index 0000000..f9816a0
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html style="-webkit-writing-mode:vertical-rl;">
+    <body style="color:black; background:white;">
+        <p style="-webkit-writing-mode:horizontal-tb;">Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; margin-top:5em; height:20em; -webkit-writing-mode:horizontal-tb; line-height:2em;">
+            <div style="background:black;">
+                <br>
+            </div>
+            <div style="background:lime;">
+                PASS
+            </div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-horiz-tb.html b/LayoutTests/fast/regions/subtree-with-horiz-tb.html
new file mode 100644 (file)
index 0000000..2ea2765
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html style="-webkit-writing-mode:vertical-rl;">
+    <body style="color:black; background:white;">
+        <p style="-webkit-writing-mode:horizontal-tb;">Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; margin-top:5em; height:20em; -webkit-writing-mode:horizontal-tb; line-height:2em;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                PASS
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-vert-lr-expected.html b/LayoutTests/fast/regions/subtree-with-vert-lr-expected.html
new file mode 100644 (file)
index 0000000..93f598e
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:vertical-lr; line-height:2em;">
+            <div style="background:black;">
+                <br>
+            </div>
+            <div style="background:lime;">
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-vert-lr.html b/LayoutTests/fast/regions/subtree-with-vert-lr.html
new file mode 100644 (file)
index 0000000..30ff008
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:vertical-lr; line-height:2em;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-vert-rl-expected.html b/LayoutTests/fast/regions/subtree-with-vert-rl-expected.html
new file mode 100644 (file)
index 0000000..04a166f
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:vertical-rl; line-height:2em;">
+            <div style="background:black;">
+                <br>
+            </div>
+            <div style="background:lime;">
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/regions/subtree-with-vert-rl.html b/LayoutTests/fast/regions/subtree-with-vert-rl.html
new file mode 100644 (file)
index 0000000..a55df75
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+    <body style="color:black; background:white;">
+        <p>Below you should see the word 'PASS' on a lime background.</p>
+        <div style="width:20em; height:20em; -webkit-writing-mode:vertical-rl; line-height:2em;">
+            <div style="-webkit-flow-into:thread;">
+                <br>
+                <div style="-webkit-region-break-after:always;"></div>
+                <div style="-webkit-writing-mode:horizontal-tb;">PASS</div>
+            </div>
+            <div style="-webkit-flow-from:thread; background:black;"></div>
+            <div style="-webkit-flow-from:thread; background:lime;"></div>
+        </div>
+    </body>
+</html>
index e164445..3a8d7fe 100644 (file)
@@ -1,3 +1,50 @@
+2013-08-17  Morten Stenshorne  <mstensho@opera.com>
+
+        <https://webkit.org/b/119795> Propagate writing-mode from the first region to the flow thread
+
+        Reviewed by Darin Adler.
+
+        Since the flow thread is a direct child of RenderView, it doesn't inherit
+        proper writing-mode automatically. It should be mentioned that if the thread's
+        contents' writing-mode differs from that of the first region, things are
+        typically going to look useless (although perhaps that's how it should be),
+        but as long as writing-mode is only specified on a common parent of the
+        thread's contents and the regions, things look fine, and also, we're now
+        following what the spec has to say on the matter:
+
+        http://www.w3.org/TR/2013/WD-css3-regions-20130528/#the-flow-into-property
+
+            "The first region defines the principal writing mode for the entire flow.
+             The writing mode on subsequent regions is ignored."
+
+        This is a back-port of the fix for Blink bug 257965.
+        Reviewed by esprehn and mihnea there.
+        Blink review URL: https://chromiumcodereview.appspot.com/18374008
+
+        Tests: fast/regions/changing-writing-mode-2.html
+               fast/regions/changing-writing-mode-3.html
+               fast/regions/changing-writing-mode-4.html
+               fast/regions/changing-writing-mode-5.html
+               fast/regions/changing-writing-mode.html
+               fast/regions/invalid-first-region-with-writing-mode-2.html
+               fast/regions/invalid-first-region-with-writing-mode.html
+               fast/regions/subtree-with-horiz-bt.html
+               fast/regions/subtree-with-horiz-tb.html
+               fast/regions/subtree-with-vert-lr.html
+               fast/regions/subtree-with-vert-rl.html
+
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::styleDidChange):
+        * rendering/RenderFlowThread.h:
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::updateWritingMode):
+        (WebCore::RenderNamedFlowThread::addRegionToNamedFlowThread):
+        (WebCore::RenderNamedFlowThread::removeRegionFromThread):
+        (WebCore::RenderNamedFlowThread::regionChangedWritingMode):
+        * rendering/RenderNamedFlowThread.h:
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::styleDidChange):
+
 2013-08-16  Andreas Kling  <akling@apple.com>
 
         <https://webkit.org/b/119903> Make Settings ref-counted (and let Frame keep a ref!)
index 831330a..5dd7d56 100644 (file)
@@ -90,7 +90,7 @@ void RenderFlowThread::styleDidChange(StyleDifference diff, const RenderStyle* o
     RenderBlock::styleDidChange(diff, oldStyle);
 
     if (oldStyle && oldStyle->writingMode() != style()->writingMode())
-        m_regionsInvalidated = true;
+        invalidateRegions();
 }
 
 void RenderFlowThread::removeFlowChildInfo(RenderObject* child)
index 1b5b256..7e2be04 100644 (file)
@@ -88,6 +88,7 @@ public:
     // Check if the content is flown into at least a region with region styling rules.
     bool hasRegionsWithStyling() const { return m_hasRegionsWithStyling; }
     void checkRegionsWithStyling();
+    virtual void regionChangedWritingMode(RenderRegion*) { }
 
     void validateRegions();
     void invalidateRegions();
index 89e4a31..820f131 100644 (file)
@@ -89,6 +89,20 @@ void RenderNamedFlowThread::clearContentNodes()
     m_contentNodes.clear();
 }
 
+void RenderNamedFlowThread::updateWritingMode()
+{
+    RenderRegion* firstRegion = m_regionList.first();
+    if (!firstRegion)
+        return;
+    if (style()->writingMode() == firstRegion->style()->writingMode())
+        return;
+
+    // The first region defines the principal writing mode for the entire flow.
+    RefPtr<RenderStyle> newStyle = RenderStyle::clone(style());
+    newStyle->setWritingMode(firstRegion->style()->writingMode());
+    setStyle(newStyle.release());
+}
+
 RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const
 {
     FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin();
@@ -243,6 +257,9 @@ void RenderNamedFlowThread::addRegionToNamedFlowThread(RenderRegion* renderRegio
 
     renderRegion->setIsValid(true);
     addRegionToList(m_regionList, renderRegion);
+
+    if (m_regionList.first() == renderRegion)
+        updateWritingMode();
 }
 
 void RenderNamedFlowThread::addRegionToThread(RenderRegion* renderRegion)
@@ -282,6 +299,7 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion)
     }
 
     ASSERT(m_regionList.contains(renderRegion));
+    bool wasFirst = m_regionList.first() == renderRegion;
     m_regionList.remove(renderRegion);
 
     if (canBeDestroyed())
@@ -290,10 +308,18 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion)
     // After removing all the regions in the flow the following layout needs to dispatch the regionLayoutUpdate event
     if (m_regionList.isEmpty())
         setDispatchRegionLayoutUpdateEvent(true);
+    else if (wasFirst)
+        updateWritingMode();
 
     invalidateRegions();
 }
 
+void RenderNamedFlowThread::regionChangedWritingMode(RenderRegion* region)
+{
+    if (m_regionList.first() == region)
+        updateWritingMode();
+}
+
 void RenderNamedFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAfterEdge)
 {
     LayoutUnit height = oldClientAfterEdge;
index 4c924cf..81172b1 100644 (file)
@@ -68,6 +68,8 @@ public:
     virtual void addRegionToThread(RenderRegion*) OVERRIDE;
     virtual void removeRegionFromThread(RenderRegion*) OVERRIDE;
 
+    virtual void regionChangedWritingMode(RenderRegion*) OVERRIDE;
+
     bool overset() const { return m_overset; }
     void computeOversetStateForRegions(LayoutUnit oldClientAfterEdge);
 
@@ -104,6 +106,7 @@ private:
     void regionLayoutUpdateEventTimerFired(Timer<RenderNamedFlowThread>*);
     void regionOversetChangeEventTimerFired(Timer<RenderNamedFlowThread>*);
     void clearContentNodes();
+    void updateWritingMode();
 
 private:
     // Observer flow threads have invalid regions that depend on the state of this thread
index 2d2c1e0..a64b585 100644 (file)
@@ -293,6 +293,9 @@ void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
 
     checkRegionStyle();
     updateRegionHasAutoLogicalHeightFlag();
+
+    if (oldStyle && oldStyle->writingMode() != style()->writingMode())
+        m_flowThread->regionChangedWritingMode(this);
 }
 
 void RenderRegion::layoutBlock(bool relayoutChildren, LayoutUnit)