Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/scroll/ScrollableArea.h" | 6 #include "platform/scroll/ScrollableArea.h" |
| 7 | 7 |
| 8 #include "platform/graphics/GraphicsLayer.h" | 8 #include "platform/graphics/GraphicsLayer.h" |
| 9 #include "platform/scroll/ScrollbarTheme.h" | 9 #include "platform/scroll/ScrollbarTheme.h" |
| 10 #include "platform/scroll/ScrollbarThemeMock.h" | 10 #include "platform/scroll/ScrollbarThemeMock.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); | 169 EXPECT_TRUE(scrollbar->thumbNeedsRepaint()); |
| 170 | 170 |
| 171 EXPECT_CALL(theme, shouldRepaintAllPartsOnInvalidation()).WillRepeatedly(Ret urn(false)); | 171 EXPECT_CALL(theme, shouldRepaintAllPartsOnInvalidation()).WillRepeatedly(Ret urn(false)); |
| 172 scrollbar->setTrackNeedsRepaint(false); | 172 scrollbar->setTrackNeedsRepaint(false); |
| 173 scrollbar->setThumbNeedsRepaint(false); | 173 scrollbar->setThumbNeedsRepaint(false); |
| 174 EXPECT_FALSE(scrollbar->trackNeedsRepaint()); | 174 EXPECT_FALSE(scrollbar->trackNeedsRepaint()); |
| 175 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); | 175 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); |
| 176 scrollbar->setNeedsPaintInvalidation(); | 176 scrollbar->setNeedsPaintInvalidation(); |
| 177 EXPECT_FALSE(scrollbar->trackNeedsRepaint()); | 177 EXPECT_FALSE(scrollbar->trackNeedsRepaint()); |
| 178 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); | 178 EXPECT_FALSE(scrollbar->thumbNeedsRepaint()); |
| 179 | |
| 180 // Forced GC in order to finalize objects depending on the mock object. | |
| 181 Heap::collectAllGarbage(); | |
|
jbroman
2015/12/16 12:18:12
The object in question still has a RawPtr<Scrollba
sof
2015/12/16 12:20:38
The GCs performed by this are precise (non-conserv
| |
| 179 } | 182 } |
| 180 | 183 |
| 181 class MockGraphicsLayerClient : public GraphicsLayerClient { | 184 class MockGraphicsLayerClient : public GraphicsLayerClient { |
| 182 public: | 185 public: |
| 183 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const { re turn IntRect(); } | 186 IntRect computeInterestRect(const GraphicsLayer*, const IntRect&) const { re turn IntRect(); } |
| 184 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect&) const override { } | 187 void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPain tingPhase, const IntRect&) const override { } |
| 185 String debugName(const GraphicsLayer*) const override { return String(); } | 188 String debugName(const GraphicsLayer*) const override { return String(); } |
| 186 bool isTrackingPaintInvalidations() const override { return true; } | 189 bool isTrackingPaintInvalidations() const override { return true; } |
| 187 }; | 190 }; |
| 188 | 191 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 202 | 205 |
| 203 EXPECT_CALL(*scrollableArea, layerForHorizontalScrollbar()).WillRepeatedly(R eturn(&graphicsLayer)); | 206 EXPECT_CALL(*scrollableArea, layerForHorizontalScrollbar()).WillRepeatedly(R eturn(&graphicsLayer)); |
| 204 | 207 |
| 205 RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.g et(), HorizontalScrollbar, RegularScrollbar); | 208 RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.g et(), HorizontalScrollbar, RegularScrollbar); |
| 206 graphicsLayer.resetTrackedPaintInvalidations(); | 209 graphicsLayer.resetTrackedPaintInvalidations(); |
| 207 scrollbar->setNeedsPaintInvalidation(); | 210 scrollbar->setNeedsPaintInvalidation(); |
| 208 EXPECT_TRUE(graphicsLayer.hasTrackedPaintInvalidations()); | 211 EXPECT_TRUE(graphicsLayer.hasTrackedPaintInvalidations()); |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |