Bug 434102: Make outlines behave reasonably on XUL tree pseudo-elements again. r=roc
authorL. David Baron <dbaron@dbaron.org>
Mon, 17 Feb 2014 20:07:46 -0800
changeset 169575 bcba561c4e53872d39c874892723cde1526be891
parent 169574 beff43e0a138794ad463c6447dd327f240d5428c
child 169576 8e574d7a951a0b39cc70a3c25b64dc4e70e81ea1
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs434102, 133165, 480888
milestone30.0a1
Bug 434102: Make outlines behave reasonably on XUL tree pseudo-elements again. r=roc This was a regression from bug 133165 which I noticed while working on bug 480888, but wished to fix in a separate patch (despite that it would have been slightly easier to fix it in the same patch).
layout/base/nsCSSRendering.cpp
layout/reftests/xul/reftest.list
layout/reftests/xul/tree-row-outline-1-notref.xul
layout/reftests/xul/tree-row-outline-1-ref.xul
layout/reftests/xul/tree-row-outline-1.xul
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -609,25 +609,20 @@ nsCSSRendering::PaintOutline(nsPresConte
   nsRect innerRect;
   if (
 #ifdef MOZ_XUL
       aStyleContext->GetPseudoType() == nsCSSPseudoElements::ePseudo_XULTree
 #else
       false
 #endif
      ) {
-    // FIXME: This behavior doesn't make sense; we should switch back to
-    // using aBorderArea.  But since this has been broken since bug
-    // 133165 in August of 2004, that switch should be made in its own
-    // patch changing only that behavior.
-    innerRect = aForFrame->GetVisualOverflowRect();
+    innerRect = aBorderArea;
   } else {
-    innerRect = GetOutlineInnerRect(aForFrame);
+    innerRect = GetOutlineInnerRect(aForFrame) + aBorderArea.TopLeft();
   }
-  innerRect += aBorderArea.TopLeft();
   nscoord offset = ourOutline->mOutlineOffset;
   innerRect.Inflate(offset, offset);
   // If the dirty rect is completely inside the border area (e.g., only the
   // content is being painted), then we can skip out now
   // XXX this isn't exactly true for rounded borders, where the inside curves may
   // encroach into the content area.  A safer calculation would be to
   // shorten insideRect by the radius one each side before performing this test.
   if (innerRect.Contains(aDirtyRect))
--- a/layout/reftests/xul/reftest.list
+++ b/layout/reftests/xul/reftest.list
@@ -1,7 +1,9 @@
 == menuitem-key.xul menuitem-key-ref.xul
 # these random-if(Android) are due to differences between Android Native & Xul, see bug 732569
 random-if(Android||B2G) == menulist-shrinkwrap-1.xul menulist-shrinkwrap-1-ref.xul
 random-if(Android||B2G) fails-if(winWidget) == menulist-shrinkwrap-2.xul menulist-shrinkwrap-2-ref.xul
 == textbox-overflow-1.xul textbox-overflow-1-ref.xul # for bug 749658
 # accesskeys are not normally displayed on Mac, so skip this test
 skip-if(cocoaWidget) == accesskey.xul accesskey-ref.xul
+== tree-row-outline-1.xul tree-row-outline-1-ref.xul
+!= tree-row-outline-1.xul tree-row-outline-1-notref.xul
new file mode 100644
--- /dev/null
+++ b/layout/reftests/xul/tree-row-outline-1-notref.xul
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        >
+
+  <tree seltype="single" flex="1">
+    <treecols>
+      <treecol flex="1"/>
+      <treecol flex="1"/>
+    </treecols>
+    <treechildren>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+    </treechildren>
+  </tree>
+
+</window>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/xul/tree-row-outline-1-ref.xul
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        >
+
+  <html:style>
+    <![CDATA[
+
+      treechildren::-moz-tree-row(odd) {
+        border: 2px solid blue;
+      }
+
+    ]]>
+  </html:style>
+
+  <tree seltype="single" flex="1">
+    <treecols>
+      <treecol flex="1"/>
+      <treecol flex="1"/>
+    </treecols>
+    <treechildren>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+    </treechildren>
+  </tree>
+
+</window>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/xul/tree-row-outline-1.xul
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        >
+
+  <html:style>
+    <![CDATA[
+
+      treechildren::-moz-tree-row(odd) {
+        outline: 2px solid blue;
+        outline-offset: -2px;
+      }
+
+    ]]>
+  </html:style>
+
+  <tree seltype="single" flex="1">
+    <treecols>
+      <treecol flex="1"/>
+      <treecol flex="1"/>
+    </treecols>
+    <treechildren>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+      <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
+    </treechildren>
+  </tree>
+
+</window>