diff --git a/engine/core/rendering/LayoutState.cpp b/engine/core/rendering/LayoutState.cpp index aa7da4522c6..44bdc049804 100644 --- a/engine/core/rendering/LayoutState.cpp +++ b/engine/core/rendering/LayoutState.cpp @@ -49,14 +49,6 @@ LayoutState::LayoutState(RenderBox& renderer, const LayoutSize& offset, bool con { renderer.view()->pushLayoutState(*this); m_layoutOffset = m_next->m_layoutOffset + offset; - - if (renderer.isOutOfFlowPositioned()) { - if (RenderObject* container = renderer.container()) { - if (container->style()->hasInFlowPosition() && container->isRenderInline()) - m_layoutOffset += toRenderInline(container)->offsetForInFlowPositionedInline(renderer); - } - } - // FIXME: Apply control clip if present. } diff --git a/engine/core/rendering/RenderBlock.cpp b/engine/core/rendering/RenderBlock.cpp index d2a203a5ae7..94b779b3f36 100644 --- a/engine/core/rendering/RenderBlock.cpp +++ b/engine/core/rendering/RenderBlock.cpp @@ -640,14 +640,6 @@ GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoi if (curr->isFloatingOrOutOfFlowPositioned()) continue; // We must be a normal flow object in order to even be considered. - if (curr->isRelPositioned() && curr->hasLayer()) { - // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element. - // Just disregard it completely. - LayoutSize relOffset = curr->layer()->offsetForInFlowPosition(); - if (relOffset.width() || relOffset.height()) - continue; - } - bool paintsOwnSelection = curr->shouldPaintSelectionGaps(); bool fillBlockGaps = paintsOwnSelection || (curr->canBeSelectionLeaf() && childState != SelectionNone); if (fillBlockGaps) { @@ -1117,8 +1109,6 @@ static inline bool isEditingBoundary(RenderObject* ancestor, RenderObject* child static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBlock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) { LayoutPoint childLocation = child->location(); - if (child->isRelPositioned()) - childLocation += child->offsetForInFlowPosition(); // FIXME: This is wrong if the child's writing-mode is different from the parent's. LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates - childLocation)); @@ -1631,8 +1621,6 @@ const char* RenderBlock::renderName() const return "RenderBlock (anonymous)"; if (isAnonymous()) return "RenderBlock (generated)"; - if (isRelPositioned()) - return "RenderBlock (relative positioned)"; return "RenderBlock"; } diff --git a/engine/core/rendering/RenderBox.cpp b/engine/core/rendering/RenderBox.cpp index f1bbc05010c..aaace3707e0 100644 --- a/engine/core/rendering/RenderBox.cpp +++ b/engine/core/rendering/RenderBox.cpp @@ -1115,18 +1115,9 @@ void RenderBox::mapLocalToContainer(const RenderLayerModelObject* paintInvalidat LayoutSize RenderBox::offsetFromContainer(const RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const { ASSERT(o == container()); - - LayoutSize offset; - if (isRelPositioned()) - offset += offsetForInFlowPosition(); - if (!isInline() || isReplaced()) - offset += locationOffset(); - - if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->isRenderInline()) - offset += toRenderInline(o)->offsetForInFlowPositionedInline(*this); - - return offset; + return locationOffset(); + return LayoutSize(); } InlineBox* RenderBox::createInlineBox() @@ -1170,9 +1161,6 @@ void RenderBox::positionLineBox(InlineBox* box) setChildNeedsLayout(MarkOnlyThis); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. } - if (container()->isRenderInline()) - moveWithEdgeOfInlineContainerIfNecessary(); - // Nuke the box. box->remove(DontMarkLineBoxes); box->destroy(); @@ -1182,17 +1170,6 @@ void RenderBox::positionLineBox(InlineBox* box) } } -void RenderBox::moveWithEdgeOfInlineContainerIfNecessary() -{ - ASSERT(isOutOfFlowPositioned() && container()->isRenderInline() && container()->isRelPositioned()); - // If this object is inside a relative positioned inline and its inline position is an explicit offset from the edge of its container - // then it will need to move if its inline container has changed width. We do not track if the width has changed - // but if we are here then we are laying out lines inside it, so it probably has - mark our object for layout so that it can - // move to the new offset created by the new width. - if (!normalChildNeedsLayout() && !style()->hasStaticInlinePosition()) - setChildNeedsLayout(MarkOnlyThis); -} - void RenderBox::deleteLineBoxWrapper() { if (inlineBoxWrapper()) { @@ -1807,54 +1784,16 @@ void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock) const { - if (containingBlock->isBox()) - return toRenderBox(containingBlock)->clientLogicalWidth(); - - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); - - const RenderInline* flow = toRenderInline(containingBlock); - InlineFlowBox* first = flow->firstLineBox(); - InlineFlowBox* last = flow->lastLineBox(); - - // If the containing block is empty, return a width of 0. - if (!first || !last) - return 0; - - LayoutUnit fromLeft; - LayoutUnit fromRight; - if (containingBlock->style()->isLeftToRightDirection()) { - fromLeft = first->logicalLeft() + first->borderLogicalLeft(); - fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLogicalRight(); - } else { - fromRight = first->logicalLeft() + first->logicalWidth() - first->borderLogicalRight(); - fromLeft = last->logicalLeft() + last->borderLogicalLeft(); - } - - return std::max(0, fromRight - fromLeft); + ASSERT(containingBlock->isBox()); + return toRenderBox(containingBlock)->clientLogicalWidth(); } LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock) const { - if (containingBlock->isBox()) { - const RenderBlock* cb = containingBlock->isRenderBlock() ? - toRenderBlock(containingBlock) : containingBlock->containingBlock(); - return cb->clientLogicalHeight(); - } - - ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned()); - - const RenderInline* flow = toRenderInline(containingBlock); - InlineFlowBox* first = flow->firstLineBox(); - InlineFlowBox* last = flow->lastLineBox(); - - // If the containing block is empty, return a height of 0. - if (!first || !last) - return 0; - - LayoutRect boundingBox = flow->linesBoundingBox(); - LayoutUnit heightResult = boundingBox.height(); - heightResult -= (containingBlock->borderBefore() + containingBlock->borderAfter()); - return heightResult; + ASSERT(containingBlock->isBox()); + const RenderBlock* cb = containingBlock->isRenderBlock() ? + toRenderBlock(containingBlock) : containingBlock->containingBlock(); + return cb->clientLogicalHeight(); } static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth) @@ -1866,18 +1805,8 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh if (child->parent()->style()->direction() == LTR) { LayoutUnit staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft(); for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->container()) { - if (curr->isBox()) { + if (curr->isBox()) staticPosition += toRenderBox(curr)->logicalLeft(); - if (toRenderBox(curr)->isRelPositioned()) - staticPosition += toRenderBox(curr)->relativePositionOffset().width(); - } else if (curr->isInline()) { - if (curr->isRelPositioned()) { - if (!curr->style()->logicalLeft().isAuto()) - staticPosition += curr->style()->logicalLeft().value(); - else - staticPosition -= curr->style()->logicalRight().value(); - } - } } logicalLeft.setValue(Fixed, staticPosition); } else { @@ -1885,20 +1814,10 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh LayoutUnit staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalLeft(); for (RenderObject* curr = child->parent(); curr; curr = curr->container()) { if (curr->isBox()) { - if (curr != containerBlock) { + if (curr != containerBlock) staticPosition -= toRenderBox(curr)->logicalLeft(); - if (toRenderBox(curr)->isRelPositioned()) - staticPosition -= toRenderBox(curr)->relativePositionOffset().width(); - } if (curr == enclosingBox) staticPosition -= enclosingBox->logicalWidth(); - } else if (curr->isInline()) { - if (curr->isRelPositioned()) { - if (!curr->style()->logicalLeft().isAuto()) - staticPosition -= curr->style()->logicalLeft().value(); - else - staticPosition += curr->style()->logicalRight().value(); - } } if (curr == containerBlock) break; @@ -3092,14 +3011,8 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation() const if (!hasOverflowClip()) rect.unite(layoutOverflowRect()); - bool hasTransform = hasLayer() && layer()->transform(); - if (isRelPositioned() || hasTransform) { - if (hasTransform) - rect = layer()->currentTransform().mapRect(rect); - - if (isRelPositioned()) - rect.move(offsetForInFlowPosition()); - } + if (hasLayer() && layer()->transform()) + rect = layer()->currentTransform().mapRect(rect); return rect; } diff --git a/engine/core/rendering/RenderBox.h b/engine/core/rendering/RenderBox.h index 073ed3bddb8..4547fee2380 100644 --- a/engine/core/rendering/RenderBox.h +++ b/engine/core/rendering/RenderBox.h @@ -327,7 +327,6 @@ public: void computeAndSetBlockDirectionMargins(const RenderBlock* containingBlock); void positionLineBox(InlineBox*); - void moveWithEdgeOfInlineContainerIfNecessary(); virtual InlineBox* createInlineBox(); void dirtyLineBoxes(bool fullLayout); diff --git a/engine/core/rendering/RenderBoxModelObject.cpp b/engine/core/rendering/RenderBoxModelObject.cpp index bfa618e6b6a..62f95a470ef 100644 --- a/engine/core/rendering/RenderBoxModelObject.cpp +++ b/engine/core/rendering/RenderBoxModelObject.cpp @@ -175,9 +175,6 @@ LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L if (offsetParent->isBox()) referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRenderBox(offsetParent)->borderTop()); if (!isOutOfFlowPositioned()) { - if (isRelPositioned()) - referencePoint.move(relativePositionOffset()); - RenderObject* current; for (current = parent(); current != offsetParent && current->parent(); current = current->parent()) { // FIXME: What are we supposed to do inside SVG content? @@ -192,11 +189,6 @@ LayoutPoint RenderBoxModelObject::adjustedPositionRelativeToOffsetParent(const L return referencePoint; } -LayoutSize RenderBoxModelObject::offsetForInFlowPosition() const -{ - return isRelPositioned() ? relativePositionOffset() : LayoutSize(); -} - LayoutUnit RenderBoxModelObject::offsetLeft() const { // Note that RenderInline and RenderBox override this to pass a different diff --git a/engine/core/rendering/RenderBoxModelObject.h b/engine/core/rendering/RenderBoxModelObject.h index 5b6afacb3f0..d5b2daf5036 100644 --- a/engine/core/rendering/RenderBoxModelObject.h +++ b/engine/core/rendering/RenderBoxModelObject.h @@ -59,8 +59,6 @@ public: LayoutSize relativePositionOffset() const; LayoutSize relativePositionLogicalOffset() const { return relativePositionOffset(); } - LayoutSize offsetForInFlowPosition() const; - // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) // to return the remaining width on a given line (and the height of a single line). virtual LayoutUnit offsetLeft() const; diff --git a/engine/core/rendering/RenderInline.cpp b/engine/core/rendering/RenderInline.cpp index d3adb4eb3f9..b08d49b1f25 100644 --- a/engine/core/rendering/RenderInline.cpp +++ b/engine/core/rendering/RenderInline.cpp @@ -351,10 +351,6 @@ LayoutUnit RenderInline::marginAfter(const RenderStyle* otherStyle) const const char* RenderInline::renderName() const { - if (isRelPositioned()) - return "RenderInline (relative positioned)"; - if (isAnonymous()) - return "RenderInline (generated)"; return "RenderInline"; } @@ -584,21 +580,6 @@ LayoutRect RenderInline::linesVisualOverflowBoundingBox() const return rect; } -LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, const LayoutPoint& point, bool* offsetDependsOnPoint) const -{ - ASSERT(container == this->container()); - - LayoutSize offset; - if (isRelPositioned()) - offset += offsetForInFlowPosition(); - - // FIXME(sky): Remove now that it's always false? - if (offsetDependsOnPoint) - *offsetDependsOnPoint = false; - - return offset; -} - void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvalidationContainer, TransformState& transformState, MapCoordinatesFlags mode) const { if (paintInvalidationContainer == this) @@ -711,44 +692,6 @@ int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; } -LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const -{ - // FIXME: This function isn't right with mixed writing modes. - - ASSERT(isRelPositioned()); - if (!isRelPositioned()) - return LayoutSize(); - - // When we have an enclosing relpositioned inline, we need to add in the offset of the first line - // box from the rest of the content, but only in the cases where we know we're positioned - // relative to the inline itself. - - LayoutSize logicalOffset; - LayoutUnit inlinePosition; - LayoutUnit blockPosition; - if (firstLineBox()) { - inlinePosition = LayoutUnit::fromFloatRound(firstLineBox()->logicalLeft()); - blockPosition = firstLineBox()->logicalTop(); - } else { - inlinePosition = layer()->staticInlinePosition(); - blockPosition = layer()->staticBlockPosition(); - } - - // Per http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width an absolute positioned box - // with a static position should locate itself as though it is a normal flow box in relation to - // its containing block. If this relative-positioned inline has a negative offset we need to - // compensate for it so that we align the positioned object with the edge of its containing block. - if (child.style()->hasStaticInlinePosition()) - logicalOffset.setWidth(std::max(LayoutUnit(), -offsetForInFlowPosition().width())); - else - logicalOffset.setWidth(inlinePosition); - - if (!child.style()->hasStaticBlockPosition()) - logicalOffset.setHeight(blockPosition); - - return logicalOffset; -} - namespace { class AbsoluteRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteRectsGeneratorContext { diff --git a/engine/core/rendering/RenderInline.h b/engine/core/rendering/RenderInline.h index 85920450b44..2b8b19ebf92 100644 --- a/engine/core/rendering/RenderInline.h +++ b/engine/core/rendering/RenderInline.h @@ -58,8 +58,6 @@ public: virtual void absoluteQuads(Vector&) const override; - virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override final; - IntRect linesBoundingBox() const; LayoutRect linesVisualOverflowBoundingBox() const; @@ -76,8 +74,6 @@ public: InlineBox* firstLineBoxIncludingCulling() const { return alwaysCreateLineBoxes() ? firstLineBox() : culledInlineFirstLineBox(); } InlineBox* lastLineBoxIncludingCulling() const { return alwaysCreateLineBoxes() ? lastLineBox() : culledInlineLastLineBox(); } - LayoutSize offsetForInFlowPositionedInline(const RenderBox& child) const; - virtual void addFocusRingRects(Vector&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) const override final; bool alwaysCreateLineBoxes() const { return alwaysCreateLineBoxesForRenderInline(); } @@ -118,7 +114,7 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override final; - virtual LayerType layerTypeRequired() const override { return isRelPositioned() || createsGroup() || hasClipPath() ? NormalLayer : NoLayer; } + virtual LayerType layerTypeRequired() const override { return createsGroup() || hasClipPath() ? NormalLayer : NoLayer; } virtual LayoutUnit offsetLeft() const override final; virtual LayoutUnit offsetTop() const override final; diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index ed1bfc53964..c8ebe1c2d48 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -347,29 +347,12 @@ LayoutPoint RenderLayer::location() const } } - // Subtract our parent's scroll offset. - if (renderer()->isOutOfFlowPositioned() && enclosingPositionedAncestor()) { - RenderLayer* positionedParent = enclosingPositionedAncestor(); - - if (positionedParent->renderer()->isRelPositioned() && positionedParent->renderer()->isRenderInline()) { - LayoutSize offset = toRenderInline(positionedParent->renderer())->offsetForInFlowPositionedInline(*toRenderBox(renderer())); - localPoint += offset; - } - } - - localPoint.move(offsetForInFlowPosition()); - // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the renderers. localPoint -= inlineBoundingBoxOffset; return localPoint; } -const LayoutSize RenderLayer::offsetForInFlowPosition() const -{ - return renderer()->isRelPositioned() ? toRenderBoxModelObject(renderer())->offsetForInFlowPosition() : LayoutSize(); -} - TransformationMatrix RenderLayer::perspectiveTransform() const { if (!renderer()->hasTransform()) diff --git a/engine/core/rendering/RenderLayer.h b/engine/core/rendering/RenderLayer.h index 8abf19f17fb..5237928fcd9 100644 --- a/engine/core/rendering/RenderLayer.h +++ b/engine/core/rendering/RenderLayer.h @@ -120,9 +120,6 @@ public: void updateTransformationMatrix(); RenderLayer* renderingContextRoot(); - // Our current relative position offset. - const LayoutSize offsetForInFlowPosition() const; - RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.get(); } diff --git a/engine/core/rendering/RenderObject.h b/engine/core/rendering/RenderObject.h index 49343f18c76..0714f3a2526 100644 --- a/engine/core/rendering/RenderObject.h +++ b/engine/core/rendering/RenderObject.h @@ -308,7 +308,6 @@ public: } bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositioned(); } // absolute or fixed positioning - bool isRelPositioned() const { return m_bitfields.isRelPositioned(); } // relative positioning bool isPositioned() const { return m_bitfields.isPositioned(); } bool isText() const { return m_bitfields.isText(); } @@ -780,8 +779,6 @@ private: public: bool isOutOfFlowPositioned() const { return m_positionedState == IsOutOfFlowPositioned; } - // FIXME(sky): Remove - bool isRelPositioned() const { return false; } bool isPositioned() const { return m_positionedState != IsStaticallyPositioned; } void setPositionedState(int positionState) diff --git a/engine/core/rendering/line/BreakingContextInlineHeaders.h b/engine/core/rendering/line/BreakingContextInlineHeaders.h index 91796be46bf..6a9beb4b43a 100644 --- a/engine/core/rendering/line/BreakingContextInlineHeaders.h +++ b/engine/core/rendering/line/BreakingContextInlineHeaders.h @@ -198,10 +198,6 @@ inline void setStaticPositions(RenderBlockFlow* block, RenderBox* child) // inline so that we can obtain the value later. toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(false)); toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight); - - // If |child| is a leading or trailing positioned object this is its only opportunity to ensure it moves with an inline - // container changing width. - child->moveWithEdgeOfInlineContainerIfNecessary(); } block->updateStaticInlinePositionForChild(child); child->layer()->setStaticBlockPosition(blockHeight);