| 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* maybeStickyAncestor = from; | 75 LayoutObject* maybeStickyAncestor = from; |
| 76 while (maybeStickyAncestor && maybeStickyAncestor != to) { | 76 while (maybeStickyAncestor && maybeStickyAncestor != to) { |
| 77 if (maybeStickyAncestor->isStickyPositioned()) { | 77 if (maybeStickyAncestor->style()->hasStickyConstrainedPosition()) { |
| 78 return toLayoutBoxModelObject(maybeStickyAncestor); | 78 return toLayoutBoxModelObject(maybeStickyAncestor); |
| 79 } | 79 } |
| 80 | 80 |
| 81 maybeStickyAncestor = | 81 maybeStickyAncestor = |
| 82 maybeStickyAncestor->isLayoutInline() | 82 maybeStickyAncestor->isLayoutInline() |
| 83 ? maybeStickyAncestor->containingBlock() | 83 ? maybeStickyAncestor->containingBlock() |
| 84 : toLayoutBox(maybeStickyAncestor)->locationContainer(); | 84 : toLayoutBox(maybeStickyAncestor)->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 ASSERT(!continuation()); | 245 ASSERT(!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->frame()) { | 250 if (LocalFrame* frame = this->frame()) { |
| 251 if (FrameView* frameView = frame->view()) { | 251 if (FrameView* frameView = frame->view()) { |
| 252 if (style()->hasViewportConstrainedPosition()) | 252 if (style()->hasViewportConstrainedPosition() || |
| 253 style()->hasStickyConstrainedPosition()) |
| 253 frameView->removeViewportConstrainedObject(*this); | 254 frameView->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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 bodyLayout->setShouldDoFullPaintInvalidation(); | 424 bodyLayout->setShouldDoFullPaintInvalidation(); |
| 424 } | 425 } |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 if (FrameView* frameView = view()->frameView()) { | 429 if (FrameView* frameView = view()->frameView()) { |
| 429 bool newStyleIsViewportConstained = | 430 bool newStyleIsViewportConstained = |
| 430 style()->position() == EPosition::kFixed; | 431 style()->position() == EPosition::kFixed; |
| 431 bool oldStyleIsViewportConstrained = | 432 bool oldStyleIsViewportConstrained = |
| 432 oldStyle && oldStyle->position() == EPosition::kFixed; | 433 oldStyle && oldStyle->position() == EPosition::kFixed; |
| 433 bool newStyleIsSticky = style()->position() == EPosition::kSticky; | 434 bool newStyleIsSticky = style()->hasStickyConstrainedPosition(); |
| 434 bool oldStyleIsSticky = | 435 bool oldStyleIsSticky = |
| 435 oldStyle && oldStyle->position() == EPosition::kSticky; | 436 oldStyle && oldStyle->hasStickyConstrainedPosition(); |
| 436 | 437 |
| 437 if (newStyleIsSticky != oldStyleIsSticky) { | 438 if (newStyleIsSticky != oldStyleIsSticky) { |
| 438 if (newStyleIsSticky) { | 439 if (newStyleIsSticky) { |
| 439 // During compositing inputs update we'll have the scroll ancestor | 440 // During compositing inputs update we'll have the scroll ancestor |
| 440 // without having to walk up the tree and can compute the sticky | 441 // without having to walk up the tree and can compute the sticky |
| 441 // position constraints then. | 442 // position constraints then. |
| 442 if (layer()) | 443 if (layer()) |
| 443 layer()->setNeedsCompositingInputsUpdate(); | 444 layer()->setNeedsCompositingInputsUpdate(); |
| 444 | 445 |
| 445 // TODO(pdr): When slimming paint v2 is enabled, we will need to | 446 // TODO(pdr): When slimming paint v2 is enabled, we will need to |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 constraints.addAnchorEdge( | 1047 constraints.addAnchorEdge( |
| 1047 StickyPositionScrollingConstraints::AnchorEdgeTop); | 1048 StickyPositionScrollingConstraints::AnchorEdgeTop); |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 if (!style()->bottom().isAuto() && !skipBottom) { | 1051 if (!style()->bottom().isAuto() && !skipBottom) { |
| 1051 constraints.setBottomOffset(minimumValueForLength( | 1052 constraints.setBottomOffset(minimumValueForLength( |
| 1052 style()->bottom(), LayoutUnit(constrainingSize.height()))); | 1053 style()->bottom(), LayoutUnit(constrainingSize.height()))); |
| 1053 constraints.addAnchorEdge( | 1054 constraints.addAnchorEdge( |
| 1054 StickyPositionScrollingConstraints::AnchorEdgeBottom); | 1055 StickyPositionScrollingConstraints::AnchorEdgeBottom); |
| 1055 } | 1056 } |
| 1057 // At least one edge should be anchored if we are calculating constraints. |
| 1058 DCHECK(constraints.anchorEdges()); |
| 1056 scrollableArea->stickyConstraintsMap().set(layer(), constraints); | 1059 scrollableArea->stickyConstraintsMap().set(layer(), constraints); |
| 1057 } | 1060 } |
| 1058 | 1061 |
| 1059 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const { | 1062 FloatRect LayoutBoxModelObject::computeStickyConstrainingRect() const { |
| 1060 if (layer()->ancestorOverflowLayer()->isRootLayer()) | 1063 if (layer()->ancestorOverflowLayer()->isRootLayer()) |
| 1061 return view()->frameView()->visibleContentRect(); | 1064 return view()->frameView()->visibleContentRect(); |
| 1062 | 1065 |
| 1063 LayoutBox* enclosingClippingBox = | 1066 LayoutBox* enclosingClippingBox = |
| 1064 layer()->ancestorOverflowLayer()->layoutBox(); | 1067 layer()->ancestorOverflowLayer()->layoutBox(); |
| 1065 DCHECK(enclosingClippingBox); | 1068 DCHECK(enclosingClippingBox); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 if (rootElementStyle->hasBackground()) | 1471 if (rootElementStyle->hasBackground()) |
| 1469 return false; | 1472 return false; |
| 1470 | 1473 |
| 1471 if (node() != document().firstBodyElement()) | 1474 if (node() != document().firstBodyElement()) |
| 1472 return false; | 1475 return false; |
| 1473 | 1476 |
| 1474 return true; | 1477 return true; |
| 1475 } | 1478 } |
| 1476 | 1479 |
| 1477 } // namespace blink | 1480 } // namespace blink |
| OLD | NEW |