Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h

Issue 2088323003: Don't invalidate width for children unless scrollbars have changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Try to make test platform independent Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // If a PreventRelayoutScope object is alive, updateAfterLayout() will not 169 // If a PreventRelayoutScope object is alive, updateAfterLayout() will not
170 // re-run box layout as a result of adding or removing scrollbars. 170 // re-run box layout as a result of adding or removing scrollbars.
171 class PreventRelayoutScope { 171 class PreventRelayoutScope {
172 STACK_ALLOCATED(); 172 STACK_ALLOCATED();
173 public: 173 public:
174 PreventRelayoutScope(SubtreeLayoutScope&); 174 PreventRelayoutScope(SubtreeLayoutScope&);
175 ~PreventRelayoutScope(); 175 ~PreventRelayoutScope();
176 176
177 static bool relayoutIsPrevented() { return s_count; } 177 static bool relayoutIsPrevented() { return s_count; }
178 static void setNeedsLayout(LayoutObject&); 178 static void setBoxNeedsLayout(PaintLayerScrollableArea&, bool hadHorizon talScrollbar, bool hadVerticalScrollbar);
skobes 2016/06/23 18:19:18 This API is super confusing, if the box needs layo
szager1 2016/06/23 19:05:31 There are two things going on here: - Does the bo
179 static bool relayoutNeeded() { return s_count == 0 && s_relayoutNeeded; } 179 static bool relayoutNeeded() { return s_count == 0 && s_relayoutNeeded; }
180 static void resetRelayoutNeeded(); 180 static void resetRelayoutNeeded();
181 181
182 private: 182 private:
183 static int s_count; 183 static int s_count;
184 static SubtreeLayoutScope* s_layoutScope; 184 static SubtreeLayoutScope* s_layoutScope;
185 static bool s_relayoutNeeded; 185 static bool s_relayoutNeeded;
186 static WTF::Vector<LayoutObject*>* s_needsRelayout; 186 static PersistentHeapVector<Member<PaintLayerScrollableArea>>* s_needsRe layout;
187 }; 187 };
188 188
189 // If a FreezeScrollbarScope object is alive, updateAfterLayout() will not 189 // If a FreezeScrollbarScope object is alive, updateAfterLayout() will not
190 // recompute the existence of overflow:auto scrollbars. 190 // recompute the existence of overflow:auto scrollbars.
191 class FreezeScrollbarsScope { 191 class FreezeScrollbarsScope {
192 STACK_ALLOCATED(); 192 STACK_ALLOCATED();
193 public: 193 public:
194 FreezeScrollbarsScope() { s_count++; } 194 FreezeScrollbarsScope() { s_count++; }
195 ~FreezeScrollbarsScope() { s_count--; } 195 ~FreezeScrollbarsScope() { s_count--; }
196 196
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 Widget* getWidget() override; 403 Widget* getWidget() override;
404 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } 404 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; }
405 bool isPaintLayerScrollableArea() const override { return true; } 405 bool isPaintLayerScrollableArea() const override { return true; }
406 406
407 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon talScrollbarLayer; } 407 bool shouldRebuildHorizontalScrollbarLayer() const { return m_rebuildHorizon talScrollbarLayer; }
408 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS crollbarLayer; } 408 bool shouldRebuildVerticalScrollbarLayer() const { return m_rebuildVerticalS crollbarLayer; }
409 void resetRebuildScrollbarLayerFlags(); 409 void resetRebuildScrollbarLayerFlags();
410 410
411 bool needsScrollPositionClamp() const { return m_needsScrollPositionClamp; } 411 bool needsScrollPositionClamp() const { return m_needsScrollPositionClamp; }
412 void setNeedsScrollPositionClamp(bool val) { m_needsScrollPositionClamp = va l; } 412 void setNeedsScrollPositionClamp(bool val) { m_needsScrollPositionClamp = va l; }
413 bool needsRelayout() const { return m_needsRelayout; }
414 void setNeedsRelayout(bool val) { m_needsRelayout = val; }
415 bool hadHorizontalScrollbarBeforeRelayout() const { return m_hadHorizontalSc rollbarBeforeRelayout; }
skobes 2016/06/23 18:19:18 Do these need to be public? Add comments please.
szager1 2016/06/23 19:05:31 I could use a friend declaration to give PreventRe
416 void setHadHorizontalScrollbarBeforeRelayout(bool val) { m_hadHorizontalScro llbarBeforeRelayout = val; }
417 bool hadVerticalScrollbarBeforeRelayout() const { return m_hadVerticalScroll barBeforeRelayout; }
418 void setHadVerticalScrollbarBeforeRelayout(bool val) { m_hadVerticalScrollba rBeforeRelayout = val; }
413 419
414 StickyConstraintsMap& stickyConstraintsMap() { return ensureRareData().m_sti ckyConstraintsMap; } 420 StickyConstraintsMap& stickyConstraintsMap() { return ensureRareData().m_sti ckyConstraintsMap; }
415 void invalidateAllStickyConstraints(); 421 void invalidateAllStickyConstraints();
416 void invalidateStickyConstraintsFor(PaintLayer*, bool needsCompositingUpdate = true); 422 void invalidateStickyConstraintsFor(PaintLayer*, bool needsCompositingUpdate = true);
417 423
418 DECLARE_VIRTUAL_TRACE(); 424 DECLARE_VIRTUAL_TRACE();
419 425
420 private: 426 private:
421 explicit PaintLayerScrollableArea(PaintLayer&); 427 explicit PaintLayerScrollableArea(PaintLayer&);
422 428
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 if (!m_rareData) 467 if (!m_rareData)
462 m_rareData = wrapUnique(new PaintLayerScrollableAreaRareData()); 468 m_rareData = wrapUnique(new PaintLayerScrollableAreaRareData());
463 return *m_rareData.get(); 469 return *m_rareData.get();
464 } 470 }
465 471
466 // PaintInvalidationCapableScrollableArea 472 // PaintInvalidationCapableScrollableArea
467 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); } 473 LayoutBox& boxForScrollControlPaintInvalidation() const { return box(); }
468 474
469 PaintLayer& m_layer; 475 PaintLayer& m_layer;
470 476
477 PaintLayer* m_nextTopmostScrollChild;
478 PaintLayer* m_topmostScrollChild;
479
471 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop. 480 // Keeps track of whether the layer is currently resizing, so events can cau se resizing to start and stop.
472 unsigned m_inResizeMode : 1; 481 unsigned m_inResizeMode : 1;
473 unsigned m_scrollsOverflow : 1; 482 unsigned m_scrollsOverflow : 1;
474 483
475 unsigned m_inOverflowRelayout : 1; 484 unsigned m_inOverflowRelayout : 1;
476 485
477 PaintLayer* m_nextTopmostScrollChild;
478 PaintLayer* m_topmostScrollChild;
479
480 // FIXME: once cc can handle composited scrolling with clip paths, we will 486 // FIXME: once cc can handle composited scrolling with clip paths, we will
481 // no longer need this bit. 487 // no longer need this bit.
482 unsigned m_needsCompositedScrolling : 1; 488 unsigned m_needsCompositedScrolling : 1;
483 489
484 // Set to indicate that a scrollbar layer, if present, needs to be rebuilt 490 // Set to indicate that a scrollbar layer, if present, needs to be rebuilt
485 // in the next compositing update because the underlying blink::Scrollbar 491 // in the next compositing update because the underlying blink::Scrollbar
486 // instance has been reconstructed. 492 // instance has been reconstructed.
487 unsigned m_rebuildHorizontalScrollbarLayer : 1; 493 unsigned m_rebuildHorizontalScrollbarLayer : 1;
488 unsigned m_rebuildVerticalScrollbarLayer : 1; 494 unsigned m_rebuildVerticalScrollbarLayer : 1;
489 495
490 unsigned m_needsScrollPositionClamp : 1; 496 unsigned m_needsScrollPositionClamp : 1;
497 unsigned m_needsRelayout : 1;
skobes 2016/06/23 18:19:18 Please add comments explaining what this means. H
szager1 2016/06/23 19:05:31 I added comments to the getters/setters.
498 unsigned m_hadHorizontalScrollbarBeforeRelayout : 1;
499 unsigned m_hadVerticalScrollbarBeforeRelayout : 1;
491 500
492 // The width/height of our scrolled area. 501 // The width/height of our scrolled area.
493 // This is OverflowModel's layout overflow translated to physical 502 // This is OverflowModel's layout overflow translated to physical
494 // coordinates. See OverflowModel for the different overflow and 503 // coordinates. See OverflowModel for the different overflow and
495 // LayoutBoxModelObject for the coordinate systems. 504 // LayoutBoxModelObject for the coordinate systems.
496 LayoutRect m_overflowRect; 505 LayoutRect m_overflowRect;
497 506
498 // ScrollbarManager holds the Scrollbar instances. 507 // ScrollbarManager holds the Scrollbar instances.
499 ScrollbarManager m_scrollbarManager; 508 ScrollbarManager m_scrollbarManager;
500 509
(...skipping 17 matching lines...) Expand all
518 #endif 527 #endif
519 }; 528 };
520 529
521 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea, 530 DEFINE_TYPE_CASTS(PaintLayerScrollableArea, ScrollableArea, scrollableArea,
522 scrollableArea->isPaintLayerScrollableArea(), 531 scrollableArea->isPaintLayerScrollableArea(),
523 scrollableArea.isPaintLayerScrollableArea()); 532 scrollableArea.isPaintLayerScrollableArea());
524 533
525 } // namespace blink 534 } // namespace blink
526 535
527 #endif // LayerScrollableArea_h 536 #endif // LayerScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698