| 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->IsStickyPositioned()) { | 77 if (maybe_sticky_ancestor->Style()->HasStickyConstrainedPosition()) { |
| 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()) |
| 253 frame_view->RemoveViewportConstrainedObject(*this); | 254 frame_view->RemoveViewportConstrainedObject(*this); |
| 254 } | 255 } |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 | 258 |
| 258 LayoutObject::WillBeDestroyed(); | 259 LayoutObject::WillBeDestroyed(); |
| 259 | 260 |
| 260 DestroyLayer(); | 261 DestroyLayer(); |
| 261 } | 262 } |
| 262 | 263 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 body_layout->SetShouldDoFullPaintInvalidation(); | 427 body_layout->SetShouldDoFullPaintInvalidation(); |
| 427 } | 428 } |
| 428 } | 429 } |
| 429 } | 430 } |
| 430 | 431 |
| 431 if (FrameView* frame_view = View()->GetFrameView()) { | 432 if (FrameView* frame_view = View()->GetFrameView()) { |
| 432 bool new_style_is_viewport_constained = | 433 bool new_style_is_viewport_constained = |
| 433 Style()->GetPosition() == EPosition::kFixed; | 434 Style()->GetPosition() == EPosition::kFixed; |
| 434 bool old_style_is_viewport_constrained = | 435 bool old_style_is_viewport_constrained = |
| 435 old_style && old_style->GetPosition() == EPosition::kFixed; | 436 old_style && old_style->GetPosition() == EPosition::kFixed; |
| 436 bool new_style_is_sticky = Style()->GetPosition() == EPosition::kSticky; | 437 bool new_style_is_sticky = Style()->HasStickyConstrainedPosition(); |
| 437 bool old_style_is_sticky = | 438 bool old_style_is_sticky = |
| 438 old_style && old_style->GetPosition() == EPosition::kSticky; | 439 old_style && old_style->HasStickyConstrainedPosition(); |
| 439 | 440 |
| 440 if (new_style_is_sticky != old_style_is_sticky) { | 441 if (new_style_is_sticky != old_style_is_sticky) { |
| 441 if (new_style_is_sticky) { | 442 if (new_style_is_sticky) { |
| 442 // During compositing inputs update we'll have the scroll ancestor | 443 // During compositing inputs update we'll have the scroll ancestor |
| 443 // without having to walk up the tree and can compute the sticky | 444 // without having to walk up the tree and can compute the sticky |
| 444 // position constraints then. | 445 // position constraints then. |
| 445 if (Layer()) | 446 if (Layer()) |
| 446 Layer()->SetNeedsCompositingInputsUpdate(); | 447 Layer()->SetNeedsCompositingInputsUpdate(); |
| 447 | 448 |
| 448 // TODO(pdr): When slimming paint v2 is enabled, we will need to | 449 // 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... |
| 1054 constraints.AddAnchorEdge( | 1055 constraints.AddAnchorEdge( |
| 1055 StickyPositionScrollingConstraints::kAnchorEdgeTop); | 1056 StickyPositionScrollingConstraints::kAnchorEdgeTop); |
| 1056 } | 1057 } |
| 1057 | 1058 |
| 1058 if (!Style()->Bottom().IsAuto() && !skip_bottom) { | 1059 if (!Style()->Bottom().IsAuto() && !skip_bottom) { |
| 1059 constraints.SetBottomOffset(MinimumValueForLength( | 1060 constraints.SetBottomOffset(MinimumValueForLength( |
| 1060 Style()->Bottom(), LayoutUnit(constraining_size.Height()))); | 1061 Style()->Bottom(), LayoutUnit(constraining_size.Height()))); |
| 1061 constraints.AddAnchorEdge( | 1062 constraints.AddAnchorEdge( |
| 1062 StickyPositionScrollingConstraints::kAnchorEdgeBottom); | 1063 StickyPositionScrollingConstraints::kAnchorEdgeBottom); |
| 1063 } | 1064 } |
| 1065 // At least one edge should be anchored if we are calculating constraints. |
| 1066 DCHECK(constraints.GetAnchorEdges()); |
| 1064 scrollable_area->GetStickyConstraintsMap().Set(Layer(), constraints); | 1067 scrollable_area->GetStickyConstraintsMap().Set(Layer(), constraints); |
| 1065 } | 1068 } |
| 1066 | 1069 |
| 1067 FloatRect LayoutBoxModelObject::ComputeStickyConstrainingRect() const { | 1070 FloatRect LayoutBoxModelObject::ComputeStickyConstrainingRect() const { |
| 1068 if (Layer()->AncestorOverflowLayer()->IsRootLayer()) | 1071 if (Layer()->AncestorOverflowLayer()->IsRootLayer()) |
| 1069 return View()->GetFrameView()->VisibleContentRect(); | 1072 return View()->GetFrameView()->VisibleContentRect(); |
| 1070 | 1073 |
| 1071 LayoutBox* enclosing_clipping_box = | 1074 LayoutBox* enclosing_clipping_box = |
| 1072 Layer()->AncestorOverflowLayer()->GetLayoutBox(); | 1075 Layer()->AncestorOverflowLayer()->GetLayoutBox(); |
| 1073 DCHECK(enclosing_clipping_box); | 1076 DCHECK(enclosing_clipping_box); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 if (root_element_style->HasBackground()) | 1482 if (root_element_style->HasBackground()) |
| 1480 return false; | 1483 return false; |
| 1481 | 1484 |
| 1482 if (GetNode() != GetDocument().FirstBodyElement()) | 1485 if (GetNode() != GetDocument().FirstBodyElement()) |
| 1483 return false; | 1486 return false; |
| 1484 | 1487 |
| 1485 return true; | 1488 return true; |
| 1486 } | 1489 } |
| 1487 | 1490 |
| 1488 } // namespace blink | 1491 } // namespace blink |
| OLD | NEW |