| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/ScrollableAreaPainter.h" | 5 #include "core/paint/ScrollableAreaPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 8 #include "core/page/Page.h" | 8 #include "core/page/Page.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 9 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/ObjectPaintProperties.h" | 10 #include "core/paint/ObjectPaintProperties.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return; | 29 return; |
| 30 absRect.moveBy(paintOffset); | 30 absRect.moveBy(paintOffset); |
| 31 | 31 |
| 32 if (getScrollableArea().resizer()) { | 32 if (getScrollableArea().resizer()) { |
| 33 if (!cullRect.intersectsCullRect(absRect)) | 33 if (!cullRect.intersectsCullRect(absRect)) |
| 34 return; | 34 return; |
| 35 ScrollbarPainter::paintIntoRect(*getScrollableArea().resizer(), context,
paintOffset, LayoutRect(absRect)); | 35 ScrollbarPainter::paintIntoRect(*getScrollableArea().resizer(), context,
paintOffset, LayoutRect(absRect)); |
| 36 return; | 36 return; |
| 37 } | 37 } |
| 38 | 38 |
| 39 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, getScro
llableArea().box(), DisplayItem::Resizer)) | 39 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, getScro
llableArea().box(), DisplayItem::kResizer)) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), Dis
playItem::Resizer, absRect); | 42 LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), Dis
playItem::kResizer, absRect); |
| 43 | 43 |
| 44 drawPlatformResizerImage(context, absRect); | 44 drawPlatformResizerImage(context, absRect); |
| 45 | 45 |
| 46 // Draw a frame around the resizer (1px grey line) if there are any scrollba
rs present. | 46 // Draw a frame around the resizer (1px grey line) if there are any scrollba
rs present. |
| 47 // Clipping will exclude the right and bottom edges of this frame. | 47 // Clipping will exclude the right and bottom edges of this frame. |
| 48 if (!getScrollableArea().hasOverlayScrollbars() && getScrollableArea().hasSc
rollbar()) { | 48 if (!getScrollableArea().hasOverlayScrollbars() && getScrollableArea().hasSc
rollbar()) { |
| 49 GraphicsContextStateSaver stateSaver(context); | 49 GraphicsContextStateSaver stateSaver(context); |
| 50 context.clip(absRect); | 50 context.clip(absRect); |
| 51 IntRect largerCorner = absRect; | 51 IntRect largerCorner = absRect; |
| 52 largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.heig
ht() + 1)); | 52 largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.heig
ht() + 1)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (paintingOverlayControls && !getScrollableArea().hasOverlayScrollbars()) | 126 if (paintingOverlayControls && !getScrollableArea().hasOverlayScrollbars()) |
| 127 return; | 127 return; |
| 128 | 128 |
| 129 { | 129 { |
| 130 Optional<ScopedPaintChunkProperties> scopedTransformProperty; | 130 Optional<ScopedPaintChunkProperties> scopedTransformProperty; |
| 131 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 131 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 132 const auto* objectProperties = getScrollableArea().box().objectPaint
Properties(); | 132 const auto* objectProperties = getScrollableArea().box().objectPaint
Properties(); |
| 133 if (objectProperties && objectProperties->scrollbarPaintOffset()) { | 133 if (objectProperties && objectProperties->scrollbarPaintOffset()) { |
| 134 PaintChunkProperties properties(context.getPaintController().cur
rentPaintChunkProperties()); | 134 PaintChunkProperties properties(context.getPaintController().cur
rentPaintChunkProperties()); |
| 135 properties.transform = objectProperties->scrollbarPaintOffset(); | 135 properties.transform = objectProperties->scrollbarPaintOffset(); |
| 136 scopedTransformProperty.emplace(context.getPaintController(), ge
tScrollableArea().box(), DisplayItem::ScrollOverflowControls, properties); | 136 scopedTransformProperty.emplace(context.getPaintController(), ge
tScrollableArea().box(), DisplayItem::kScrollOverflowControls, properties); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 if (getScrollableArea().horizontalScrollbar() && !getScrollableArea().la
yerForHorizontalScrollbar()) { | 139 if (getScrollableArea().horizontalScrollbar() && !getScrollableArea().la
yerForHorizontalScrollbar()) { |
| 140 TransformRecorder translateRecorder(context, *getScrollableArea().ho
rizontalScrollbar(), AffineTransform::translation(adjustedPaintOffset.x(), adjus
tedPaintOffset.y())); | 140 TransformRecorder translateRecorder(context, *getScrollableArea().ho
rizontalScrollbar(), AffineTransform::translation(adjustedPaintOffset.x(), adjus
tedPaintOffset.y())); |
| 141 getScrollableArea().horizontalScrollbar()->paint(context, adjustedCu
llRect); | 141 getScrollableArea().horizontalScrollbar()->paint(context, adjustedCu
llRect); |
| 142 } | 142 } |
| 143 if (getScrollableArea().verticalScrollbar() && !getScrollableArea().laye
rForVerticalScrollbar()) { | 143 if (getScrollableArea().verticalScrollbar() && !getScrollableArea().laye
rForVerticalScrollbar()) { |
| 144 TransformRecorder translateRecorder(context, *getScrollableArea().ve
rticalScrollbar(), AffineTransform::translation(adjustedPaintOffset.x(), adjuste
dPaintOffset.y())); | 144 TransformRecorder translateRecorder(context, *getScrollableArea().ve
rticalScrollbar(), AffineTransform::translation(adjustedPaintOffset.x(), adjuste
dPaintOffset.y())); |
| 145 getScrollableArea().verticalScrollbar()->paint(context, adjustedCull
Rect); | 145 getScrollableArea().verticalScrollbar()->paint(context, adjustedCull
Rect); |
| 146 } | 146 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return; | 188 return; |
| 189 ScrollbarPainter::paintIntoRect(*getScrollableArea().scrollCorner(), con
text, paintOffset, LayoutRect(absRect)); | 189 ScrollbarPainter::paintIntoRect(*getScrollableArea().scrollCorner(), con
text, paintOffset, LayoutRect(absRect)); |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 | 192 |
| 193 // We don't want to paint white if we have overlay scrollbars, since we need | 193 // We don't want to paint white if we have overlay scrollbars, since we need |
| 194 // to see what is behind it. | 194 // to see what is behind it. |
| 195 if (getScrollableArea().hasOverlayScrollbars()) | 195 if (getScrollableArea().hasOverlayScrollbars()) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, getScro
llableArea().box(), DisplayItem::ScrollbarCorner)) | 198 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, getScro
llableArea().box(), DisplayItem::kScrollbarCorner)) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), Dis
playItem::ScrollbarCorner, absRect); | 201 LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), Dis
playItem::kScrollbarCorner, absRect); |
| 202 context.fillRect(absRect, Color::white); | 202 context.fillRect(absRect, Color::white); |
| 203 } | 203 } |
| 204 | 204 |
| 205 PaintLayerScrollableArea& ScrollableAreaPainter::getScrollableArea() const | 205 PaintLayerScrollableArea& ScrollableAreaPainter::getScrollableArea() const |
| 206 { | 206 { |
| 207 return *m_scrollableArea; | 207 return *m_scrollableArea; |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |