https://bugs.webkit.org/show_bug.cgi?id=46304
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2010 21:37:26 +0000 (21:37 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Sep 2010 21:37:26 +0000 (21:37 +0000)
Reviewed by Dan Bernstein.

display:inline should become display:inline-block when an object's block flow does not match its parent's block flow.

Added fast/blockflow/display-mutation.html

WebCore:

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::styleForElement):
(WebCore::CSSStyleSelector::pseudoStyleForElement):
(WebCore::CSSStyleSelector::adjustRenderStyle):
* css/CSSStyleSelector.h:

LayoutTests:

* fast/blockflow/display-mutation-expected.txt: Added.
* fast/blockflow/display-mutation.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/blockflow/display-mutation-expected.txt [new file with mode: 0644]
LayoutTests/fast/blockflow/display-mutation.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSStyleSelector.h

index 8a1e590951d026b54b4e1b28d494f215dea7073c..08795403ccf0a5738f70c0a0c60dff7e8eff2b1a 100644 (file)
@@ -1,3 +1,16 @@
+2010-09-22  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46304
+        
+        display:inline should become display:inline-block when an object's block flow does not match its parent's block flow.
+
+        Added fast/blockflow/display-mutation.html
+
+        * fast/blockflow/display-mutation-expected.txt: Added.
+        * fast/blockflow/display-mutation.html: Added.
+
 2010-09-22  Abhishek Arya  <inferno@chromium.org>
 
         Unreviewed.
diff --git a/LayoutTests/fast/blockflow/display-mutation-expected.txt b/LayoutTests/fast/blockflow/display-mutation-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/blockflow/display-mutation.html b/LayoutTests/fast/blockflow/display-mutation.html
new file mode 100644 (file)
index 0000000..69778e0
--- /dev/null
@@ -0,0 +1,19 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+  window.layoutTestController.dumpAsText();
+
+function runTest()
+{
+   elt = document.getElementById('test');
+   if (getComputedStyle(elt, 0).getPropertyValue("display") == "inline-block")
+     document.getElementById('console').innerHTML = "PASS";
+   else
+     document.getElementById('console').innerHTML = "FAIL";
+}
+</script>
+</head>
+<body onload="runTest()">
+<span id="test" style="-webkit-block-flow:lr"></span>
+<div id="console"></div>
index 6d33284be412a9f2b485bb4739f47a3656559549..bc09caa3ca428d14cc7dab580d572cee01ec2b41 100644 (file)
@@ -1,3 +1,19 @@
+2010-09-22  David Hyatt  <hyatt@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46304
+        
+        display:inline should become display:inline-block when an object's block flow does not match its parent's block flow.
+
+        Added fast/blockflow/display-mutation.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForElement):
+        (WebCore::CSSStyleSelector::pseudoStyleForElement):
+        (WebCore::CSSStyleSelector::adjustRenderStyle):
+        * css/CSSStyleSelector.h:
+
 2010-09-22 Mario Sanchez Prada <msanchez@igalia.com>
 
         Reviewed by Martin Robinson.
index 05f59abe93ecb80d168eb0f03e68cc4059560eaf..13c35b8f7305f2490aec57c8aebb352599f8c25a 100644 (file)
@@ -1344,7 +1344,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
         updateFont();
     
     // Clean up our style object's display and text decorations (among other fixups).
-    adjustRenderStyle(style(), e);
+    adjustRenderStyle(style(), m_parentStyle, e);
 
     // Start loading images referenced by this style.
     loadPendingImages();
@@ -1562,7 +1562,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
         updateFont();
 
     // Clean up our style object's display and text decorations (among other fixups).
-    adjustRenderStyle(style(), 0);
+    adjustRenderStyle(style(), parentStyle, 0);
 
     // Start loading images referenced by this style.
     loadPendingImages();
@@ -1646,7 +1646,7 @@ static void addIntrinsicMargins(RenderStyle* style)
     }
 }
 
-void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
+void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
 {
     // Cache our original display.
     style->setOriginalDisplay(style->display());
@@ -1716,6 +1716,11 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, Element *e)
                 style->setDisplay(BLOCK);
         }
         
+        // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
+        // clear how that should work.
+        if (style->display() == INLINE && style->styleType() == NOPSEUDO && parentStyle && style->blockFlow() != parentStyle->blockFlow())
+            style->setDisplay(INLINE_BLOCK);
+            
         // After performing the display mutation, check table rows.  We do not honor position:relative on
         // table rows or cells.  This has been established in CSS2.1 (and caused a crash in containingBlock()
         // on some sites).
index b77f23c2be783507932a051f7588daec37a2f984..2bca2f4d0d96f0583094125ef31201e26c890e8b 100644 (file)
@@ -181,7 +181,7 @@ public:
         void checkForZoomChange(RenderStyle*, RenderStyle* parentStyle);
         void checkForTextSizeAdjust();
 
-        void adjustRenderStyle(RenderStyle*, Element*);
+        void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*);
 
         void addMatchedRule(CSSRuleData* rule) { m_matchedRules.append(rule); }
         void addMatchedDeclaration(CSSMutableStyleDeclaration* decl);