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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2825343003: Clean compositing inputs for location APIs for sticky-affected elements. (Closed)
Patch Set: Created 3 years, 8 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return; 139 return;
140 140
141 Layer()->ContentChanged(change_type); 141 Layer()->ContentChanged(change_type);
142 } 142 }
143 143
144 bool LayoutBoxModelObject::HasAcceleratedCompositing() const { 144 bool LayoutBoxModelObject::HasAcceleratedCompositing() const {
145 return View()->Compositor()->HasAcceleratedCompositing(); 145 return View()->Compositor()->HasAcceleratedCompositing();
146 } 146 }
147 147
148 LayoutBoxModelObject::LayoutBoxModelObject(ContainerNode* node) 148 LayoutBoxModelObject::LayoutBoxModelObject(ContainerNode* node)
149 : LayoutObject(node) {} 149 : LayoutObject(node), is_in_sticky_subtree_(false) {}
150 150
151 bool LayoutBoxModelObject::UsesCompositedScrolling() const { 151 bool LayoutBoxModelObject::UsesCompositedScrolling() const {
152 return HasOverflowClip() && HasLayer() && 152 return HasOverflowClip() && HasLayer() &&
153 Layer()->GetScrollableArea()->UsesCompositedScrolling(); 153 Layer()->GetScrollableArea()->UsesCompositedScrolling();
154 } 154 }
155 155
156 BackgroundPaintLocation LayoutBoxModelObject::GetBackgroundPaintLocation( 156 BackgroundPaintLocation LayoutBoxModelObject::GetBackgroundPaintLocation(
157 uint32_t* reasons) const { 157 uint32_t* reasons) const {
158 bool has_custom_scrollbars = false; 158 bool has_custom_scrollbars = false;
159 // TODO(flackr): Detect opaque custom scrollbars which would cover up a 159 // TODO(flackr): Detect opaque custom scrollbars which would cover up a
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // scroll reasons are recomputed. 470 // scroll reasons are recomputed.
471 } 471 }
472 } 472 }
473 473
474 if (new_style_is_viewport_constained != old_style_is_viewport_constrained) { 474 if (new_style_is_viewport_constained != old_style_is_viewport_constrained) {
475 if (new_style_is_viewport_constained && Layer()) 475 if (new_style_is_viewport_constained && Layer())
476 frame_view->AddViewportConstrainedObject(*this); 476 frame_view->AddViewportConstrainedObject(*this);
477 else 477 else
478 frame_view->RemoveViewportConstrainedObject(*this); 478 frame_view->RemoveViewportConstrainedObject(*this);
479 } 479 }
480
481 is_in_sticky_subtree_ =
482 new_style_is_sticky ||
483 (Parent() && Parent()->EnclosingBoxModelObject() &&
chrishtr 2017/04/20 17:40:34 Shouldn't this use the containing block chain, not
smcgruer 2017/04/26 14:37:07 No longer relevant; see new PS.
484 Parent()->EnclosingBoxModelObject()->IsInStickySubtree());
480 } 485 }
481 } 486 }
482 487
483 void LayoutBoxModelObject::InvalidateStickyConstraints() { 488 void LayoutBoxModelObject::InvalidateStickyConstraints() {
484 PaintLayer* enclosing = EnclosingLayer(); 489 PaintLayer* enclosing = EnclosingLayer();
485 490
486 if (PaintLayerScrollableArea* scrollable_area = 491 if (PaintLayerScrollableArea* scrollable_area =
487 enclosing->GetScrollableArea()) { 492 enclosing->GetScrollableArea()) {
488 scrollable_area->InvalidateAllStickyConstraints(); 493 scrollable_area->InvalidateAllStickyConstraints();
489 // If this object doesn't have a layer and its enclosing layer is a scroller 494 // If this object doesn't have a layer and its enclosing layer is a scroller
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 if (root_element_style->HasBackground()) 1486 if (root_element_style->HasBackground())
1482 return false; 1487 return false;
1483 1488
1484 if (GetNode() != GetDocument().FirstBodyElement()) 1489 if (GetNode() != GetDocument().FirstBodyElement())
1485 return false; 1490 return false;
1486 1491
1487 return true; 1492 return true;
1488 } 1493 }
1489 1494
1490 } // namespace blink 1495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698