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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 if (parent() && diff.needsPaintInvalidationLayer()) { | 171 if (parent() && diff.needsPaintInvalidationLayer()) { |
| 172 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() | 172 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() |
| 173 || oldStyle->clip() != newStyle.clip()) | 173 || oldStyle->clip() != newStyle.clip()) |
| 174 layer()->clipper().clearClipRectsIncludingDescendants(); | 174 layer()->clipper().clearClipRectsIncludingDescendants(); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 LayoutObject::styleWillChange(diff, newStyle); | 178 LayoutObject::styleWillChange(diff, newStyle); |
| 179 } | 179 } |
| 180 | 180 |
| 181 static inline LayoutBox* findScrollAncestor(const LayoutObject* startObject) | |
| 182 { | |
| 183 LayoutBox* curBox = startObject->containingBlock(); | |
| 184 | |
| 185 // Scrolling propagates along the containing block chain. | |
| 186 while (curBox && !curBox->isLayoutView()) { | |
|
chrishtr
2015/12/11 02:06:12
Use enclosingLayer()->scrollParent() instead.
flackr
2016/01/19 15:40:48
ancestorScrollingLayer (and scrollParent, which is
| |
| 187 if (curBox->hasOverflowClip()) | |
| 188 return curBox; | |
| 189 curBox = curBox->containingBlock(); | |
| 190 } | |
| 191 | |
| 192 return nullptr; | |
| 193 } | |
| 194 | |
| 181 void LayoutBoxModelObject::styleDidChange(StyleDifference diff, const ComputedSt yle* oldStyle) | 195 void LayoutBoxModelObject::styleDidChange(StyleDifference diff, const ComputedSt yle* oldStyle) |
| 182 { | 196 { |
| 183 bool hadTransform = hasTransformRelatedProperty(); | 197 bool hadTransform = hasTransformRelatedProperty(); |
| 184 bool hadLayer = hasLayer(); | 198 bool hadLayer = hasLayer(); |
| 185 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); | 199 bool layerWasSelfPainting = hadLayer && layer()->isSelfPaintingLayer(); |
| 186 bool wasFloatingBeforeStyleChanged = FloatStateForStyleChange::wasFloating(t his); | 200 bool wasFloatingBeforeStyleChanged = FloatStateForStyleChange::wasFloating(t his); |
| 187 | 201 |
| 188 LayoutObject::styleDidChange(diff, oldStyle); | 202 LayoutObject::styleDidChange(diff, oldStyle); |
| 189 updateFromStyle(); | 203 updateFromStyle(); |
| 190 | 204 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 bool newStoleBodyBackground = toLayoutBoxModelObject(bodyLayout)->ba ckgroundStolenForBeingBody(style()); | 275 bool newStoleBodyBackground = toLayoutBoxModelObject(bodyLayout)->ba ckgroundStolenForBeingBody(style()); |
| 262 bool oldStoleBodyBackground = oldStyle && toLayoutBoxModelObject(bod yLayout)->backgroundStolenForBeingBody(oldStyle); | 276 bool oldStoleBodyBackground = oldStyle && toLayoutBoxModelObject(bod yLayout)->backgroundStolenForBeingBody(oldStyle); |
| 263 if (newStoleBodyBackground != oldStoleBodyBackground | 277 if (newStoleBodyBackground != oldStoleBodyBackground |
| 264 && bodyLayout->style() && bodyLayout->style()->hasBackground()) { | 278 && bodyLayout->style() && bodyLayout->style()->hasBackground()) { |
| 265 bodyLayout->setShouldDoFullPaintInvalidation(); | 279 bodyLayout->setShouldDoFullPaintInvalidation(); |
| 266 } | 280 } |
| 267 } | 281 } |
| 268 } | 282 } |
| 269 | 283 |
| 270 if (FrameView *frameView = view()->frameView()) { | 284 if (FrameView *frameView = view()->frameView()) { |
| 271 bool newStyleIsViewportConstained = style()->hasViewportConstrainedPosit ion(); | 285 bool newStyleIsViewportConstained = style()->position() == FixedPosition ; |
| 272 bool oldStyleIsViewportConstrained = oldStyle && oldStyle->hasViewportCo nstrainedPosition(); | 286 bool oldStyleIsViewportConstrained = oldStyle && oldStyle->position() == FixedPosition; |
| 287 bool newStyleIsSticky = style()->position() == StickyPosition; | |
| 288 bool oldStyleIsSticky = oldStyle && oldStyle->position() == StickyPositi on; | |
| 289 | |
| 290 // Sticky positioned elements are only viewport constrained if they have no ancestor scroller. | |
| 291 if (newStyleIsSticky || oldStyleIsSticky) { | |
| 292 if (!findScrollAncestor(this)) { | |
| 293 newStyleIsViewportConstained |= newStyleIsSticky; | |
| 294 oldStyleIsViewportConstrained |= oldStyleIsSticky; | |
| 295 } | |
| 296 } | |
| 297 | |
| 273 if (newStyleIsViewportConstained != oldStyleIsViewportConstrained) { | 298 if (newStyleIsViewportConstained != oldStyleIsViewportConstrained) { |
| 274 if (newStyleIsViewportConstained && layer()) | 299 if (newStyleIsViewportConstained && layer()) |
| 275 frameView->addViewportConstrainedObject(this); | 300 frameView->addViewportConstrainedObject(this); |
| 276 else | 301 else |
| 277 frameView->removeViewportConstrainedObject(this); | 302 frameView->removeViewportConstrainedObject(this); |
| 278 } | 303 } |
| 304 | |
| 305 if (newStyleIsSticky != oldStyleIsSticky) { | |
| 306 if (newStyleIsSticky) | |
| 307 frameView->addStickyPositionObject(); | |
| 308 else | |
| 309 frameView->removeStickyPositionObject(); | |
| 310 } | |
| 279 } | 311 } |
| 280 } | 312 } |
| 281 | 313 |
| 282 void LayoutBoxModelObject::createLayer(PaintLayerType type) | 314 void LayoutBoxModelObject::createLayer(PaintLayerType type) |
| 283 { | 315 { |
| 284 // If the current paint invalidation container is not a stacking context and this object is | 316 // If the current paint invalidation container is not a stacking context and this object is |
| 285 // a or treated as a stacking context, creating this layer may cause this ob ject and its | 317 // a or treated as a stacking context, creating this layer may cause this ob ject and its |
| 286 // descendants to change paint invalidation container. Therefore we must eag erly invalidate | 318 // descendants to change paint invalidation container. Therefore we must eag erly invalidate |
| 287 // them on the original paint invalidation container before creating the lay er. | 319 // them on the original paint invalidation container before creating the lay er. |
| 288 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && isRooted() && style Ref().isTreatedAsOrStackingContext()) { | 320 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && isRooted() && style Ref().isTreatedAsOrStackingContext()) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 | 633 |
| 602 else if (!style()->bottom().isAuto() | 634 else if (!style()->bottom().isAuto() |
| 603 && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight() | 635 && (!containingBlock->hasAutoHeightOrContainingBlockWithAutoHeight() |
| 604 || !style()->bottom().hasPercent() | 636 || !style()->bottom().hasPercent() |
| 605 || containingBlock->stretchesToViewport())) | 637 || containingBlock->stretchesToViewport())) |
| 606 offset.expand(0, -valueForLength(style()->bottom(), containingBlock->ava ilableHeight())); | 638 offset.expand(0, -valueForLength(style()->bottom(), containingBlock->ava ilableHeight())); |
| 607 | 639 |
| 608 return offset; | 640 return offset; |
| 609 } | 641 } |
| 610 | 642 |
| 643 void LayoutBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo rtConstraints& constraints, const LayoutRect& constrainingRect) const | |
| 644 { | |
| 645 LayoutBlock* containingBlock = this->containingBlock(); | |
| 646 | |
| 647 LayoutRect containerContentRect = containingBlock->contentBoxRect(); | |
| 648 LayoutUnit maxWidth = containingBlock->availableLogicalWidth(); | |
| 649 | |
| 650 // Sticky positioned element ignore any override logical width on the contai ning block (as they don't call | |
| 651 // containingBlockLogicalWidthForContent). It's unclear whether this is tota lly fine. | |
| 652 // Compute the container-relative area within which the sticky element is al lowed to move. | |
| 653 containerContentRect.contractEdges( | |
| 654 minimumValueForLength(style()->marginTop(), maxWidth), | |
| 655 minimumValueForLength(style()->marginRight(), maxWidth), | |
| 656 minimumValueForLength(style()->marginBottom(), maxWidth), | |
| 657 minimumValueForLength(style()->marginLeft(), maxWidth)); | |
| 658 | |
| 659 // Map to the view to avoid including page scale factor. | |
| 660 constraints.setAbsoluteContainingBlockRect(LayoutRect(containingBlock->local ToContainerQuad(FloatRect(containerContentRect), view()).boundingBox())); | |
| 661 | |
| 662 LayoutRect stickyBoxRect = isLayoutInline() | |
| 663 ? LayoutRect(toLayoutInline(this)->linesBoundingBox()) | |
| 664 : toLayoutBox(this)->frameRect(); | |
| 665 LayoutRect flippedStickyBoxRect = stickyBoxRect; | |
| 666 containingBlock->flipForWritingMode(flippedStickyBoxRect); | |
| 667 LayoutPoint stickyLocation = flippedStickyBoxRect.location(); | |
| 668 | |
| 669 // FIXME: sucks to call localToAbsolute again, but we can't just offset from the previously computed rect if there are transforms. | |
| 670 // Map to the view to avoid including page scale factor. | |
| 671 LayoutRect absContainerFrame = LayoutRect(containingBlock->localToContainerQ uad(FloatRect(FloatPoint(), FloatSize(containingBlock->size())), view()).boundin gBox()); | |
|
chrishtr
2015/12/11 02:06:12
I don't think this should be in LayoutView coordin
flackr
2016/01/19 15:40:48
So this is specifically excluding page scale, whic
| |
| 672 | |
| 673 if (containingBlock->hasOverflowClip()) { | |
| 674 LayoutSize scrollOffset(containingBlock->layer()->scrollableArea()->adju stedScrollOffset()); | |
| 675 stickyLocation -= scrollOffset; | |
| 676 } | |
| 677 | |
| 678 // We can't call localToAbsolute on |this| because that will recur. FIXME: F or now, assume that |this| is not transformed. | |
| 679 constraints.setAbsoluteStickyBoxRect(LayoutRect(LayoutPoint(absContainerFram e.location()) + stickyLocation, flippedStickyBoxRect.size())); | |
| 680 | |
| 681 LayoutUnit horizontalOffsets = minimumValueForLength(style()->right(), const rainingRect.width()) + | |
| 682 minimumValueForLength(style()->left(), constrainingRect.width()); | |
| 683 bool skipRight = false; | |
| 684 bool skipLeft = false; | |
| 685 if (!style()->left().isAuto() && !style()->right().isAuto()) { | |
| 686 if (horizontalOffsets > containerContentRect.width() | |
| 687 || horizontalOffsets + containerContentRect.width() > constrainingRe ct.width()) { | |
| 688 skipRight = style()->isLeftToRightDirection(); | |
| 689 skipLeft = !skipRight; | |
| 690 } | |
| 691 } | |
| 692 | |
| 693 if (!style()->left().isAuto() && !skipLeft) { | |
| 694 constraints.setLeftOffset(minimumValueForLength(style()->left(), constra iningRect.width())); | |
| 695 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft); | |
| 696 } | |
| 697 | |
| 698 if (!style()->right().isAuto() && !skipRight) { | |
| 699 constraints.setRightOffset(minimumValueForLength(style()->right(), const rainingRect.width())); | |
| 700 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight); | |
| 701 } | |
| 702 | |
| 703 bool skipBottom = false; | |
| 704 // FIXME(ostap): Exclude top or bottom edge offset depending on the writing mode when related | |
| 705 // sections are fixed in spec: http://lists.w3.org/Archives/Public/www-style /2014May/0286.html | |
| 706 LayoutUnit verticalOffsets = minimumValueForLength(style()->top(), constrain ingRect.width()) + | |
| 707 minimumValueForLength(style()->bottom(), constrainingRect.width()); | |
| 708 if (!style()->top().isAuto() && !style()->bottom().isAuto()) { | |
| 709 if (verticalOffsets > containerContentRect.height() | |
| 710 || verticalOffsets + containerContentRect.height() > constrainingRec t.height()) { | |
| 711 skipBottom = true; | |
| 712 } | |
| 713 } | |
| 714 | |
| 715 if (!style()->top().isAuto()) { | |
| 716 constraints.setTopOffset(minimumValueForLength(style()->top(), constrain ingRect.height())); | |
| 717 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop); | |
| 718 } | |
| 719 | |
| 720 if (!style()->bottom().isAuto() && !skipBottom) { | |
| 721 constraints.setBottomOffset(minimumValueForLength(style()->bottom(), con strainingRect.height())); | |
| 722 constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom); | |
| 723 } | |
| 724 } | |
| 725 | |
| 726 LayoutRect LayoutBoxModelObject::computeStickyConstrainingRect() const | |
| 727 { | |
| 728 LayoutRect constrainingRect; | |
| 729 | |
| 730 ASSERT(hasLayer()); | |
| 731 LayoutBox* enclosingClippingBox = findScrollAncestor(this); | |
| 732 if (enclosingClippingBox) { | |
| 733 LayoutRect clipRect = enclosingClippingBox->overflowClipRect(LayoutPoint ()); | |
| 734 clipRect.move(enclosingClippingBox->paddingLeft(), enclosingClippingBox- >paddingTop()); | |
| 735 clipRect.contract(LayoutSize(enclosingClippingBox->paddingLeft() + enclo singClippingBox->paddingRight(), | |
| 736 enclosingClippingBox->paddingTop() + enclosingClippingBox->paddingBo ttom())); | |
| 737 constrainingRect = LayoutRect(enclosingClippingBox->localToContainerQuad (FloatRect(clipRect), view()).boundingBox()); | |
| 738 } else { | |
| 739 constrainingRect = LayoutRect(view()->frameView()->visibleContentRect()) ; | |
| 740 } | |
| 741 | |
| 742 return constrainingRect; | |
| 743 } | |
| 744 | |
| 745 LayoutSize LayoutBoxModelObject::stickyPositionOffset() const | |
| 746 { | |
| 747 LayoutRect constrainingRect = computeStickyConstrainingRect(); | |
|
chrishtr
2015/12/11 02:06:12
This will compute these rects from scratch on ever
flackr
2016/01/19 15:40:48
I've been trying to wrap my head around how we can
chrishtr
2016/01/30 01:49:02
What do you mean exactly that "LayoutInline::layou
flackr
2016/02/03 22:48:38
My original thinking was that I may need to call l
chrishtr
2016/02/08 21:46:55
No, in FrameView::updateLifecyclePhasesInternal, a
| |
| 748 StickyPositionViewportConstraints constraints; | |
| 749 computeStickyPositionConstraints(constraints, constrainingRect); | |
| 750 | |
| 751 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). | |
| 752 return LayoutSize(constraints.computeStickyOffset(constrainingRect)); | |
| 753 } | |
| 754 | |
| 611 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const L ayoutPoint& startPoint) const | 755 LayoutPoint LayoutBoxModelObject::adjustedPositionRelativeToOffsetParent(const L ayoutPoint& startPoint) const |
| 612 { | 756 { |
| 613 // If the element is the HTML body element or doesn't have a parent | 757 // If the element is the HTML body element or doesn't have a parent |
| 614 // return 0 and stop this algorithm. | 758 // return 0 and stop this algorithm. |
| 615 if (isBody() || !parent()) | 759 if (isBody() || !parent()) |
| 616 return LayoutPoint(); | 760 return LayoutPoint(); |
| 617 | 761 |
| 618 LayoutPoint referencePoint = startPoint; | 762 LayoutPoint referencePoint = startPoint; |
| 619 referencePoint.move(parent()->columnOffset(referencePoint)); | 763 referencePoint.move(parent()->columnOffset(referencePoint)); |
| 620 | 764 |
| 621 // If the offsetParent of the element is null, or is the HTML body element, | 765 // If the offsetParent of the element is null, or is the HTML body element, |
| 622 // return the distance between the canvas origin and the left border edge | 766 // return the distance between the canvas origin and the left border edge |
| 623 // of the element and stop this algorithm. | 767 // of the element and stop this algorithm. |
| 624 Element* element = offsetParent(); | 768 Element* element = offsetParent(); |
| 625 if (!element) | 769 if (!element) |
| 626 return referencePoint; | 770 return referencePoint; |
| 627 | 771 |
| 628 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { | 772 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { |
| 629 if (offsetParent->isBox() && !offsetParent->isBody()) | 773 if (offsetParent->isBox() && !offsetParent->isBody()) |
| 630 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); | 774 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); |
| 631 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { | 775 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { |
| 632 if (isInFlowPositioned()) | 776 if (isInFlowPositioned()) |
| 633 referencePoint.move(relativePositionOffset()); | 777 referencePoint.move(offsetForInFlowPosition()); |
| 634 | 778 |
| 635 LayoutObject* current; | 779 LayoutObject* current; |
| 636 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) { | 780 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) { |
| 637 // FIXME: What are we supposed to do inside SVG content? | 781 // FIXME: What are we supposed to do inside SVG content? |
| 638 if (!isOutOfFlowPositioned()) { | 782 if (!isOutOfFlowPositioned()) { |
| 639 if (current->isBox() && !current->isTableRow()) | 783 if (current->isBox() && !current->isTableRow()) |
| 640 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion()); | 784 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion()); |
| 641 referencePoint.move(current->parent()->columnOffset(referenc ePoint)); | 785 referencePoint.move(current->parent()->columnOffset(referenc ePoint)); |
| 642 } | 786 } |
| 643 } | 787 } |
| 644 | 788 |
| 645 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned()) | 789 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned()) |
| 646 referencePoint.moveBy(toLayoutBox(offsetParent)->topLeftLocation ()); | 790 referencePoint.moveBy(toLayoutBox(offsetParent)->topLeftLocation ()); |
| 647 } | 791 } |
| 648 } | 792 } |
| 649 | 793 |
| 650 return referencePoint; | 794 return referencePoint; |
| 651 } | 795 } |
| 652 | 796 |
| 653 LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const | 797 LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const |
| 654 { | 798 { |
| 655 return isRelPositioned() ? relativePositionOffset() : LayoutSize(); | 799 if (isRelPositioned()) |
| 800 return relativePositionOffset(); | |
| 801 | |
| 802 if (isStickyPositioned()) | |
| 803 return stickyPositionOffset(); | |
| 804 | |
| 805 return LayoutSize(); | |
| 656 } | 806 } |
| 657 | 807 |
| 658 LayoutUnit LayoutBoxModelObject::offsetLeft() const | 808 LayoutUnit LayoutBoxModelObject::offsetLeft() const |
| 659 { | 809 { |
| 660 // Note that LayoutInline and LayoutBox override this to pass a different | 810 // Note that LayoutInline and LayoutBox override this to pass a different |
| 661 // startPoint to adjustedPositionRelativeToOffsetParent. | 811 // startPoint to adjustedPositionRelativeToOffsetParent. |
| 662 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x(); | 812 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x(); |
| 663 } | 813 } |
| 664 | 814 |
| 665 LayoutUnit LayoutBoxModelObject::offsetTop() const | 815 LayoutUnit LayoutBoxModelObject::offsetTop() const |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer(const LayoutBox ModelObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 1118 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer(const LayoutBox ModelObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
| 969 { | 1119 { |
| 970 ASSERT(ancestorToStopAt != this); | 1120 ASSERT(ancestorToStopAt != this); |
| 971 | 1121 |
| 972 bool ancestorSkipped; | 1122 bool ancestorSkipped; |
| 973 LayoutObject* container = this->container(ancestorToStopAt, &ancestorSkipped ); | 1123 LayoutObject* container = this->container(ancestorToStopAt, &ancestorSkipped ); |
| 974 if (!container) | 1124 if (!container) |
| 975 return nullptr; | 1125 return nullptr; |
| 976 | 1126 |
| 977 bool isInline = isLayoutInline(); | 1127 bool isInline = isLayoutInline(); |
| 978 bool isFixedPos = !isInline && style()->position() == FixedPosition; | 1128 bool isFixedPosition = !isInline && style()->position() == FixedPosition; |
| 979 bool hasTransform = !isInline && hasLayer() && layer()->transform(); | 1129 bool hasTransform = !isInline && hasLayer() && layer()->transform(); |
| 980 | 1130 |
| 981 LayoutSize adjustmentForSkippedAncestor; | 1131 LayoutSize adjustmentForSkippedAncestor; |
| 982 if (ancestorSkipped) { | 1132 if (ancestorSkipped) { |
| 983 // There can't be a transform between paintInvalidationContainer and anc estorToStopAt, because transforms create containers, so it should be safe | 1133 // There can't be a transform between paintInvalidationContainer and anc estorToStopAt, because transforms create containers, so it should be safe |
| 984 // to just subtract the delta between the ancestor and ancestorToStopAt. | 1134 // to just subtract the delta between the ancestor and ancestorToStopAt. |
| 985 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont ainer(container); | 1135 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont ainer(container); |
| 986 } | 1136 } |
| 987 | 1137 |
| 988 bool offsetDependsOnPoint = false; | 1138 bool offsetDependsOnPoint = false; |
| 989 LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), & offsetDependsOnPoint); | 1139 LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), & offsetDependsOnPoint); |
| 1140 LayoutSize stickyOffset; | |
| 1141 if (style()->position() == StickyPosition) | |
| 1142 stickyOffset = offsetForInFlowPosition(); | |
| 990 | 1143 |
| 991 bool preserve3D = container->style()->preserves3D() || style()->preserves3D( ); | 1144 bool preserve3D = container->style()->preserves3D() || style()->preserves3D( ); |
| 992 if (shouldUseTransformFromContainer(container)) { | 1145 if (shouldUseTransformFromContainer(container)) { |
| 993 TransformationMatrix t; | 1146 TransformationMatrix t; |
| 994 getTransformFromContainer(container, containerOffset, t); | 1147 getTransformFromContainer(container, containerOffset, t); |
| 995 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm entForSkippedAncestor.height().toFloat()); | 1148 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm entForSkippedAncestor.height().toFloat()); |
| 996 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, isFixedPos, hasTransform); | 1149 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, isFixedPosit ion, hasTransform, LayoutSize(), stickyOffset); |
| 997 } else { | 1150 } else { |
| 998 containerOffset += adjustmentForSkippedAncestor; | 1151 containerOffset += adjustmentForSkippedAncestor; |
| 999 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint , isFixedPos, hasTransform); | 1152 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint , isFixedPosition, hasTransform, LayoutSize(), stickyOffset); |
| 1000 } | 1153 } |
| 1001 | 1154 |
| 1002 return ancestorSkipped ? ancestorToStopAt : container; | 1155 return ancestorSkipped ? ancestorToStopAt : container; |
| 1003 } | 1156 } |
| 1004 | 1157 |
| 1005 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, L ayoutObject* child, LayoutObject* beforeChild, bool fullRemoveInsert) | 1158 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, L ayoutObject* child, LayoutObject* beforeChild, bool fullRemoveInsert) |
| 1006 { | 1159 { |
| 1007 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the | 1160 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the |
| 1008 // positioned layoutObject maps don't become stale. It would be too slow to do the map lookup on each call. | 1161 // positioned layoutObject maps don't become stale. It would be too slow to do the map lookup on each call. |
| 1009 ASSERT(!fullRemoveInsert || !isLayoutBlock() || !toLayoutBlock(this)->hasPos itionedObjects()); | 1162 ASSERT(!fullRemoveInsert || !isLayoutBlock() || !toLayoutBlock(this)->hasPos itionedObjects()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 if (rootElementStyle->hasBackground()) | 1224 if (rootElementStyle->hasBackground()) |
| 1072 return false; | 1225 return false; |
| 1073 | 1226 |
| 1074 if (node() != document().firstBodyElement()) | 1227 if (node() != document().firstBodyElement()) |
| 1075 return false; | 1228 return false; |
| 1076 | 1229 |
| 1077 return true; | 1230 return true; |
| 1078 } | 1231 } |
| 1079 | 1232 |
| 1080 } // namespace blink | 1233 } // namespace blink |
| OLD | NEW |