Changeset 126774 in webkit
- Timestamp:
- Aug 27, 2012, 10:39:45 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 30 added
- 17 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/sticky/inflow-sticky-expected.html (added)
-
LayoutTests/fast/css/sticky/inflow-sticky.html (added)
-
LayoutTests/fast/css/sticky/inline-sticky-abspos-child-expected.html (added)
-
LayoutTests/fast/css/sticky/inline-sticky-abspos-child.html (added)
-
LayoutTests/fast/css/sticky/inline-sticky-expected.html (added)
-
LayoutTests/fast/css/sticky/inline-sticky.html (added)
-
LayoutTests/fast/css/sticky/replaced-sticky-expected.html (added)
-
LayoutTests/fast/css/sticky/replaced-sticky.html (added)
-
LayoutTests/fast/css/sticky/sticky-as-positioning-container-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-as-positioning-container.html (added)
-
LayoutTests/fast/css/sticky/sticky-left-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-left-percentage-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-left-percentage.html (added)
-
LayoutTests/fast/css/sticky/sticky-left.html (added)
-
LayoutTests/fast/css/sticky/sticky-margins-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-margins.html (added)
-
LayoutTests/fast/css/sticky/sticky-side-margins-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-side-margins.html (added)
-
LayoutTests/fast/css/sticky/sticky-stacking-context-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-stacking-context.html (added)
-
LayoutTests/fast/css/sticky/sticky-top-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-top-margins-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-top-margins.html (added)
-
LayoutTests/fast/css/sticky/sticky-top.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-horizontal-bt-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-horizontal-bt.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-vertical-lr-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-vertical-lr.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-vertical-rl-expected.html (added)
-
LayoutTests/fast/css/sticky/sticky-writing-mode-vertical-rl.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/StyleResolver.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlock.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderBox.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderBoxModelObject.cpp (modified) (5 diffs)
-
Source/WebCore/rendering/RenderBoxModelObject.h (modified) (3 diffs)
-
Source/WebCore/rendering/RenderInline.cpp (modified) (4 diffs)
-
Source/WebCore/rendering/RenderInline.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (4 diffs)
-
Source/WebCore/rendering/RenderLayer.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderObject.cpp (modified) (4 diffs)
-
Source/WebCore/rendering/RenderObject.h (modified) (4 diffs)
-
Source/WebCore/rendering/style/RenderStyle.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126764 r126774 1 2012-08-24 Simon Fraser <simon.fraser@apple.com> 2 3 Implement sticky positioning 4 https://bugs.webkit.org/show_bug.cgi?id=90046 5 6 Reviewed by Ojan Vafai. 7 8 Various ref tests for sticky positioning. 9 10 * fast/css/sticky/inflow-sticky-expected.html: Added. 11 * fast/css/sticky/inflow-sticky.html: Added. 12 * fast/css/sticky/inline-sticky-abspos-child-expected.html: Added. 13 * fast/css/sticky/inline-sticky-abspos-child.html: Added. 14 * fast/css/sticky/inline-sticky-expected.html: Added. 15 * fast/css/sticky/inline-sticky.html: Added. 16 * fast/css/sticky/replaced-sticky-expected.html: Added. 17 * fast/css/sticky/replaced-sticky.html: Added. 18 * fast/css/sticky/sticky-as-positioning-container-expected.html: Added. 19 * fast/css/sticky/sticky-as-positioning-container.html: Added. 20 * fast/css/sticky/sticky-left-expected.html: Added. 21 * fast/css/sticky/sticky-left-percentage-expected.html: Added. 22 * fast/css/sticky/sticky-left-percentage.html: Added. 23 * fast/css/sticky/sticky-left.html: Added. 24 * fast/css/sticky/sticky-margins-expected.html: Added. 25 * fast/css/sticky/sticky-margins.html: Added. 26 * fast/css/sticky/sticky-side-margins-expected.html: Added. 27 * fast/css/sticky/sticky-side-margins.html: Added. 28 * fast/css/sticky/sticky-stacking-context-expected.html: Added. 29 * fast/css/sticky/sticky-stacking-context.html: Added. 30 * fast/css/sticky/sticky-top-expected.html: Added. 31 * fast/css/sticky/sticky-top-margins-expected.html: Added. 32 * fast/css/sticky/sticky-top-margins.html: Added. 33 * fast/css/sticky/sticky-top.html: Added. 34 * fast/css/sticky/sticky-writing-mode-horizontal-bt-expected.html: Added. 35 * fast/css/sticky/sticky-writing-mode-horizontal-bt.html: Added. 36 * fast/css/sticky/sticky-writing-mode-vertical-lr-expected.html: Added. 37 * fast/css/sticky/sticky-writing-mode-vertical-lr.html: Added. 38 * fast/css/sticky/sticky-writing-mode-vertical-rl-expected.html: Added. 39 * fast/css/sticky/sticky-writing-mode-vertical-rl.html: Added. 40 1 41 2012-08-27 Vsevolod Vlasov <vsevik@chromium.org> 2 42 -
trunk/Source/WebCore/ChangeLog
r126770 r126774 1 2012-08-24 Simon Fraser <simon.fraser@apple.com> 2 3 Implement sticky positioning 4 https://bugs.webkit.org/show_bug.cgi?id=90046 5 6 Reviewed by Ojan Vafai. 7 8 Initial implementation of position: -webkit-sticky, which 9 constrains an element to be positioned inside the intersection 10 of its container box, and the viewport. Sticky elements create 11 stacking context. 12 13 A stickily positioned element behaves like position:relative 14 (space is reserved for it in-flow), but with an offset that is 15 determined by the sticky position. Changed isInFlowPositioned() 16 to cover relative and sticky. 17 18 Added a convenience isPositioned() to RenderObject(), which 19 is true for an object with any non-static position value. 20 21 Tests: fast/css/sticky/inflow-sticky.html 22 fast/css/sticky/inline-sticky-abspos-child.html 23 fast/css/sticky/inline-sticky.html 24 fast/css/sticky/replaced-sticky.html 25 fast/css/sticky/sticky-as-positioning-container.html 26 fast/css/sticky/sticky-left-percentage.html 27 fast/css/sticky/sticky-left.html 28 fast/css/sticky/sticky-margins.html 29 fast/css/sticky/sticky-side-margins.html 30 fast/css/sticky/sticky-stacking-context.html 31 fast/css/sticky/sticky-top-margins.html 32 fast/css/sticky/sticky-top.html 33 fast/css/sticky/sticky-writing-mode-horizontal-bt.html 34 fast/css/sticky/sticky-writing-mode-vertical-lr.html 35 fast/css/sticky/sticky-writing-mode-vertical-rl.html 36 37 * css/StyleResolver.cpp: 38 (WebCore::StyleResolver::adjustRenderStyle): Have position:sticky 39 create stacking context from the get-go, to make scrolling optimizations easier later. 40 * page/FrameView.cpp: 41 (WebCore::FrameView::scrollContentsFastPath): Use hasViewportConstrainedPosition(). 42 * page/FrameView.h: FrameView's "fixed" objects contains both fixed and sticky objects now. 43 * rendering/RenderBlock.cpp: Use isPositioned(). 44 (WebCore::RenderBlock::isSelectionRoot): 45 (WebCore::RenderBlock::renderName): 46 * rendering/RenderBox.cpp: 47 (WebCore::RenderBox::styleWillChange): Need to look for both stick and fixed positioning to 48 determine whether to add something to FrameView's fixed object set. 49 (WebCore::RenderBox::computeRectForRepaint): Need to take the sticky offset into account 50 when computing repaint rects. 51 * rendering/RenderBox.h: Implement frameRectForStickyPositioning() for boxes. 52 * rendering/RenderBoxModelObject.cpp: 53 (WebCore::RenderBoxModelObject::updateBoxModelInfoFromStyle): 54 (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent): 55 (WebCore::RenderBoxModelObject::stickyPositionOffset): Compute the sticky position 56 offset by taking into account the viewport rect, and the conteriner's contentRect 57 inset by its margins. 58 (WebCore::RenderBoxModelObject::offsetForInFlowPosition): Convenience wrapper 59 for getting relative or sticky offset. 60 * rendering/RenderBoxModelObject.h: Have requiresLayer() use isPositioned(). 61 (WebCore::RenderBoxModelObject::stickyPositionLogicalOffset): 62 * rendering/RenderInline.cpp: 63 (WebCore::RenderInline::styleWillChange): Need to implement this to 64 add/remove objects from FrameView's fixed object list, since, prior to sticky, 65 only boxes could be fixed. 66 (WebCore::RenderInline::renderName): 67 (WebCore::RenderInline::positionForPoint): 68 (WebCore::RenderInline::computeRectForRepaint): 69 * rendering/RenderInline.h: 70 * rendering/RenderLayer.cpp: 71 (WebCore::RenderLayer::updateLayerPositionsAfterScroll): Have to look for fixed or sticky. 72 (WebCore::RenderLayer::calculateClipRects): Use isPositioned(). 73 (WebCore::RenderLayer::shouldBeNormalFlowOnly): Ditto. 74 * rendering/RenderLayer.h: 75 * rendering/RenderObject.cpp: 76 (WebCore::RenderObject::styleWillChange): 77 (WebCore::RenderObject::propagateStyleToAnonymousChildren): Should use isInFlowPositioned(), 78 not just isRelPositioned(). 79 (WebCore::RenderObject::offsetParent): Use isPositioned(). 80 * rendering/RenderObject.h: 81 (WebCore::RenderObject::isInFlowPositioned): 82 (WebCore::RenderObject::isStickyPositioned): 83 (WebCore::RenderObject::setStickyPositioned): 84 (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields): 85 (RenderObjectBitfields): 86 * rendering/RenderStyle.h: add hasViewportConstrainedPosition() for fixed or sticky position. 87 1 88 2012-08-27 Julien Chaffraix <jchaffraix@webkit.org> 2 89 -
trunk/Source/WebCore/css/StyleResolver.cpp
r126520 r126774 2197 2197 || style->boxReflect() 2198 2198 || style->hasFilter() 2199 || style->position() == StickyPosition 2199 2200 #ifdef FIXED_POSITION_CREATES_STACKING_CONTEXT 2200 2201 || style->position() == FixedPosition -
trunk/Source/WebCore/page/FrameView.cpp
r126754 r126774 1503 1503 for (FixedObjectSet::const_iterator it = m_fixedObjects->begin(); it != end; ++it) { 1504 1504 RenderObject* renderer = *it; 1505 if ( renderer->style()->position() != FixedPosition)1505 if (!renderer->style()->hasViewportConstrainedPosition()) 1506 1506 continue; 1507 1507 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/page/FrameView.h
r126444 r126774 198 198 bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; } 199 199 200 // This includes position:fixed and sticky objects. 200 201 typedef HashSet<RenderObject*> FixedObjectSet; 201 202 void addFixedObject(RenderObject*); -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r126605 r126774 3211 3211 3212 3212 if (isBody() || isRoot() || hasOverflowClip() 3213 || is InFlowPositioned() || isFloatingOrOutOfFlowPositioned()3213 || isPositioned() || isFloating() 3214 3214 || isTableCell() || isInlineBlockOrInlineTable() 3215 3215 || hasTransform() || hasReflection() || hasMask() || isWritingModeRoot()) … … 7363 7363 if (isRelPositioned()) 7364 7364 return "RenderBlock (relative positioned)"; 7365 if (isStickyPositioned()) 7366 return "RenderBlock (sticky positioned)"; 7365 7367 if (isRunIn()) 7366 7368 return "RenderBlock (run-in)"; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r126520 r126774 207 207 208 208 if (FrameView *frameView = view()->frameView()) { 209 bool newStyleIs Fixed = newStyle && newStyle->position() == FixedPosition;210 bool oldStyleIs Fixed = oldStyle && oldStyle->position() == FixedPosition;211 if (newStyleIs Fixed != oldStyleIsFixed) {212 if (newStyleIs Fixed)209 bool newStyleIsViewportConstained = newStyle && newStyle->hasViewportConstrainedPosition(); 210 bool oldStyleIsViewportConstrained = oldStyle && oldStyle->hasViewportConstrainedPosition(); 211 if (newStyleIsViewportConstained != oldStyleIsViewportConstrained) { 212 if (newStyleIsViewportConstained) 213 213 frameView->addFixedObject(this); 214 214 else … … 1578 1578 if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline()) 1579 1579 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this); 1580 else if ((position == RelativePosition ) && layer()) {1580 else if ((position == RelativePosition || position == StickyPosition) && layer()) { 1581 1581 // Apply the relative position offset when invalidating a rectangle. The layer 1582 1582 // is translated, but the render box isn't, so we need to do this to get the -
trunk/Source/WebCore/rendering/RenderBox.h
r126520 r126774 45 45 // hasAutoZIndex only returns true if the element is positioned or a flex-item since 46 46 // position:static elements that are not flex-items get their z-index coerced to auto. 47 virtual bool requiresLayer() const OVERRIDE { return isRoot() || is OutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); }47 virtual bool requiresLayer() const OVERRIDE { return isRoot() || isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns() || !style()->hasAutoZIndex(); } 48 48 49 49 // Use this with caution! No type checking is done! … … 580 580 virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); } 581 581 582 virtual LayoutRect frameRectForStickyPositioning() const OVERRIDE { return frameRect(); } 583 582 584 private: 583 585 // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r126520 r126774 457 457 setInline(styleToUse->isDisplayInlineType()); 458 458 setRelPositioned(styleToUse->position() == RelativePosition); 459 setStickyPositioned(styleToUse->position() == StickyPosition); 459 460 setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); 460 461 } … … 535 536 if (isRelPositioned()) 536 537 referencePoint.move(relativePositionOffset()); 538 else if (isStickyPositioned()) 539 referencePoint.move(stickyPositionOffset()); 537 540 const RenderObject* curr = parent(); 538 541 while (curr != offsetParent) { … … 543 546 curr = curr->parent(); 544 547 } 545 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent->is RelPositioned() && !offsetParent->isOutOfFlowPositioned())548 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent->isPositioned()) 546 549 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation()); 547 550 } … … 549 552 550 553 return referencePoint; 554 } 555 556 LayoutSize RenderBoxModelObject::stickyPositionOffset() const 557 { 558 RenderBlock* containingBlock = this->containingBlock(); 559 560 LayoutRect viewportRect = view()->frameView()->visibleContentRect(); 561 LayoutRect containerContentRect = containingBlock->contentBoxRect(); 562 563 LayoutUnit minLeftMargin = minimumValueForLength(style()->marginLeft(), containingBlock->availableLogicalWidth(), view()); 564 LayoutUnit minTopMargin = minimumValueForLength(style()->marginTop(), containingBlock->availableLogicalWidth(), view()); 565 LayoutUnit minRightMargin = minimumValueForLength(style()->marginRight(), containingBlock->availableLogicalWidth(), view()); 566 LayoutUnit minBottomMargin = minimumValueForLength(style()->marginBottom(), containingBlock->availableLogicalWidth(), view()); 567 568 // Compute the container-relative area within which the sticky element is allowed to move. 569 containerContentRect.move(minLeftMargin, minTopMargin); 570 containerContentRect.contract(minLeftMargin + minRightMargin, minTopMargin + minBottomMargin); 571 FloatRect absContainerContentRect = containingBlock->localToAbsoluteQuad(FloatRect(containerContentRect)).boundingBox(); 572 573 LayoutRect stickyBoxRect = frameRectForStickyPositioning(); 574 LayoutRect flippedStickyBoxRect = stickyBoxRect; 575 containingBlock->flipForWritingMode(flippedStickyBoxRect); 576 LayoutPoint stickyLocation = flippedStickyBoxRect.location(); 577 578 // FIXME: sucks to call localToAbsolute again, but we can't just offset from the previously computed rect if there are transforms. 579 FloatRect absContainerFrame = containingBlock->localToAbsoluteQuad(FloatRect(FloatPoint(), containingBlock->size())).boundingBox(); 580 // We can't call localToAbsolute on |this| because that will recur. FIXME: For now, assume that |this| is not transformed. 581 FloatRect absoluteStickyBoxRect(absContainerFrame.location() + stickyLocation, flippedStickyBoxRect.size()); 582 583 FloatPoint originalLocation = absoluteStickyBoxRect.location(); 584 585 // Horizontal position. 586 // FIXME: if left and right are specified, allow right to override left. 587 if (!style()->left().isAuto()) { 588 LayoutUnit leftLimit = viewportRect.x() + valueForLength(style()->left(), viewportRect.width(), view()); 589 if (absoluteStickyBoxRect.x() < leftLimit) 590 absoluteStickyBoxRect.setX(leftLimit); 591 592 if (absoluteStickyBoxRect.maxX() > absContainerContentRect.maxX()) 593 absoluteStickyBoxRect.setX(absContainerContentRect.maxX() - absoluteStickyBoxRect.width()); 594 } 595 596 if (!style()->right().isAuto()) { 597 LayoutUnit rightLimit = viewportRect.maxX() - valueForLength(style()->right(), viewportRect.width(), view()); 598 if (absoluteStickyBoxRect.maxX() > rightLimit) 599 absoluteStickyBoxRect.setX(rightLimit - absoluteStickyBoxRect.width()); 600 601 if (absoluteStickyBoxRect.x() < absContainerContentRect.x()) 602 absoluteStickyBoxRect.setX(absContainerContentRect.x()); 603 } 604 605 // Vertical position. 606 // FIXME: if top and bottom are specified, allow bottom to override top. 607 if (!style()->top().isAuto()) { 608 LayoutUnit topLimit = viewportRect.y() + valueForLength(style()->top(), viewportRect.height(), view()); 609 if (absoluteStickyBoxRect.y() < topLimit) 610 absoluteStickyBoxRect.setY(topLimit); 611 612 if (absoluteStickyBoxRect.maxY() > absContainerContentRect.maxY()) 613 absoluteStickyBoxRect.setY(absContainerContentRect.maxY() - absoluteStickyBoxRect.height()); 614 } 615 616 if (!style()->bottom().isAuto()) { 617 LayoutUnit bottomLimit = viewportRect.maxY() - valueForLength(style()->bottom(), viewportRect.height(), view()); 618 if (absoluteStickyBoxRect.maxY() > bottomLimit) 619 absoluteStickyBoxRect.setY(bottomLimit - absoluteStickyBoxRect.height()); 620 621 if (absoluteStickyBoxRect.y() < absContainerContentRect.y()) 622 absoluteStickyBoxRect.setY(absContainerContentRect.y()); 623 } 624 625 // The sticky offset is physical, so we can just return the delta computed in absolute coords (though it may be wrong with transforms). 626 return roundedLayoutSize(absoluteStickyBoxRect.location() - originalLocation); 551 627 } 552 628 … … 555 631 if (isRelPositioned()) 556 632 return relativePositionOffset(); 633 634 if (isStickyPositioned()) 635 return stickyPositionOffset(); 557 636 558 637 return LayoutSize(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r126520 r126774 63 63 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } 64 64 65 LayoutSize stickyPositionOffset() const; 66 LayoutSize stickyPositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? stickyPositionOffset() : stickyPositionOffset().transposedSize(); } 67 65 68 LayoutSize offsetForInFlowPosition() const; 66 69 … … 83 86 bool hasSelfPaintingLayer() const; 84 87 RenderLayer* layer() const { return m_layer; } 85 virtual bool requiresLayer() const { return isRoot() || is OutOfFlowPositioned() || isInFlowPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); }88 virtual bool requiresLayer() const { return isRoot() || isPositioned() || isTransparent() || hasTransform() || hasHiddenBackface() || hasMask() || hasReflection() || hasFilter() || style()->specifiesColumns(); } 86 89 87 90 // This will work on inlines to return the bounding box of all of the lines' border boxes. … … 276 279 private: 277 280 virtual bool isBoxModelObject() const { return true; } 281 282 virtual LayoutRect frameRectForStickyPositioning() const = 0; 278 283 279 284 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositioningAreaSize) const; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r126520 r126774 154 154 block->setStyle(blockStyle); 155 155 } 156 } 157 158 void RenderInline::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) 159 { 160 if (FrameView *frameView = view()->frameView()) { 161 RenderStyle* oldStyle = style(); 162 bool newStyleIsSticky = newStyle && newStyle->position() == StickyPosition; 163 bool oldStyleIsSticky = oldStyle && oldStyle->position() == StickyPosition; 164 if (newStyleIsSticky != oldStyleIsSticky) { 165 if (newStyleIsSticky) 166 frameView->addFixedObject(this); 167 else 168 frameView->removeFixedObject(this); 169 } 170 } 171 172 RenderBoxModelObject::styleWillChange(diff, newStyle); 156 173 } 157 174 … … 751 768 if (isRelPositioned()) 752 769 return "RenderInline (relative positioned)"; 770 if (isStickyPositioned()) 771 return "RenderInline (sticky positioned)"; 753 772 if (isAnonymous()) 754 773 return "RenderInline (generated)"; … … 766 785 VisiblePosition RenderInline::positionForPoint(const LayoutPoint& point) 767 786 { 768 // FIXME: Does not deal with relative positioned inlines (should it?)787 // FIXME: Does not deal with relative or sticky positioned inlines (should it?) 769 788 RenderBlock* cb = containingBlock(); 770 789 if (firstLineBox()) { … … 1065 1084 // Apply the in-flow position offset when invalidating a rectangle. The layer 1066 1085 // is translated, but the render box isn't, so we need to do this to get the 1067 // right dirty rect. Since this is called from RenderObject::setStyle, the relative position1086 // right dirty rect. Since this is called from RenderObject::setStyle, the relative or sticky position 1068 1087 // flag on the RenderObject has been cleared, so use the one on the style(). 1069 1088 topLeft += layer()->offsetForInFlowPosition(); -
trunk/Source/WebCore/rendering/RenderInline.h
r126520 r126774 90 90 virtual void willBeDestroyed(); 91 91 92 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 92 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle) OVERRIDE; 93 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE; 93 94 94 95 private: … … 141 142 virtual VisiblePosition positionForPoint(const LayoutPoint&); 142 143 144 virtual LayoutRect frameRectForStickyPositioning() const OVERRIDE { return linesBoundingBox(); } 145 143 146 virtual IntRect borderBoundingBox() const 144 147 { -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r126663 r126774 520 520 updateLayerPosition(); 521 521 522 if ((flags & HasSeen FixedPositionedAncestor) || renderer()->style()->position() == FixedPosition) {522 if ((flags & HasSeenViewportConstrainedAncestor) || renderer()->style()->hasViewportConstrainedPosition()) { 523 523 // FIXME: Is it worth passing the offsetFromRoot around like in updateLayerPositions? 524 524 computeRepaintRects(); 525 flags |= HasSeen FixedPositionedAncestor;525 flags |= HasSeenViewportConstrainedAncestor; 526 526 } else if ((flags & HasSeenAncestorWithOverflowClip) && !m_canSkipRepaintRectsUpdateOnScroll) { 527 527 // If we have seen an overflow clip, we should update our repaint rects as clippedOverflowRectForRepaint … … 934 934 { 935 935 RenderBoxModelObject* layerRenderer = layer->renderer(); 936 return layer->isRootLayer() || layerRenderer->is OutOfFlowPositioned() || layerRenderer->isInFlowPositioned() || layer->hasTransform();936 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTransform(); 937 937 } 938 938 … … 3997 3997 newOverflowClip.setHasRadius(true); 3998 3998 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); 3999 if (renderer()->is OutOfFlowPositioned() || renderer()->isInFlowPositioned())3999 if (renderer()->isPositioned()) 4000 4000 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect())); 4001 4001 } … … 4802 4802 || renderer()->isRenderIFrame() 4803 4803 || (renderer()->style()->specifiesColumns() && !isRootLayer())) 4804 && !renderer()->isOutOfFlowPositioned() 4805 && !renderer()->isInFlowPositioned() 4804 && !renderer()->isPositioned() 4806 4805 && !renderer()->hasTransform() 4807 4806 #if ENABLE(CSS_FILTERS) -
trunk/Source/WebCore/rendering/RenderLayer.h
r126766 r126774 576 576 enum UpdateLayerPositionsAfterScrollFlag { 577 577 NoFlag = 0, 578 HasSeen FixedPositionedAncestor = 1 << 0,578 HasSeenViewportConstrainedAncestor = 1 << 0, 579 579 HasSeenAncestorWithOverflowClip = 1 << 1 580 580 }; -
trunk/Source/WebCore/rendering/RenderObject.cpp
r126520 r126774 1854 1854 1855 1855 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned() 1856 && (!newStyle->isFloating() && newStyle->position() != AbsolutePosition && newStyle->position() != FixedPosition)1856 && (!newStyle->isFloating() && !newStyle->hasOutOfFlowPosition()) 1857 1857 && parent() && (parent()->isBlockFlow() || parent()->isRenderInline()); 1858 1858 … … 1862 1862 setPositioned(false); 1863 1863 setRelPositioned(false); 1864 setStickyPositioned(false); 1864 1865 } 1865 1866 setHorizontalWritingMode(true); … … 1967 1968 } 1968 1969 1969 // Preserve the position style of anonymous block continuations as they can have relative position when1970 // they contain block descendants of relative positioned inlines.1971 if (child->is RelPositioned() && toRenderBlock(child)->isAnonymousBlockContinuation())1970 // Preserve the position style of anonymous block continuations as they can have relative or sticky position when 1971 // they contain block descendants of relative or sticky positioned inlines. 1972 if (child->isInFlowPositioned() && toRenderBlock(child)->isAnonymousBlockContinuation()) 1972 1973 newStyle->setPosition(child->style()->position()); 1973 1974 … … 2899 2900 // * Our own extension: if there is a difference in the effective zoom 2900 2901 2901 bool skipTables = is OutOfFlowPositioned() || isRelPositioned();2902 bool skipTables = isPositioned(); 2902 2903 float currZoom = style()->effectiveZoom(); 2903 2904 RenderObject* curr = parent(); 2904 while (curr && (!curr->node() || (!curr->is OutOfFlowPositioned() && !curr->isRelPositioned() && !curr->isBody()))) {2905 while (curr && (!curr->node() || (!curr->isPositioned() && !curr->isBody()))) { 2905 2906 Node* element = curr->node(); 2906 2907 if (!skipTables && element && (element->hasTagName(tableTag) || element->hasTagName(tdTag) || element->hasTagName(thTag))) -
trunk/Source/WebCore/rendering/RenderObject.h
r126520 r126774 514 514 515 515 bool isOutOfFlowPositioned() const { return m_bitfields.positioned(); } // absolute or fixed positioning 516 bool isInFlowPositioned() const { return m_bitfields.relPositioned() ; } // relativepositioning516 bool isInFlowPositioned() const { return m_bitfields.relPositioned() || m_bitfields.stickyPositioned(); } // relative or sticky positioning 517 517 bool isRelPositioned() const { return m_bitfields.relPositioned(); } // relative positioning 518 bool isStickyPositioned() const { return m_bitfields.stickyPositioned(); } 519 bool isPositioned() const { return m_bitfields.positioned() || m_bitfields.relPositioned() || m_bitfields.stickyPositioned(); } 518 520 519 521 bool isText() const { return m_bitfields.isText(); } … … 622 624 void setPositioned(bool b = true) { m_bitfields.setPositioned(b); } 623 625 void setRelPositioned(bool b = true) { m_bitfields.setRelPositioned(b); } 626 void setStickyPositioned(bool b = true) { m_bitfields.setStickyPositioned(b); } 624 627 void setFloating(bool b = true) { m_bitfields.setFloating(b); } 625 628 void setInline(bool b = true) { m_bitfields.setIsInline(b); } … … 991 994 , m_positioned(false) 992 995 , m_relPositioned(false) 996 , m_stickyPositioned(false) 993 997 , m_paintBackground(false) 994 998 , m_isAnonymous(node == node->document()) … … 1025 1029 ADD_BOOLEAN_BITFIELD(positioned, Positioned); 1026 1030 ADD_BOOLEAN_BITFIELD(relPositioned, RelPositioned); 1031 ADD_BOOLEAN_BITFIELD(stickyPositioned, StickyPositioned); 1027 1032 ADD_BOOLEAN_BITFIELD(paintBackground, PaintBackground); // if the box has something to paint in the 1028 1033 // background painting phase (background, border, etc) -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r126520 r126774 512 512 bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; } 513 513 bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; } 514 bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; } 514 515 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); } 515 516
Note:
See TracChangeset
for help on using the changeset viewer.