Clip scrollbars to box bounds when they don't fit.

There are three cases:

(1) scroller is a non-composited self-painting layer
(2) scroller is not a self-painting layer
(3) scroller is a composited layer
(3a) scroller is a composited layer that does not use composited scrolling

Case (1) already worked correctly through the background clip applied by
PaintLayerPainter.  Case (2) is addressed by the change in BlockPainter.

Case (3) is addressed by the changes in CompositedLayerMapping.  The clip is
applied by m_overflowControlsHostLayer.  GraphicsLayerTreeBuilder is modified
to preserve the layer tree in case (3a).

I have renamed m_overflowControlsClippingLayer for clarity, since the overflow
controls can now be clipped for two different reasons.

Note that for an iframe with CSS "resize", the scroll corner comes from the
iframe element's CompositedLayerMapping, not the inner PaintLayerCompositor.
For this reason, PLC::attachFrameContentLayersToIframeLayer must preserve
overflow controls just like the "!parented" path of GraphicsLayerTreeBuilder.

BUG=549174

Committed: https://crrev.com/bf0a5ac073c0844a514a979beab5c8b08a445393
Cr-Commit-Position: refs/heads/master@{#360860}

Review URL: https://codereview.chromium.org/1448253002

Cr-Commit-Position: refs/heads/master@{#361037}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 4078baeb..5ffa8839 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1295,6 +1295,74 @@
 
 crbug.com/550285 [ XP ] virtual/syncpaint/inspector/tracing/decode-resize.html [ Slow Pass Failure ]
 
+crbug.com/549174 compositing/iframes/resizer.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/layer-creation/fixed-position-in-fixed-overflow.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/clear-scroll-parent.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/composited-scrolling-paint-phases.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/content-gains-scrollbars.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/overflow-scrollbar-layers.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/reparented-scrollbars-non-sc-anc.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/resize-painting.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/scroll-parent-absolute.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/scrolling-content-clip-to-viewport.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/scrolling-without-painting.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/selection-gaps-after-removing-scrolling-contents.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/selection-gaps-toggling-with-scrolling-contents.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/selection-gaps-toggling.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/textarea-scroll-touch.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/universal-accelerated-overflow-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/overflow/updating-scrolling-content.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/repaint/should-not-clip-composited-overflow-scrolling-layer.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/scrollbars/nested-overlay-scrollbars.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/squashing/composited-bounds-for-negative-z.html [ NeedsRebaseline ]
+crbug.com/549174 compositing/update-paint-phases.html [ NeedsRebaseline ]
+crbug.com/549174 fast/repaint/overflow-move-after-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 fast/repaint/overflow-scroll-after-move.html [ NeedsRebaseline ]
+crbug.com/549174 fast/replaced/width100percent-textarea.html [ NeedsRebaseline ]
+crbug.com/549174 paint/invalidation/invalidate-after-composited-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 paint/selection/selection-within-composited-scroller.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/resize-painting.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/syncpaint/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/syncpaint/fast/repaint/overflow-move-after-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/syncpaint/fast/repaint/overflow-scroll-after-move.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/syncpaint/paint/invalidation/invalidate-after-composited-scroll.html [ NeedsRebaseline ]
+crbug.com/549174 virtual/syncpaint/paint/selection/selection-within-composited-scroller.html [ NeedsRebaseline ]
+
+crbug.com/549174 [ Win Mac ] css3/flexbox/flexbox-baseline.html [ NeedsRebaseline ]
+crbug.com/549174 [ Win Mac ] scrollbars/border-box-rect-clips-scrollbars.html [ NeedsRebaseline ]
+crbug.com/549174 [ Win Mac ] virtual/prefer_compositing_to_lcd_text/scrollbars/border-box-rect-clips-scrollbars.html [ NeedsRebaseline ]
+crbug.com/549174 [ Win Mac ] virtual/rootlayerscrolls/scrollbars/border-box-rect-clips-scrollbars.html [ NeedsRebaseline ]
+
+crbug.com/549174 [ Win ] fast/forms/select/listbox-appearance-basic.html [ NeedsRebaseline ]
+crbug.com/549174 [ Win ] fast/forms/select/listbox-appearance-separator.html [ NeedsRebaseline ]
+crbug.com/549174 [ Win ] fast/forms/select/menulist-appearance-basic.html [ NeedsRebaseline ]
+
 crbug.com/474759 fast/writing-mode/vertical-rl-replaced-selection.html [ Failure ]
 crbug.com/474759 fast/block/line-layout/selection-highlight-overlap.html [ Failure ]
 crbug.com/502927 [ XP ] paint/frames/frameset-with-stacking-context-and-not-stacking-context-children.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt
index 3095bd46..849f48c 100644
--- a/third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt
@@ -51,9 +51,14 @@
               ]
             },
             {
-              "position": [287, 137],
-              "bounds": [15, 15],
-              "drawsContent": true
+              "bounds": [304, 154],
+              "children": [
+                {
+                  "position": [287, 137],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
             }
           ]
         }
