Bug 1043537 - Don't show resize handle for generated content. r?Enn draft
authorJonathan Chan <jchan@mozilla.com>
Tue, 07 Jun 2016 10:22:04 -0700
changeset 376751 b5b5b786e40daca3b715fcb7427a24a43052ce21
parent 375937 396b577b98e64fe95223cfce095f84fe0a67da01
child 523228 89351c13259c4d3ba73f71b7ac20db7ee6fbf3df
push id20660
push userbmo:jchan@mozilla.com
push dateWed, 08 Jun 2016 17:18:36 +0000
reviewersEnn
bugs1043537
milestone50.0a1
Bug 1043537 - Don't show resize handle for generated content. r?Enn MozReview-Commit-ID: IZHqb9IwaAl
layout/generic/nsGfxScrollFrame.cpp
layout/reftests/bugs/1043537-1-ref.html
layout/reftests/bugs/1043537-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4238,19 +4238,26 @@ ScrollFrameHelper::CreateAnonymousConten
   // scroll frame for the print preview window, & that does need scrollbars.)
   if (presContext->Document()->IsBeingUsedAsImage() ||
       (!presContext->IsDynamic() &&
        !(mIsRoot && presContext->HasPaginatedScrolling()))) {
     mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = true;
     return NS_OK;
   }
 
-  // Check if the frame is resizable.
+  // Check if the frame is resizable. Note:
+  // "The effect of the resize property on generated content is undefined.
+  //  Implementations should not apply the resize property to generated
+  //  content." [1]
+  // For info on what is generated content, see [2].
+  // [1]: https://drafts.csswg.org/css-ui/#resize
+  // [2]: https://www.w3.org/TR/CSS2/generate.html#content
   int8_t resizeStyle = mOuter->StyleDisplay()->mResize;
-  bool isResizable = resizeStyle != NS_STYLE_RESIZE_NONE;
+  bool isResizable = resizeStyle != NS_STYLE_RESIZE_NONE &&
+                     !mOuter->HasAnyStateBits(NS_FRAME_GENERATED_CONTENT);
 
   nsIScrollableFrame *scrollable = do_QueryFrame(mOuter);
 
   // If we're the scrollframe for the root, then we want to construct
   // our scrollbar frames no matter what.  That way later dynamic
   // changes to propagated overflow styles will show or hide
   // scrollbars on the viewport without requiring frame reconstruction
   // of the viewport (good!).
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1043537-1-ref.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Reference #1 for bug #1043537</title>
+<style>
+div {
+  width: 200px;
+  height: 200px;
+  background: yellow;
+}
+
+div:before {
+  content: '';
+  background: hotpink;
+  display: block;
+  width: 40px;
+  height: 40px;
+  overflow: hidden;
+}
+</style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1043537-1.html
@@ -0,0 +1,26 @@
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Test #1 for bug #1043537</title>
+<style>
+div {
+  width: 200px;
+  height: 200px;
+  background: yellow;
+}
+
+div:before {
+  content: '';
+  background: hotpink;
+  display: block;
+  width: 40px;
+  height: 40px;
+  overflow: hidden;
+  resize: both;
+}
+</style>
+</head>
+<body>
+  <div></div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1832,16 +1832,17 @@ fuzzy-if(/^Windows\x20NT\x205\.1/.test(h
 == 1021564-2.html 1021564-ref.html
 == 1021564-3.html 1021564-ref.html
 == 1021564-4.html 1021564-ref.html
 pref(browser.display.use_document_fonts,0) == 1022481-1.html 1022481-1-ref.html
 fuzzy-if(d2d,1,125200) fuzzy-if(skiaContent,1,126000) == 1022612-1.html 1022612-1-ref.html
 == 1024473-1.html 1024473-1-ref.html
 fuzzy-if(skiaContent,1,24000) == 1025914-1.html 1025914-1-ref.html
 == 1042104-1.html 1042104-1-ref.html
+== 1043537-1.html 1043537-1-ref.html
 == 1044198-1.html 1044198-1-ref.html
 == 1049499-1.html 1049499-1-ref.html
 == 1050493-1.html 1050493-1-ref.html
 == 1050788-1.html about:blank
 == 1053035-1-flex.html 1053035-1-ref.html
 test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.html
 == 1059167-1.html 1059167-1-ref.html
 == 1059498-1.html 1059498-1-ref.html