Bug 1523285 - Don't clip outlines of a button input and such. r=bzbarsky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 01 Feb 2019 22:15:34 +0000
changeset 456520 432ae563202be639d203852c53f7457ab08e7fac
parent 456519 d1b835c9d5ce607ec63c4fc2a39eebbddb01f487
child 456521 7213808d10e0e5f417d21ccf938d0ba3e614c9ed
push id111656
push userdvarga@mozilla.com
push dateSat, 02 Feb 2019 09:51:54 +0000
treeherdermozilla-inbound@d8cebb3b46cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1523285
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523285 - Don't clip outlines of a button input and such. r=bzbarsky Sorry, should've seen this :( Differential Revision: https://phabricator.services.mozilla.com/D17834
layout/forms/nsHTMLButtonControlFrame.cpp
testing/web-platform/tests/css/css-ui/outline-021.html
testing/web-platform/tests/css/css-ui/reference/outline-021-notref.html
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -91,30 +91,32 @@ void nsHTMLButtonControlFrame::BuildDisp
 
   nsDisplayList onTop;
   if (IsVisibleForPainting()) {
     mRenderer.DisplayButton(aBuilder, aLists.BorderBackground(), &onTop);
   }
 
   nsDisplayListCollection set(aBuilder);
 
-  DisplayListClipState::AutoSaveRestore clipState(aBuilder);
+  {
+    DisplayListClipState::AutoSaveRestore clipState(aBuilder);
 
-  if (ShouldClipPaintingToBorderBox()) {
-    nsMargin border = StyleBorder()->GetComputedBorder();
-    nsRect rect(aBuilder->ToReferenceFrame(this), GetSize());
-    rect.Deflate(border);
-    nscoord radii[8];
-    bool hasRadii = GetPaddingBoxBorderRadii(radii);
-    clipState.ClipContainingBlockDescendants(rect, hasRadii ? radii : nullptr);
+    if (ShouldClipPaintingToBorderBox()) {
+      nsMargin border = StyleBorder()->GetComputedBorder();
+      nsRect rect(aBuilder->ToReferenceFrame(this), GetSize());
+      rect.Deflate(border);
+      nscoord radii[8];
+      bool hasRadii = GetPaddingBoxBorderRadii(radii);
+      clipState.ClipContainingBlockDescendants(rect, hasRadii ? radii : nullptr);
+    }
+
+    BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), set,
+                             DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT);
   }
 
-  BuildDisplayListForChild(aBuilder, mFrames.FirstChild(), set,
-                           DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT);
-
   // Put the foreground outline and focus rects on top of the children
   set.Content()->AppendToTop(&onTop);
   set.MoveTo(aLists);
 
   DisplayOutline(aBuilder, aLists);
 
   // to draw border when selected in editor
   DisplaySelectionOverlay(aBuilder, aLists.Content());
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-ui/outline-021.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS-UI test: outline works on button inputs</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel=help href="https://drafts.csswg.org/css-ui/#outline-props">
+<link rel="mismatch" href="./reference/outline-021-notref.html">
+
+<input type="submit" style="outline: 10px solid blue">
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-ui/reference/outline-021-notref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS test reference</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+
+<input type="submit" style="outline: none">