[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 14:58:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3b5d20f024b0b6d89acd82306ff82d24c60ff33f
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 18:32:57 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=48157
    
    Reviewed by Sam Weinig.
    
    Direction and writing-mode should propagate from the <body> to the <html> to the initial containing block.
    Modify the existing code that propagates from the document element to also propagate from the body.
    
    Fix the buggy code that was trying to dirty the body when the view changed size if it stretched to fill the
    viewport.  The code didn't consider the root element, and it only worked with one axis.  I pulled it
    out of calculateScrollbarModesForLayout, since it should never have been put there in the first place.
    
    Added four new tests in fast/blockflow.
    
    WebCore:
    
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::initElement):
    (WebCore::CSSStyleSelector::styleForDocument):
    (WebCore::CSSStyleSelector::applyProperty):
    * dom/Document.cpp:
    (WebCore::Document::Document):
    * dom/Document.h:
    (WebCore::Document::directionSetOnDocumentElement):
    (WebCore::Document::writingModeSetOnDocumentElement):
    (WebCore::Document::setDirectionSetOnDocumentElement):
    (WebCore::Document::setWritingModeSetOnDocumentElement):
    * page/FrameView.cpp:
    (WebCore::FrameView::calculateScrollbarModesForLayout):
    (WebCore::FrameView::layout):
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::styleDidChange):
    * rendering/RenderBox.h:
    (WebCore::RenderBox::stretchesToViewport):
    
    LayoutTests:
    
    * fast/blockflow/body-direction-propagation-blocked.html: Added.
    * fast/blockflow/body-direction-propagation.html: Added.
    * fast/blockflow/body-writing-mode-propagation-blocked.html: Added.
    * fast/blockflow/body-writing-mode-propagation.html: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.checksum: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.png: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.txt: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-expected.checksum: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-expected.png: Added.
    * platform/mac/fast/blockflow/body-direction-propagation-expected.txt: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.checksum: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.png: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.txt: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.checksum: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.png: Added.
    * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.txt: Added.
    * platform/mac/fast/blockflow/english-rl-text-expected.checksum:
    * platform/mac/fast/blockflow/english-rl-text-expected.png:
    * platform/mac/fast/blockflow/english-rl-text-expected.txt:
    * platform/mac/fast/blockflow/floats-in-block-layout-expected.txt:
    * platform/mac/fast/blockflow/self-collapsing-block-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70546 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e02a1d0..0f269a1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,40 @@
+2010-10-26  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48157
+        
+        Direction and writing-mode should propagate from the <body> to the <html> to the initial containing block.
+        Modify the existing code that propagates from the document element to also propagate from the body.
+        
+        Fix the buggy code that was trying to dirty the body when the view changed size if it stretched to fill the
+        viewport.  The code didn't consider the root element, and it only worked with one axis.  I pulled it
+        out of calculateScrollbarModesForLayout, since it should never have been put there in the first place.
+        
+        Added four new tests in fast/blockflow.
+
+        * fast/blockflow/body-direction-propagation-blocked.html: Added.
+        * fast/blockflow/body-direction-propagation.html: Added.
+        * fast/blockflow/body-writing-mode-propagation-blocked.html: Added.
+        * fast/blockflow/body-writing-mode-propagation.html: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.checksum: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.png: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.txt: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-expected.checksum: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-expected.png: Added.
+        * platform/mac/fast/blockflow/body-direction-propagation-expected.txt: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.checksum: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.png: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.txt: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.checksum: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.png: Added.
+        * platform/mac/fast/blockflow/body-writing-mode-propagation-expected.txt: Added.
+        * platform/mac/fast/blockflow/english-rl-text-expected.checksum:
+        * platform/mac/fast/blockflow/english-rl-text-expected.png:
+        * platform/mac/fast/blockflow/english-rl-text-expected.txt:
+        * platform/mac/fast/blockflow/floats-in-block-layout-expected.txt:
+        * platform/mac/fast/blockflow/self-collapsing-block-expected.txt:
+
 2010-10-26  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/blockflow/body-direction-propagation-blocked.html b/LayoutTests/fast/blockflow/body-direction-propagation-blocked.html
