OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return nullptr; | 67 return nullptr; |
68 | 68 |
69 return &it->value; | 69 return &it->value; |
70 } | 70 } |
71 | 71 |
72 // Inclusive of |from|, exclusive of |to|. | 72 // Inclusive of |from|, exclusive of |to|. |
73 LayoutBoxModelObject* FindFirstStickyBetween(LayoutObject* from, | 73 LayoutBoxModelObject* FindFirstStickyBetween(LayoutObject* from, |
74 LayoutObject* to) { | 74 LayoutObject* to) { |
75 LayoutObject* maybe_sticky_ancestor = from; | 75 LayoutObject* maybe_sticky_ancestor = from; |
76 while (maybe_sticky_ancestor && maybe_sticky_ancestor != to) { | 76 while (maybe_sticky_ancestor && maybe_sticky_ancestor != to) { |
77 if (maybe_sticky_ancestor->Style()->HasStickyConstrainedPosition()) { | 77 if (maybe_sticky_ancestor->IsStickyPositioned()) { |
78 return ToLayoutBoxModelObject(maybe_sticky_ancestor); | 78 return ToLayoutBoxModelObject(maybe_sticky_ancestor); |
79 } | 79 } |
80 | 80 |
81 maybe_sticky_ancestor = | 81 maybe_sticky_ancestor = |
82 maybe_sticky_ancestor->IsLayoutInline() | 82 maybe_sticky_ancestor->IsLayoutInline() |
83 ? maybe_sticky_ancestor->Container() | 83 ? maybe_sticky_ancestor->Container() |
84 : ToLayoutBox(maybe_sticky_ancestor)->LocationContainer(); | 84 : ToLayoutBox(maybe_sticky_ancestor)->LocationContainer(); |
85 } | 85 } |
86 return nullptr; | 86 return nullptr; |
87 } | 87 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 ImageQualityController::Remove(*this); | 242 ImageQualityController::Remove(*this); |
243 | 243 |
244 // A continuation of this LayoutObject should be destroyed at subclasses. | 244 // A continuation of this LayoutObject should be destroyed at subclasses. |
245 DCHECK(!Continuation()); | 245 DCHECK(!Continuation()); |
246 | 246 |
247 if (IsPositioned()) { | 247 if (IsPositioned()) { |
248 // Don't use this->view() because the document's layoutView has been set to | 248 // Don't use this->view() because the document's layoutView has been set to |
249 // 0 during destruction. | 249 // 0 during destruction. |
250 if (LocalFrame* frame = this->GetFrame()) { | 250 if (LocalFrame* frame = this->GetFrame()) { |
251 if (FrameView* frame_view = frame->View()) { | 251 if (FrameView* frame_view = frame->View()) { |
252 if (Style()->HasViewportConstrainedPosition() || | 252 if (Style()->HasViewportConstrainedPosition()) |
253 Style()->HasStickyConstrainedPosition()) | |
254 frame_view->RemoveViewportConstrainedObject(*this); | 253 frame_view->RemoveViewportConstrainedObject(*this); |
255 } | 254 } |
256 } | 255 } |
257 } | 256 } |
258 | 257 |
259 LayoutObject::WillBeDestroyed(); | 258 LayoutObject::WillBeDestroyed(); |
260 | 259 |
261 DestroyLayer(); | 260 DestroyLayer(); |
262 } | 261 } |
263 | 262 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 body_layout->SetShouldDoFullPaintInvalidation(); | 426 body_layout->SetShouldDoFullPaintInvalidation(); |
428 } | 427 } |
429 } | 428 } |
430 } | 429 } |
431 | 430 |
432 if (FrameView* frame_view = View()->GetFrameView()) { | 431 if (FrameView* frame_view = View()->GetFrameView()) { |
433 bool new_style_is_viewport_constained = | 432 bool new_style_is_viewport_constained = |
434 Style()->GetPosition() == EPosition::kFixed; | 433 Style()->GetPosition() == EPosition::kFixed; |
435 bool old_style_is_viewport_constrained = | 434 bool old_style_is_viewport_constrained = |
436 old_style && old_style->GetPosition() == EPosition::kFixed; | 435 old_style && old_style->GetPosition() == EPosition::kFixed; |
437 bool new_style_is_sticky = Style()->HasStickyConstrainedPosition(); | 436 bool new_style_is_sticky = Style()->GetPosition() == EPosition::kSticky; |
438 bool old_style_is_sticky = | 437 bool old_style_is_sticky = |
439 old_style && old_style->HasStickyConstrainedPosition(); | 438 old_style && old_style->GetPosition() == EPosition::kSticky; |
440 | 439 |
441 if (new_style_is_sticky != old_style_is_sticky) { | 440 if (new_style_is_sticky != old_style_is_sticky) { |
442 if (new_style_is_sticky) { | 441 if (new_style_is_sticky) { |
443 // During compositing inputs update we'll have the scroll ancestor | 442 // During compositing inputs update we'll have the scroll ancestor |
444 // without having to walk up the tree and can compute the sticky | 443 // without having to walk up the tree and can compute the sticky |
445 // position constraints then. | 444 // position constraints then. |
446 if (Layer()) | 445 if (Layer()) |
447 Layer()->SetNeedsCompositingInputsUpdate(); | 446 Layer()->SetNeedsCompositingInputsUpdate(); |
448 | 447 |
449 // TODO(pdr): When slimming paint v2 is enabled, we will need to | 448 // TODO(pdr): When slimming paint v2 is enabled, we will need to |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 constraints.AddAnchorEdge( | 1054 constraints.AddAnchorEdge( |
1056 StickyPositionScrollingConstraints::kAnchorEdgeTop); | 1055 StickyPositionScrollingConstraints::kAnchorEdgeTop); |
1057 } | 1056 } |
1058 | 1057 |
1059 if (!Style()->Bottom().IsAuto() && !skip_bottom) { | 1058 if (!Style()->Bottom().IsAuto() && !skip_bottom) { |
1060 constraints.SetBottomOffset(MinimumValueForLength( | 1059 constraints.SetBottomOffset(MinimumValueForLength( |
1061 Style()->Bottom(), LayoutUnit(constraining_size.Height()))); | 1060 Style()->Bottom(), LayoutUnit(constraining_size.Height()))); |
1062 constraints.AddAnchorEdge( | 1061 constraints.AddAnchorEdge( |
1063 StickyPositionScrollingConstraints::kAnchorEdgeBottom); | 1062 StickyPositionScrollingConstraints::kAnchorEdgeBottom); |
1064 } | 1063 } |
1065 // At least one edge should be anchored if we are calculating constraints. | |
1066 DCHECK(constraints.GetAnchorEdges()); | |
1067 scrollable_area->GetStickyConstraintsMap().Set(Layer(), constraints); | 1064 scrollable_area->GetStickyConstraintsMap().Set(Layer(), constraints); |
1068 } | 1065 } |
1069 | 1066 |
1070 FloatRect LayoutBoxModelObject::ComputeStickyConstrainingRect() const { | 1067 FloatRect LayoutBoxModelObject::ComputeStickyConstrainingRect() const { |
1071 if (Layer()->AncestorOverflowLayer()->IsRootLayer()) | 1068 if (Layer()->AncestorOverflowLayer()->IsRootLayer()) |
1072 return View()->GetFrameView()->VisibleContentRect(); | 1069 return View()->GetFrameView()->VisibleContentRect(); |
1073 | 1070 |
1074 LayoutBox* enclosing_clipping_box = | 1071 LayoutBox* enclosing_clipping_box = |
1075 Layer()->AncestorOverflowLayer()->GetLayoutBox(); | 1072 Layer()->AncestorOverflowLayer()->GetLayoutBox(); |
1076 DCHECK(enclosing_clipping_box); | 1073 DCHECK(enclosing_clipping_box); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 if (root_element_style->HasBackground()) | 1479 if (root_element_style->HasBackground()) |
1483 return false; | 1480 return false; |
1484 | 1481 |
1485 if (GetNode() != GetDocument().FirstBodyElement()) | 1482 if (GetNode() != GetDocument().FirstBodyElement()) |
1486 return false; | 1483 return false; |
1487 | 1484 |
1488 return true; | 1485 return true; |
1489 } | 1486 } |
1490 | 1487 |
1491 } // namespace blink | 1488 } // namespace blink |
OLD | NEW |