Chromium Code Reviews| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 | 312 |
| 313 if (containingBlock->hasOverflowClip()) { | 313 if (containingBlock->hasOverflowClip()) { |
| 314 IntSize scrollOffset = containingBlock->layer()->scrollableArea()->adjus tedScrollOffset(); | 314 IntSize scrollOffset = containingBlock->layer()->scrollableArea()->adjus tedScrollOffset(); |
| 315 stickyLocation -= scrollOffset; | 315 stickyLocation -= scrollOffset; |
| 316 } | 316 } |
| 317 | 317 |
| 318 // We can't call localToAbsolute on |this| because that will recur. FIXME: F or now, assume that |this| is not transformed. | 318 // We can't call localToAbsolute on |this| because that will recur. FIXME: F or now, assume that |this| is not transformed. |
| 319 FloatRect absoluteStickyBoxRect(absContainerFrame.location() + stickyLocatio n, flippedStickyBoxRect.size()); | 319 FloatRect absoluteStickyBoxRect(absContainerFrame.location() + stickyLocatio n, flippedStickyBoxRect.size()); |
| 320 constraints.setAbsoluteStickyBoxRect(absoluteStickyBoxRect); | 320 constraints.setAbsoluteStickyBoxRect(absoluteStickyBoxRect); |
| 321 | 321 |
| 322 if (!style()->left().isAuto()) { | 322 float horizontalOffsets = constraints.rightOffset() + constraints.leftOffset (); |
| 323 bool skipRight = false; | |
| 324 bool skipLeft = false; | |
| 325 if (!style()->left().isAuto() && !style()->right().isAuto()) { | |
| 326 if (horizontalOffsets > containerContentRect.width().toFloat() | |
| 327 || horizontalOffsets + containerContentRect.width().toFloat() > cons trainingRect.width()) { | |
|
Julien - ping for review
2014/05/22 15:49:02
[It's better to use a generated 'reply' comment, t
| |
| 328 skipRight = style()->isLeftToRightDirection(); | |
| 329 skipLeft = !skipRight; | |
| 330 } | |
| 331 } | |
| 332 | |
| 333 if (!style()->left().isAuto() && !skipLeft) { | |
| 323 constraints.setLeftOffset(floatValueForLength(style()->left(), constrain ingRect.width())); | 334 constraints.setLeftOffset(floatValueForLength(style()->left(), constrain ingRect.width())); |
| 324 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft); | 335 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft); |
| 325 } | 336 } |
| 326 | 337 |
| 327 if (!style()->right().isAuto()) { | 338 if (!style()->right().isAuto() && !skipRight) { |
| 328 constraints.setRightOffset(floatValueForLength(style()->right(), constra iningRect.width())); | 339 constraints.setRightOffset(floatValueForLength(style()->right(), constra iningRect.width())); |
| 329 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight); | 340 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight); |
| 330 } | 341 } |
| 331 | 342 |
| 343 bool skipBottom = false; | |
|
Julien - ping for review
2014/05/22 15:49:02
Let's add a FIXME about that and ideally a link to
ostap
2014/05/22 23:13:11
Done.
| |
| 344 float verticalOffsets = constraints.topOffset() + constraints.bottomOffset() ; | |
| 345 if (!style()->top().isAuto() && !style()->bottom().isAuto()) { | |
| 346 if (verticalOffsets > containerContentRect.height().toFloat() | |
| 347 || verticalOffsets + containerContentRect.height().toFloat() > const rainingRect.height()) { | |
| 348 skipBottom = true; | |
| 349 } | |
| 350 } | |
| 351 | |
| 332 if (!style()->top().isAuto()) { | 352 if (!style()->top().isAuto()) { |
| 333 constraints.setTopOffset(floatValueForLength(style()->top(), constrainin gRect.height())); | 353 constraints.setTopOffset(floatValueForLength(style()->top(), constrainin gRect.height())); |
| 334 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); | 354 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); |
| 335 } | 355 } |
| 336 | 356 |
| 337 if (!style()->bottom().isAuto()) { | 357 if (!style()->bottom().isAuto() && !skipBottom) { |
| 338 constraints.setBottomOffset(floatValueForLength(style()->bottom(), const rainingRect.height() )); | 358 constraints.setBottomOffset(floatValueForLength(style()->bottom(), const rainingRect.height())); |
| 339 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom); | 359 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom); |
| 340 } | 360 } |
| 341 } | 361 } |
| 342 | 362 |
| 343 LayoutSize RenderBoxModelObject::stickyPositionOffset() const | 363 LayoutSize RenderBoxModelObject::stickyPositionOffset() const |
| 344 { | 364 { |
| 345 FloatRect constrainingRect; | 365 FloatRect constrainingRect; |
| 346 | 366 |
| 347 ASSERT(hasLayer()); | 367 ASSERT(hasLayer()); |
| 348 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf); | 368 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf); |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2824 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2844 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2825 for (RenderObject* child = startChild; child && child != endChild; ) { | 2845 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2826 // Save our next sibling as moveChildTo will clear it. | 2846 // Save our next sibling as moveChildTo will clear it. |
| 2827 RenderObject* nextSibling = child->nextSibling(); | 2847 RenderObject* nextSibling = child->nextSibling(); |
| 2828 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2848 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2829 child = nextSibling; | 2849 child = nextSibling; |
| 2830 } | 2850 } |
| 2831 } | 2851 } |
| 2832 | 2852 |
| 2833 } // namespace WebCore | 2853 } // namespace WebCore |
| OLD | NEW |