new file mode 100644
index 0000000..feb7a87
--- /dev/null
+++ b/LayoutTests/fast/blockflow/body-direction-propagation-blocked.html
@@ -0,0 +1,3 @@
+<html style="direction:ltr">
+<body style="direction:rtl; width:100px;border:2px solid black"></body>
+</html>
diff --git a/LayoutTests/fast/blockflow/body-direction-propagation.html b/LayoutTests/fast/blockflow/body-direction-propagation.html
new file mode 100644
index 0000000..9e15103
--- /dev/null
+++ b/LayoutTests/fast/blockflow/body-direction-propagation.html
@@ -0,0 +1,3 @@
+<html>
+<body style="direction:rtl; width:100px;border:2px solid black"></body>
+</html>
diff --git a/LayoutTests/fast/blockflow/body-writing-mode-propagation-blocked.html b/LayoutTests/fast/blockflow/body-writing-mode-propagation-blocked.html
new file mode 100644
index 0000000..5ae0c87
--- /dev/null
+++ b/LayoutTests/fast/blockflow/body-writing-mode-propagation-blocked.html
@@ -0,0 +1,3 @@
+<html style="-webkit-writing-mode:vertical-lr;">
+<body style="-webkit-writing-mode:vertical-rl; width:100px;border:2px solid black"></body>
+</html>
diff --git a/LayoutTests/fast/blockflow/body-writing-mode-propagation.html b/LayoutTests/fast/blockflow/body-writing-mode-propagation.html
new file mode 100644
index 0000000..c41cca1
--- /dev/null
+++ b/LayoutTests/fast/blockflow/body-writing-mode-propagation.html
@@ -0,0 +1,3 @@
+<html>
+<body style="-webkit-writing-mode:vertical-rl; width:100px;border:2px solid black"></body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.checksum
new file mode 100644
index 0000000..a71b58c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.checksum
@@ -0,0 +1 @@
+81f82a98311c008dbad01331c056ec42
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.png b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.png
new file mode 100644
index 0000000..a9dd336
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.txt b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.txt
new file mode 100644
index 0000000..4cebcf8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-blocked-expected.txt
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 104x584 [border: (2px solid #000000)]
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.checksum
new file mode 100644
index 0000000..f5ec16b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.checksum
@@ -0,0 +1 @@
+2c347bc614451422229dffb5b16d6496
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.png b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.png
new file mode 100644
index 0000000..f0dc2aa
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.txt b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.txt
new file mode 100644
index 0000000..b1f12ba
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-direction-propagation-expected.txt
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (688,8) size 104x584 [border: (2px solid #000000)]
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.checksum
new file mode 100644
index 0000000..a71b58c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.checksum
@@ -0,0 +1 @@
+81f82a98311c008dbad01331c056ec42
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.png b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.png
new file mode 100644
index 0000000..a9dd336
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.txt b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.txt
new file mode 100644
index 0000000..4cebcf8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-blocked-expected.txt
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 104x584 [border: (2px solid #000000)]
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.checksum
new file mode 100644
index 0000000..f5ec16b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.checksum
@@ -0,0 +1 @@
+2c347bc614451422229dffb5b16d6496
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.png b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.png
new file mode 100644
index 0000000..f0dc2aa
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.txt b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.txt
new file mode 100644
index 0000000..4cebcf8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/body-writing-mode-propagation-expected.txt
@@ -0,0 +1,5 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 104x584 [border: (2px solid #000000)]
diff --git a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.checksum
index 05260f8..f4d0bec 100644
--- a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.checksum
+++ b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.checksum
@@ -1 +1 @@
-57b207ac9f5b0d0eef5a6f6195202ad9
\ No newline at end of file
+e8dc37381cc28ada4722d8e2aaf824c7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.png b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.png
index bc7f545..fa00c11 100644
Binary files a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.png and b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.txt b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.txt
index 4e71c04..c8341a9 100644
--- a/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.txt
+++ b/LayoutTests/platform/mac/fast/blockflow/english-rl-text-expected.txt
@@ -1,7 +1,7 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 785x600
-  RenderBlock {HTML} at (0,0) size 785x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 504x584 [border: (2px solid #000000)]
       RenderBlock {DIV} at (18,2) size 204x580 [border: (2px solid #800000)]
         RenderBlock (floating) {DIV} at (2,478) size 100x100 [bgcolor=#00FF00]
diff --git a/LayoutTests/platform/mac/fast/blockflow/floats-in-block-layout-expected.txt b/LayoutTests/platform/mac/fast/blockflow/floats-in-block-layout-expected.txt
index 84c9672..7900a9c 100644
--- a/LayoutTests/platform/mac/fast/blockflow/floats-in-block-layout-expected.txt
+++ b/LayoutTests/platform/mac/fast/blockflow/floats-in-block-layout-expected.txt
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 300x584
+layer at (0,0) size 308x600
+  RenderBlock {HTML} at (0,0) size 116x600
+    RenderBody {BODY} at (8,8) size 100x584
       RenderBlock {DIV} at (0,0) size 100x584 [bgcolor=#FFFF00]
       RenderBlock (floating) {DIV} at (100,10) size 100x100 [bgcolor=#008000]
       RenderBlock (floating) {DIV} at (100,474) size 100x100 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/blockflow/self-collapsing-block-expected.txt b/LayoutTests/platform/mac/fast/blockflow/self-collapsing-block-expected.txt
index e0945a5..94dbde0 100644
--- a/LayoutTests/platform/mac/fast/blockflow/self-collapsing-block-expected.txt
+++ b/LayoutTests/platform/mac/fast/blockflow/self-collapsing-block-expected.txt
@@ -1,7 +1,7 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
+layer at (0,0) size 316x600
+  RenderBlock {HTML} at (0,0) size 316x600
     RenderBody {BODY} at (8,8) size 300x584
       RenderBlock {DIV} at (0,0) size 100x584 [bgcolor=#008000]
       RenderBlock {DIV} at (200,0) size 0x100
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dcc9089..0320dbf 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-10-26  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=48157
+        
+        Direction and writing-mode should propagate from the <body> to the <html> to the initial containing block.
+        Modify the existing code that propagates from the document element to also propagate from the body.
+        
+        Fix the buggy code that was trying to dirty the body when the view changed size if it stretched to fill the
+        viewport.  The code didn't consider the root element, and it only worked with one axis.  I pulled it
+        out of calculateScrollbarModesForLayout, since it should never have been put there in the first place.
+        
+        Added four new tests in fast/blockflow.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::initElement):
+        (WebCore::CSSStyleSelector::styleForDocument):
+        (WebCore::CSSStyleSelector::applyProperty):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        * dom/Document.h:
+        (WebCore::Document::directionSetOnDocumentElement):
+        (WebCore::Document::writingModeSetOnDocumentElement):
+        (WebCore::Document::setDirectionSetOnDocumentElement):
+        (WebCore::Document::setWritingModeSetOnDocumentElement):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::calculateScrollbarModesForLayout):
+        (WebCore::FrameView::layout):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::stretchesToViewport):
+
 2010-10-26  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by David Kilzer.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 3d69e87..90d9319 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -819,6 +819,10 @@ inline void CSSStyleSelector::initElement(Element* e)
         m_element = e;
         m_styledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0;
         m_elementLinkState = m_checker.determineLinkState(m_element);
+        if (e && e == e->document()->documentElement()) {
+            e->document()->setDirectionSetOnDocumentElement(false);
+            e->document()->setWritingModeSetOnDocumentElement(false);
+        }
     }
 }
 
@@ -1110,11 +1114,20 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
     documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
     
     Element* docElement = document->documentElement();
-    if (docElement && docElement->renderer()) {
-        // Use the direction and block-flow of the document element to set the
-        // viewport's direction and block-flow.
-        documentStyle->setWritingMode(docElement->renderer()->style()->writingMode());
-        documentStyle->setDirection(docElement->renderer()->style()->direction());
+    RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
+    if (docElementRenderer) {
+        // Use the direction and writing-mode of the body to set the
+        // viewport's direction and writing-mode unless the property is set on the document element.
+        // If there is no body, then use the document element.
+        RenderObject* bodyRenderer = document->body() ? document->body()->renderer() : 0;
+        if (bodyRenderer && !document->writingModeSetOnDocumentElement())
+            documentStyle->setWritingMode(bodyRenderer->style()->writingMode());
+        else
+            documentStyle->setWritingMode(docElementRenderer->style()->writingMode());
+        if (bodyRenderer && !document->directionSetOnDocumentElement())
+            documentStyle->setDirection(bodyRenderer->style()->direction());
+        else
+            documentStyle->setDirection(docElementRenderer->style()->direction());
     }
 
     FontDescription fontDescription;
@@ -3231,6 +3244,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         return;
     case CSSPropertyDirection:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(direction, Direction)
+        if (!isInherit && !isInitial && m_element && m_element == m_element->document()->documentElement())
+            m_element->document()->setDirectionSetOnDocumentElement(true);
         return;
     case CSSPropertyDisplay:
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
@@ -5580,6 +5595,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     // CSS Text Layout Module Level 3: Vertical writing support
     case CSSPropertyWebkitWritingMode: {
         HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(writingMode, WritingMode)
+        if (!isInherit && !isInitial && m_element && m_element == m_element->document()->documentElement())
+            m_element->document()->setWritingModeSetOnDocumentElement(true);
         FontDescription fontDescription = m_style->fontDescription();
         fontDescription.setOrientation(m_style->isHorizontalWritingMode() ? Horizontal : Vertical);
         if (m_style->setFontDescription(fontDescription))
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 0916e69..da9bd86 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -408,6 +408,8 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
 #endif
     , m_loadEventDelayCount(0)
     , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
+    , m_directionSetOnDocumentElement(false)
+    , m_writingModeSetOnDocumentElement(false)
 {
     m_document = this;
 
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 221ca2f..1334aa3 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -833,6 +833,11 @@ public:
 
     DocumentMarkerController* markers() const { return m_markers.get(); }
 
+    bool directionSetOnDocumentElement() const { return m_directionSetOnDocumentElement; }
+    bool writingModeSetOnDocumentElement() const { return m_writingModeSetOnDocumentElement; }
+    void setDirectionSetOnDocumentElement(bool b) { m_directionSetOnDocumentElement = b; }
+    void setWritingModeSetOnDocumentElement(bool b) { m_writingModeSetOnDocumentElement = b; }
+
     bool execCommand(const String& command, bool userInterface = false, const String& value = String());
     bool queryCommandEnabled(const String& command);
     bool queryCommandIndeterm(const String& command);
@@ -1333,6 +1338,9 @@ private:
     Timer<Document> m_loadEventDelayTimer;
 
     ViewportArguments m_viewportArguments;
+    
+    bool m_directionSetOnDocumentElement;
+    bool m_writingModeSetOnDocumentElement;
 };
 
 inline bool Document::hasElementWithId(AtomicStringImpl* id) const
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 1e7ab50..2708ce5 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -498,8 +498,6 @@ void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, Scrollbar
                 vMode = ScrollbarAlwaysOff;
                 hMode = ScrollbarAlwaysOff;
             } else if (body->hasTagName(bodyTag)) {
-                if (!m_firstLayout && m_size.height() != layoutHeight() && body->renderer()->enclosingBox()->stretchesToViewport())
-                    body->renderer()->setChildNeedsLayout(true);
                 // It's sufficient to just check the X overflow,
                 // since it's illegal to have visible in only one direction.
                 RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
@@ -754,8 +752,17 @@ void FrameView::layout(bool allowSubtree)
 
         m_size = IntSize(layoutWidth(), layoutHeight());
 
-        if (oldSize != m_size)
+        if (oldSize != m_size) {
             m_doFullRepaint = true;
+            if (!m_firstLayout) {
+                RenderBox* rootRenderer = document->documentElement() ? document->documentElement()->renderBox() : 0;
+                RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0;
+                if (bodyRenderer && bodyRenderer->stretchesToViewport())
+                    bodyRenderer->setChildNeedsLayout(true);
+                else if (rootRenderer && rootRenderer->stretchesToViewport())
+                    rootRenderer->setChildNeedsLayout(true);
+            }
+        }
     }
 
     RenderLayer* layer = root->enclosingLayer();
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 48ec384..e839866 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -302,19 +302,29 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
         }
     }
 
+    bool isBodyRenderer = isBody();
+    bool isRootRenderer = isRoot();
+
     // Set the text color if we're the body.
-    if (isBody())
+    if (isBodyRenderer)
         document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor));
-    else if (isRoot() && (!oldStyle || oldStyle->writingMode() != style()->writingMode() || oldStyle->direction() != style()->direction())) {
-        // Propagate the new block flow and direction up to the RenderView.
-        // FIXME: WinIE seems to propagate from the <body> as well.  We may want to consider doing that at some point.
+    
+    if ((isRootRenderer || isBodyRenderer) && (!oldStyle || oldStyle->writingMode() != style()->writingMode() || oldStyle->direction() != style()->direction())) {
+        // Propagate the new writing mode and direction up to the RenderView.
         RenderView* viewRenderer = view();
         RenderStyle* viewStyle = viewRenderer->style();
-        if (viewStyle->writingMode() != style()->writingMode() || viewStyle->direction() != style()->direction()) {
-            viewStyle->setWritingMode(style()->writingMode());
+        if (isRootRenderer || !document()->directionSetOnDocumentElement()) {
             viewStyle->setDirection(style()->direction());
-            viewRenderer->setNeedsLayoutAndPrefWidthsRecalc();
+            if (isBodyRenderer)
+                document()->documentElement()->renderer()->style()->setDirection(style()->direction());
+        }
+        
+        if (isRootRenderer || !document()->writingModeSetOnDocumentElement()) {
+            viewStyle->setWritingMode(style()->writingMode());
+            if (isBodyRenderer)
+                document()->documentElement()->renderer()->style()->setWritingMode(style()->writingMode());
         }
+        setNeedsLayoutAndPrefWidthsRecalc();
     }
 }
 
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index 4a745e5..33be9a9 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -284,7 +284,7 @@ public:
 
     bool stretchesToViewport() const
     {
-        return document()->inQuirksMode() && style()->logicalHeight().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody()) && !isWritingModeRoot();
+        return document()->inQuirksMode() && style()->logicalHeight().isAuto() && !isFloatingOrPositioned() && (isRoot() || isBody());
     }
 
     virtual IntSize intrinsicSize() const { return IntSize(); }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list