diff --git a/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
index 425e6792..b0058b6 100644
--- a/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
@@ -31,6 +31,7 @@
               ]
             },
             {
+              "bounds": [800, 600],
               "children": [
                 {
                   "position": [785, 0],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
index 068faec..39c25efe 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -62,6 +62,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt
index 5a12c16..21ff09a 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt
@@ -23,6 +23,7 @@
               ]
             },
             {
+              "bounds": [308, 208],
               "children": [
                 {
                   "position": [289, 4],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt
index deaa07a..6d86be9 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -74,6 +74,7 @@
                   ]
                 },
                 {
+                  "bounds": [202, 202],
                   "paintingPhases": [
                     "GraphicsLayerPaintBackground",
                     "GraphicsLayerPaintForeground",
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt
index 183c7e49..d243ed8b 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 0],
@@ -55,6 +56,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -84,6 +86,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -116,6 +119,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 85],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt
index 183c7e49..d243ed8b 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 0],
@@ -55,6 +56,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -84,6 +86,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -116,6 +119,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 85],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
index df0bc6e..b11e3e4 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -55,6 +55,7 @@
           "bounds": [1200, 1000],
           "children": [
             {
+              "bounds": [1200, 1000],
               "children": [
                 {
                   "position": [1193, 0],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/resize-painting-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/resize-painting-expected.txt
index 5755f75..7cd1352 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/resize-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/resize-painting-expected.txt
@@ -12,9 +12,14 @@
           "drawsContent": true,
           "children": [
             {
-              "position": [85, 85],
-              "bounds": [15, 15],
-              "drawsContent": true
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
             }
           ]
         }
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt
index 1159b1a..a861f58 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -27,6 +27,7 @@
                   ]
                 },
                 {
+                  "bounds": [500, 500],
                   "children": [
                     {
                       "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
index fe87f95..eca105b 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -58,6 +58,7 @@
         },
         {
           "position": [98, 90],
+          "bounds": [102, 102],
           "children": [
             {
               "position": [94, 1],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
index d7459347..a74270d 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -20,6 +20,7 @@
               ]
             },
             {
+              "bounds": [320, 340],
               "children": [
                 {
                   "position": [0, 325],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt
index f9f7d07..466febf8 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt
@@ -23,6 +23,7 @@
               ]
             },
             {
+              "bounds": [202, 202],
               "children": [
                 {
                   "position": [1, 186],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
index 1137062..4b59382 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -26,6 +26,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -85,6 +86,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -139,6 +141,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -201,6 +204,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -260,6 +264,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -314,6 +319,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -372,6 +378,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -423,6 +430,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -475,6 +483,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -533,6 +542,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -592,6 +602,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -650,6 +661,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt
index 90b3ff27..59fbd8e 100644
--- a/third_party/WebKit/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt
@@ -31,6 +31,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
index dcb7f4d..c7027fd 100644
--- a/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
@@ -57,6 +57,7 @@
                     },
                     {
                       "position": [2, 502],
+                      "bounds": [204, 204],
                       "children": [
                         {
                           "position": [2, 195],
@@ -78,6 +79,7 @@
               ]
             },
             {
+              "bounds": [404, 404],
               "children": [
                 {
                   "position": [395, 2],
diff --git a/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt b/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt
index ab80f81..9db0a91 100644
--- a/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt
@@ -35,6 +35,7 @@
                   ]
                 },
                 {
+                  "bounds": [300, 300],
                   "children": [
                     {
                       "position": [285, 0],
diff --git a/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt
index 2d56195..fe482d2c 100644
--- a/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt
@@ -48,6 +48,7 @@
               ]
             },
             {
+              "bounds": [102, 102],
               "paintingPhases": [
                 "GraphicsLayerPaintBackground",
                 "GraphicsLayerPaintForeground",
diff --git a/third_party/WebKit/LayoutTests/fast/repaint/overflow-move-after-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/overflow-move-after-scroll-expected.txt
index 8dfd5f3..67397b3a 100644
--- a/third_party/WebKit/LayoutTests/fast/repaint/overflow-move-after-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/repaint/overflow-move-after-scroll-expected.txt
@@ -33,6 +33,7 @@
               ]
             },
             {
+              "bounds": [700, 400],
               "children": [
                 {
                   "position": [0, 385],
diff --git a/third_party/WebKit/LayoutTests/fast/repaint/overflow-scroll-after-move-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/overflow-scroll-after-move-expected.txt
index f99c2df..d4e783d 100644
--- a/third_party/WebKit/LayoutTests/fast/repaint/overflow-scroll-after-move-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/repaint/overflow-scroll-after-move-expected.txt
@@ -33,6 +33,7 @@
               ]
             },
             {
+              "bounds": [300, 400],
               "children": [
                 {
                   "position": [0, 385],
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/invalidate-after-composited-scroll-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/invalidate-after-composited-scroll-expected.txt
index 0aac43dc..7a475c6 100644
--- a/third_party/WebKit/LayoutTests/paint/invalidation/invalidate-after-composited-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/invalidate-after-composited-scroll-expected.txt
@@ -31,6 +31,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [185, 0],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
index ff2a18fd..290b2c179 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
@@ -25,6 +25,7 @@
               ]
             },
             {
+              "bounds": [302, 302],
               "children": [
                 {
                   "position": [1, 286],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 058b91a..b85a763 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -39,6 +39,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -136,10 +137,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2546],
+  "bounds": [785, 2562],
   "children": [
     {
-      "bounds": [785, 2546],
+      "bounds": [785, 2562],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -161,6 +162,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -258,10 +260,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4498],
+  "bounds": [785, 4530],
   "children": [
     {
-      "bounds": [785, 4498],
+      "bounds": [785, 4530],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -280,6 +282,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -377,10 +380,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6402],
+  "bounds": [785, 6450],
   "children": [
     {
-      "bounds": [785, 6402],
+      "bounds": [785, 6450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -399,6 +402,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
index 6f74aec..4a47763 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -36,6 +36,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -133,10 +134,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2498],
+  "bounds": [785, 2514],
   "children": [
     {
-      "bounds": [785, 2498],
+      "bounds": [785, 2514],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -155,6 +156,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -252,10 +254,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4402],
+  "bounds": [785, 4434],
   "children": [
     {
-      "bounds": [785, 4402],
+      "bounds": [785, 4434],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -274,6 +276,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 2c91562..d6996d2 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -36,6 +36,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -133,10 +134,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2498],
+  "bounds": [785, 2514],
   "children": [
     {
-      "bounds": [785, 2498],
+      "bounds": [785, 2514],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -158,6 +159,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -255,10 +257,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4450],
+  "bounds": [785, 4482],
   "children": [
     {
-      "bounds": [785, 4450],
+      "bounds": [785, 4482],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -280,6 +282,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -377,10 +380,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6402],
+  "bounds": [785, 6450],
   "children": [
     {
-      "bounds": [785, 6402],
+      "bounds": [785, 6450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -399,6 +402,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
index f9ac3308..ebcfe549 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [206, 126],
               "children": [
                 {
                   "position": [190, 1],
@@ -59,6 +60,7 @@
               ]
             },
             {
+              "bounds": [206, 126],
               "children": [
                 {
                   "position": [190, 1],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 778ead5..ee3d294 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -31,6 +31,7 @@
               ]
             },
             {
+              "bounds": [500, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
index 527148b..5559a78 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
index 60f1bd56..b172a4e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
@@ -43,6 +43,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 058b91a..b85a763 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -39,6 +39,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -136,10 +137,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2546],
+  "bounds": [785, 2562],
   "children": [
     {
-      "bounds": [785, 2546],
+      "bounds": [785, 2562],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -161,6 +162,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -258,10 +260,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4498],
+  "bounds": [785, 4530],
   "children": [
     {
-      "bounds": [785, 4498],
+      "bounds": [785, 4530],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -280,6 +282,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -377,10 +380,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6402],
+  "bounds": [785, 6450],
   "children": [
     {
-      "bounds": [785, 6402],
+      "bounds": [785, 6450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -399,6 +402,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index 6f74aec..4a47763 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -36,6 +36,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -133,10 +134,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2498],
+  "bounds": [785, 2514],
   "children": [
     {
-      "bounds": [785, 2498],
+      "bounds": [785, 2514],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -155,6 +156,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -252,10 +254,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4402],
+  "bounds": [785, 4434],
   "children": [
     {
-      "bounds": [785, 4402],
+      "bounds": [785, 4434],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -274,6 +276,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 2c91562..d6996d2 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -36,6 +36,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -133,10 +134,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2498],
+  "bounds": [785, 2514],
   "children": [
     {
-      "bounds": [785, 2498],
+      "bounds": [785, 2514],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -158,6 +159,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -255,10 +257,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4450],
+  "bounds": [785, 4482],
   "children": [
     {
-      "bounds": [785, 4450],
+      "bounds": [785, 4482],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -280,6 +282,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
@@ -377,10 +380,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6402],
+  "bounds": [785, 6450],
   "children": [
     {
-      "bounds": [785, 6402],
+      "bounds": [785, 6450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -399,6 +402,7 @@
               ]
             },
             {
+              "bounds": [300, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index 7ae5643..52e2586 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -113,6 +113,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 4fa99a3c..8336acb 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -63,6 +63,7 @@
               ]
             },
             {
+              "bounds": [800, 500],
               "children": [
                 {
                   "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index f9ac3308..ebcfe549 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [206, 126],
               "children": [
                 {
                   "position": [190, 1],
@@ -59,6 +60,7 @@
               ]
             },
             {
+              "bounds": [206, 126],
               "children": [
                 {
                   "position": [190, 1],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index fc1b74f3..569027b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -80,6 +80,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.png b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.png
new file mode 100644
index 0000000..baaca02
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.txt
new file mode 100644
index 0000000..47da84cc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars-expected.txt
@@ -0,0 +1,9 @@
+Every scrollbar should be cut off at the dotted line.
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
diff --git a/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars.html b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars.html
new file mode 100644
index 0000000..f4104076
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/scrollbars/border-box-rect-clips-scrollbars.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<style>
+.scroller {
+    border: 2px solid cyan;
+    height: 50px;
+    overflow: scroll;
+    width: 8px;
+    margin-left: 10px;
+    margin-top: 5px;
+    display: inline-block;
+}
+.selfpainting {
+    position: relative;
+}
+.rounded {
+    border-radius: 8px;
+}
+.composited {
+    will-change: transform;
+}
+.outlined {
+    outline: 6px solid yellow;
+}
+.space {
+    width: 1px;
+    height: 100px;
+}
+.clipline {
+    display: inline-block;
+    width: 0px;
+    height: 50px;
+    border-left: 1px dotted black;
+    margin-left: -12px;
+    margin-right: 12px;
+    top: -2px;
+    position: relative;
+}
+</style>
+Every scrollbar should be cut off at the dotted line.<br>
+<div class="scroller"><div class="space"></div></div><div class="clipline"></div>
+<div class="scroller selfpainting"><div class="space"></div></div><div class="clipline"></div>
+<div class="scroller composited"><div class="space"></div></div><div class="clipline"></div>
+<div class="scroller composited outlined"><div class="space"></div></div><div class="clipline"></div>
+<div class="rounded scroller"><div class="space"></div></div><div class="clipline"></div>
+<div class="rounded scroller selfpainting "><div class="space"></div></div><div class="clipline"></div>
+<div class="rounded scroller composited"><div class="space"></div></div><div class="clipline"></div>
+<div class="rounded scroller composited outlined"><div class="space"></div></div><div class="clipline"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsTextWithPixelResults();
+</script>
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
index 068faec..39c25efe 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -62,6 +62,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
index 5a12c16..21ff09a 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
@@ -23,6 +23,7 @@
               ]
             },
             {
+              "bounds": [308, 208],
               "children": [
                 {
                   "position": [289, 4],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
index deaa07a..6d86be9 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -74,6 +74,7 @@
                   ]
                 },
                 {
+                  "bounds": [202, 202],
                   "paintingPhases": [
                     "GraphicsLayerPaintBackground",
                     "GraphicsLayerPaintForeground",
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
index 183c7e49..d243ed8b 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 0],
@@ -55,6 +56,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -84,6 +86,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -116,6 +119,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 85],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
index 663eae2f..9b7a759 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
@@ -22,6 +22,7 @@
               ]
             },
             {
+              "bounds": [300, 300],
               "children": [
                 {
                   "position": [0, 285],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
index 663eae2f..9b7a759 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
@@ -22,6 +22,7 @@
               ]
             },
             {
+              "bounds": [300, 300],
               "children": [
                 {
                   "position": [0, 285],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
index 663eae2f..9b7a759 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
@@ -22,6 +22,7 @@
               ]
             },
             {
+              "bounds": [300, 300],
               "children": [
                 {
                   "position": [0, 285],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
index 183c7e49..d243ed8b 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -26,6 +26,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 0],
@@ -55,6 +56,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -84,6 +86,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [0, 85],
@@ -116,6 +119,7 @@
               ]
             },
             {
+              "bounds": [100, 100],
               "children": [
                 {
                   "position": [85, 85],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
index df0bc6e..b11e3e4 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -55,6 +55,7 @@
           "bounds": [1200, 1000],
           "children": [
             {
+              "bounds": [1200, 1000],
               "children": [
                 {
                   "position": [1193, 0],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/resize-painting-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/resize-painting-expected.txt
index 5755f75..7cd1352 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/resize-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/resize-painting-expected.txt
@@ -12,9 +12,14 @@
           "drawsContent": true,
           "children": [
             {
-              "position": [85, 85],
-              "bounds": [15, 15],
-              "drawsContent": true
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
             }
           ]
         }
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
index 1159b1a..a861f58 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -27,6 +27,7 @@
                   ]
                 },
                 {
+                  "bounds": [500, 500],
                   "children": [
                     {
                       "position": [0, 485],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
index fe87f95..eca105b 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -58,6 +58,7 @@
         },
         {
           "position": [98, 90],
+          "bounds": [102, 102],
           "children": [
             {
               "position": [94, 1],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
index d7459347..a74270d 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -20,6 +20,7 @@
               ]
             },
             {
+              "bounds": [320, 340],
               "children": [
                 {
                   "position": [0, 325],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
index f9f7d07..466febf8 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
@@ -23,6 +23,7 @@
               ]
             },
             {
+              "bounds": [202, 202],
               "children": [
                 {
                   "position": [1, 186],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
index 1137062..4b59382 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -26,6 +26,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -85,6 +86,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -139,6 +141,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -201,6 +204,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -260,6 +264,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -314,6 +319,7 @@
                   ]
                 },
                 {
+                  "bounds": [104, 104],
                   "children": [
                     {
                       "position": [2, 87],
@@ -372,6 +378,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -423,6 +430,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -475,6 +483,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -533,6 +542,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -592,6 +602,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
@@ -650,6 +661,7 @@
               ]
             },
             {
+              "bounds": [104, 104],
               "children": [
                 {
                   "position": [2, 87],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
index 246c6c4..9894d08 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
@@ -35,6 +35,7 @@
               ]
             },
             {
+              "bounds": [210, 210],
               "children": [
                 {
                   "position": [5, 190],
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
index 90b3ff27..59fbd8e 100644
--- a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
@@ -31,6 +31,7 @@
               ]
             },
             {
+              "bounds": [200, 200],
               "children": [
                 {
                   "position": [0, 185],
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 1e088dd..023c3dd 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -549,7 +549,7 @@
         layerConfigChanged = true;
     }
     if (layoutObject->isLayoutPart()) {
-        if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutObject)))
+        if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayoutPart(layoutObject)))
             layerConfigChanged = true;
     }
 
@@ -710,11 +710,11 @@
 
     // Might update graphicsLayerParentLocation.
     updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
-    updateOverflowControlsHostLayerGeometry(compositingStackingContext, compositingContainer);
 
     FloatSize contentsSize(relativeCompositingBounds.size());
 
     updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingBounds, graphicsLayerParentLocation);
+    updateOverflowControlsHostLayerGeometry(compositingStackingContext, compositingContainer);
     updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
     updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerParentLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation);
 
@@ -829,12 +829,14 @@
     if (!m_overflowControlsHostLayer)
         return;
 
+    LayoutPoint hostLayerPosition;
+
     if (needsToReparentOverflowControls()) {
-        if (m_overflowControlsClippingLayer) {
-            m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->size());
-            m_overflowControlsClippingLayer->setOffsetFromLayoutObject(m_ancestorClippingLayer->offsetFromLayoutObject());
-            m_overflowControlsClippingLayer->setMasksToBounds(true);
-            m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControlsClippingLayer->offsetFromLayoutObject()));
+        if (m_overflowControlsAncestorClippingLayer) {
+            m_overflowControlsAncestorClippingLayer->setSize(m_ancestorClippingLayer->size());
+            m_overflowControlsAncestorClippingLayer->setOffsetFromLayoutObject(m_ancestorClippingLayer->offsetFromLayoutObject());
+            m_overflowControlsAncestorClippingLayer->setMasksToBounds(true);
+            hostLayerPosition = toLayoutPoint(LayoutSize(-m_overflowControlsAncestorClippingLayer->offsetFromLayoutObject()));
 
             FloatPoint position = m_ancestorClippingLayer->position();
             if (compositingStackingContext != compositingContainer) {
@@ -844,20 +846,29 @@
                 position += offsetFromStackingContainer;
             }
 
-            m_overflowControlsClippingLayer->setPosition(position);
+            m_overflowControlsAncestorClippingLayer->setPosition(position);
         } else {
             // The controls are in the same 2D space as the compositing container, so we can map them into the space of the container.
             TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
             m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackingContext->layoutObject(), transformState, ApplyContainerFlip);
             transformState.flatten();
-            LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState.lastPlanarPoint());
+            hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint());
             if (PaintLayerScrollableArea* scrollableArea = compositingStackingContext->scrollableArea())
-                offsetFromStackingContainer.move(LayoutSize(scrollableArea->adjustedScrollOffset()));
-            m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStackingContainer));
+                hostLayerPosition.move(LayoutSize(scrollableArea->adjustedScrollOffset()));
         }
-    } else {
-        m_overflowControlsHostLayer->setPosition(FloatPoint());
     }
+
+    // To clip correctly, m_overflowControlsHostLayer should match the border box rect, which is at
+    // the origin of the LayoutObject. The parent is m_graphicsLayer, so we must adjust the position
+    // by the distance from m_graphicsLayer to the LayoutObject.
+
+    IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
+    hostLayerPosition.move(-offsetFromLayoutObject);
+    m_overflowControlsHostLayer->setPosition(FloatPoint(hostLayerPosition));
+
+    const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSnappedBorderBoxRect();
+    m_overflowControlsHostLayer->setSize(FloatSize(borderBox.size()));
+    m_overflowControlsHostLayer->setMasksToBounds(true);
 }
 
 void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
@@ -1104,7 +1115,7 @@
     bottomLayer = m_graphicsLayer.get();
     if (m_isMainFrameLayoutViewLayer)
         bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewport().containerLayer();
-    updateBottomLayer(m_overflowControlsClippingLayer.get());
+    updateBottomLayer(m_overflowControlsAncestorClippingLayer.get());
     updateBottomLayer(m_overflowControlsHostLayer.get());
     if (m_layerForHorizontalScrollbar)
         m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get());
@@ -1345,8 +1356,8 @@
 
     bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needsVerticalScrollbarLayer || needsScrollCornerLayer;
     toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowControlsHostLayer, CompositingReasonLayerForOverflowControlsHost);
-    bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncestorClip;
-    toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowClipLayer, CompositingReasonLayerForOverflowControlsHost);
+    bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && needsAncestorClip;
+    toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsOverflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost);
 
     if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
         if (horizontalScrollbarLayerChanged)
@@ -1360,11 +1371,10 @@
 
 void CompositedLayerMapping::positionOverflowControlsLayers()
 {
-    IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
     if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
         Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
         if (hBar) {
-            layer->setPosition(hBar->frameRect().location() - offsetFromLayoutObject);
+            layer->setPosition(hBar->frameRect().location());
             layer->setSize(FloatSize(hBar->frameRect().size()));
             if (layer->hasContentsLayer())
                 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().size()));
@@ -1375,7 +1385,7 @@
     if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
         Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
         if (vBar) {
-            layer->setPosition(vBar->frameRect().location() - offsetFromLayoutObject);
+            layer->setPosition(vBar->frameRect().location());
             layer->setSize(FloatSize(vBar->frameRect().size()));
             if (layer->hasContentsLayer())
                 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().size()));
@@ -1385,7 +1395,7 @@
 
     if (GraphicsLayer* layer = layerForScrollCorner()) {
         const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->scrollCornerAndResizerRect();
-        layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offsetFromLayoutObject));
+        layer->setPosition(FloatPoint(scrollCornerAndResizer.location()));
         layer->setSize(FloatSize(scrollCornerAndResizer.size()));
         layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
     }
@@ -1960,7 +1970,7 @@
 
 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const PaintLayer& enclosingLayer)
 {
-    GraphicsLayer* host = m_overflowControlsClippingLayer.get();
+    GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get();
     if (!host)
         host = m_overflowControlsHostLayer.get();
     host->removeFromParent();
@@ -1984,6 +1994,22 @@
     return m_graphicsLayer.get();
 }
 
+void CompositedLayerMapping::setSublayers(const GraphicsLayerVector& sublayers)
+{
+    GraphicsLayer* overflowControlsContainer = m_overflowControlsAncestorClippingLayer
+        ? m_overflowControlsAncestorClippingLayer.get()
+        : m_overflowControlsHostLayer.get();
+    GraphicsLayer* parent = parentForSublayers();
+    bool needsOverflowControlsReattached = overflowControlsContainer && overflowControlsContainer->parent() == parent;
+
+    parent->setChildren(sublayers);
+
+    // If we have scrollbars, but are not using composited scrolling, then parentForSublayers may return m_graphicsLayer.
+    // In that case, the above call to setChildren has clobbered the overflow controls host layer, so we need to reattach it.
+    if (needsOverflowControlsReattached)
+        parent->addChild(overflowControlsContainer);
+}
+
 GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const
 {
     if (m_squashingContainmentLayer)
@@ -2520,8 +2546,8 @@
         name = "Scroll Corner Layer";
     } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
         name = "Overflow Controls Host Layer";
-    } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
-        name = "Overflow Controls ClipLayer Layer";
+    } else if (graphicsLayer == m_overflowControlsAncestorClippingLayer.get()) {
+        name = "Overflow Controls Ancestor Clipping Layer";
     } else if (graphicsLayer == m_scrollingLayer.get()) {
         name = "Scrolling Layer";
     } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
index 6cf26aa..0de87d8 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
@@ -111,6 +111,7 @@
 
     GraphicsLayer* parentForSublayers() const;
     GraphicsLayer* childForSuperlayers() const;
+    void setSublayers(const GraphicsLayerVector&);
 
     bool hasChildTransformLayer() const { return m_childTransformLayer; }
     GraphicsLayer* childTransformLayer() const { return m_childTransformLayer.get(); }
@@ -329,9 +330,9 @@
     //      | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTIONAL]
     //      |                                             + m_scrollingContentsLayer [Present iff m_scrollingLayer is present]
     //      |                                               + m_scrollingBlockSelectionLayer [Present iff m_scrollingLayer is present]
-    //      + m_overflowControlsClippingLayer [OPTIONAL] // *The overflow controls may need to be repositioned in the
-    //        + m_overflowControlsHostLayer [OPTIONAL]   //  graphics layer tree by the RLC to ensure that they stack
-    //          + m_layerForVerticalScrollbar [OPTIONAL] //  above scrolling content.
+    //      + m_overflowControlsAncestorClippingLayer [OPTIONAL] // *The overflow controls may need to be repositioned in the
+    //        + m_overflowControlsHostLayer [OPTIONAL]           //  graphics layer tree by the RLC to ensure that they stack
+    //          + m_layerForVerticalScrollbar [OPTIONAL]         //  above scrolling content.
     //          + m_layerForHorizontalScrollbar [OPTIONAL]
     //          + m_layerForScrollCorner [OPTIONAL]
     //
@@ -398,17 +399,18 @@
     OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
     OwnPtr<GraphicsLayer> m_layerForScrollCorner;
 
-    // This layer exists to simplify the reparenting of overflow control that is occasionally required
-    // to ensure that scrollbars appear above scrolling content.
+    // This layer contains the scrollbar and scroll corner layers and clips them to the border box
+    // bounds of our LayoutObject. It is usually added to m_graphicsLayer, but may be reparented by
+    // GraphicsLayerTreeBuilder to ensure that scrollbars appear above scrolling content.
     OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
 
     // The reparented overflow controls sometimes need to be clipped by a non-ancestor. In just the same
     // way we need an ancestor clipping layer to clip this CLM's internal hierarchy, we add another layer
-    // to clip the overflow controls. It would be possible to make m_overflowControlsHostLayer be
-    // responsible for applying this clip, but that could require repositioning all of the overflow
-    // controls since the this clip may apply an offset. By using a separate layer, the overflow controls
-    // can remain ignorant of the layers above them and still work correctly.
-    OwnPtr<GraphicsLayer> m_overflowControlsClippingLayer;
+    // to clip the overflow controls. We could combine this with m_overflowControlsHostLayer, but that
+    // would require manually intersecting their clips, and shifting the overflow controls to compensate
+    // for this clip's offset. By using a separate layer, the overflow controls can remain ignorant of
+    // ancestor clipping.
+    OwnPtr<GraphicsLayer> m_overflowControlsAncestorClippingLayer;
 
     // A squashing CLM has two possible squashing-related structures.
     //
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
index 4f2c16d8..3c24bde 100644
--- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
@@ -97,30 +97,10 @@
     if (hasCompositedLayerMapping) {
         bool parented = false;
         if (layer.layoutObject()->isLayoutPart())
-            parented = PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layer.layoutObject()));
+            parented = PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayoutPart(layer.layoutObject()));
 
         if (!parented)
-            currentCompositedLayerMapping->parentForSublayers()->setChildren(layerChildren);
-
-        // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer.
-        // Otherwise, the overflow control layers are normal children.
-        // FIXME: Why isn't this handled in CLM updateInternalHierarchy?
-        if (!currentCompositedLayerMapping->hasClippingLayer() && !currentCompositedLayerMapping->hasScrollingLayer()) {
-            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForHorizontalScrollbar()) {
-                overflowControlLayer->removeFromParent();
-                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
-            }
-
-            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForVerticalScrollbar()) {
-                overflowControlLayer->removeFromParent();
-                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
-            }
-
-            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForScrollCorner()) {
-                overflowControlLayer->removeFromParent();
-                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
-            }
-        }
+            currentCompositedLayerMapping->setSublayers(layerChildren);
 
         if (shouldAppendLayer(layer))
             info.childLayersOfEnclosingCompositedLayer->append(currentCompositedLayerMapping->childForSuperlayers());
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
index e460ecc4..ad6b112 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -645,8 +645,7 @@
     return nullptr;
 }
 
-// FIXME: What does this function do? It needs a clearer name.
-bool PaintLayerCompositor::parentFrameContentLayers(LayoutPart* layoutObject)
+bool PaintLayerCompositor::attachFrameContentLayersToIframeLayer(LayoutPart* layoutObject)
 {
     PaintLayerCompositor* innerCompositor = frameContentsCompositor(layoutObject);
     if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerCompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame)
@@ -656,13 +655,7 @@
     if (!layer->hasCompositedLayerMapping())
         return false;
 
-    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
-    GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
-    GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
-    if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != rootLayer) {
-        hostingLayer->removeAllChildren();
-        hostingLayer->addChild(rootLayer);
-    }
+    layer->compositedLayerMapping()->setSublayers(GraphicsLayerVector(1, innerCompositor->rootGraphicsLayer()));
     return true;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
index e679e81..b38975f 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
@@ -132,7 +132,7 @@
 
     static PaintLayerCompositor* frameContentsCompositor(LayoutPart*);
     // Return true if the layers changed.
-    static bool parentFrameContentLayers(LayoutPart*);
+    static bool attachFrameContentLayersToIframeLayer(LayoutPart*);
 
     // Update the geometry of the layers used for clipping and scrolling in frames.
     void frameViewDidChangeLocation(const IntPoint& contentsOffset);
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.cpp b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
index 75855f4..bd5b0fc 100644
--- a/third_party/WebKit/Source/core/paint/BlockPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
@@ -74,6 +74,12 @@
 {
     PaintPhase phase = paintInfo.phase;
     if (m_layoutBlock.hasOverflowClip() && m_layoutBlock.style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(&m_layoutBlock) && !paintInfo.paintRootBackgroundOnly()) {
+        Optional<ClipRecorder> clipRecorder;
+        if (!m_layoutBlock.layer()->isSelfPaintingLayer()) {
+            LayoutRect clipRect = m_layoutBlock.borderBoxRect();
+            clipRect.moveBy(paintOffset);
+            clipRecorder.emplace(*paintInfo.context, m_layoutBlock, DisplayItem::ClipScrollbarsToBoxBounds, clipRect);
+        }
         ScrollableAreaPainter(*m_layoutBlock.layer()->scrollableArea()).paintOverflowControls(paintInfo.context, roundedIntPoint(paintOffset), paintInfo.cullRect(), false /* paintingOverlayControls */);
     }
 }
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
index fa72aa8c..d1574150 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
@@ -140,6 +140,7 @@
         DEBUG_STRING_CASE(ClipLayerOverflowControls);
         DEBUG_STRING_CASE(ClipNodeImage);
         DEBUG_STRING_CASE(ClipPopupListBoxFrame);
+        DEBUG_STRING_CASE(ClipScrollbarsToBoxBounds);
         DEBUG_STRING_CASE(ClipSelectionImage);
         DEBUG_STRING_CASE(PageWidgetDelegateClip);
         DEBUG_STRING_CASE(ClipPrintedPage);
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
index 2670d44..500cbf8 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -127,6 +127,7 @@
         ClipLayerOverflowControls,
         ClipNodeImage,
         ClipPopupListBoxFrame,
+        ClipScrollbarsToBoxBounds,
         ClipSelectionImage,
         PageWidgetDelegateClip,
         ClipPrintedPage,