From 86ed666dc277c413ab659d0e5dcc2b2b1739a4e4 Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Wed, 29 Oct 2014 19:53:05 -0700 Subject: [PATCH] Get rid of isWritingModeRoot. This function always returns false now that we don't have writing modes. TBR=esprehn@chromium.org Remove flipForWritingMode. It's a noop now that we don't have writing modes. Review URL: https://codereview.chromium.org/688223002 --- engine/core/rendering/RenderBlock.cpp | 41 +++++---------------- engine/core/rendering/RenderBlockFlow.cpp | 13 ++----- engine/core/rendering/RenderBox.cpp | 2 +- engine/core/rendering/RenderBox.h | 2 - engine/core/rendering/RenderFlexibleBox.cpp | 2 +- 5 files changed, 15 insertions(+), 45 deletions(-) diff --git a/engine/core/rendering/RenderBlock.cpp b/engine/core/rendering/RenderBlock.cpp index e5b4a3d1dcd..ecfc21fc87e 100644 --- a/engine/core/rendering/RenderBlock.cpp +++ b/engine/core/rendering/RenderBlock.cpp @@ -1083,8 +1083,7 @@ void RenderBlock::addOverflowFromPositionedObjects() bool RenderBlock::createsBlockFormattingContext() const { - return isInlineBlock() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() - || isWritingModeRoot() || isDocumentElement(); + return isInlineBlock() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() || isDocumentElement(); } void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox* child) @@ -1542,7 +1541,7 @@ bool RenderBlock::isSelectionRoot() const if (isDocumentElement() || hasOverflowClip() || isPositioned() || isFloating() || isInlineBlock() - || hasTransform() || hasMask() || isWritingModeRoot() + || hasTransform() || hasMask() || isFlexItemIncludingDeprecated()) return true; @@ -2571,7 +2570,7 @@ int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin // We also give up on finding a baseline if we have a vertical scrollbar, or if we are scrolled // vertically (e.g., an overflow:hidden block that has had scrollTop moved). bool ignoreBaseline = (layer() && layer()->scrollableArea() && ((direction == HorizontalLine ? (layer()->scrollableArea()->verticalScrollbar() || layer()->scrollableArea()->scrollYOffset()) - : (layer()->scrollableArea()->horizontalScrollbar() || layer()->scrollableArea()->scrollXOffset())))) || isWritingModeRoot(); + : (layer()->scrollableArea()->horizontalScrollbar() || layer()->scrollableArea()->scrollXOffset())))); int baselinePos = ignoreBaseline ? -1 : inlineBlockBaseline(direction); @@ -2599,9 +2598,6 @@ LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, Layou int RenderBlock::firstLineBoxBaseline() const { - if (isWritingModeRoot()) - return -1; - if (childrenInline()) { if (firstLineBox()) return firstLineBox()->logicalTop() + style(true)->fontMetrics().ascent(firstRootBox()->baselineType()); @@ -2633,9 +2629,6 @@ int RenderBlock::inlineBlockBaseline(LineDirectionMode direction) const int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const { - if (isWritingModeRoot()) - return -1; - if (childrenInline()) { if (!firstLineBox() && hasLineIfEmpty()) { const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); @@ -2934,40 +2927,24 @@ RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* par LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox* child) const { - // If the child has the same directionality as we do, then we can just return its - // collapsed margin. - if (!child->isWritingModeRoot()) - return child->collapsedMarginBefore(); - return child->collapsedMarginAfter(); + // FIXME(sky): Remove + return child->collapsedMarginBefore(); } LayoutUnit RenderBlock::collapsedMarginAfterForChild(const RenderBox* child) const { - // If the child has the same directionality as we do, then we can just return its - // collapsed margin. - if (!child->isWritingModeRoot()) - return child->collapsedMarginAfter(); - return child->collapsedMarginBefore(); + // FIXME(sky): Remove + return child->collapsedMarginAfter(); } bool RenderBlock::hasMarginBeforeQuirk(const RenderBox* child) const { - // If the child has the same directionality as we do, then we can just return its - // margin quirk. - if (!child->isWritingModeRoot()) - return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQuirk() : child->style()->hasMarginBeforeQuirk(); - - return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuirk() : child->style()->hasMarginAfterQuirk(); + return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQuirk() : child->style()->hasMarginBeforeQuirk(); } bool RenderBlock::hasMarginAfterQuirk(const RenderBox* child) const { - // If the child has the same directionality as we do, then we can just return its - // margin quirk. - if (!child->isWritingModeRoot()) - return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuirk() : child->style()->hasMarginAfterQuirk(); - - return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQuirk() : child->style()->hasMarginBeforeQuirk(); + return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuirk() : child->style()->hasMarginAfterQuirk(); } const char* RenderBlock::renderName() const diff --git a/engine/core/rendering/RenderBlockFlow.cpp b/engine/core/rendering/RenderBlockFlow.cpp index ba63119c086..d68c9c64721 100644 --- a/engine/core/rendering/RenderBlockFlow.cpp +++ b/engine/core/rendering/RenderBlockFlow.cpp @@ -394,8 +394,7 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, if (childRenderBlockFlow) { if (markDescendantsWithFloats) childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); - if (!child->isWritingModeRoot()) - previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); + previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); } SubtreeLayoutScope layoutScope(*child); @@ -864,7 +863,7 @@ void RenderBlockFlow::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& return; RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); - if (childBlockFlow->childrenInline() || childBlockFlow->isWritingModeRoot()) + if (childBlockFlow->childrenInline()) return; MarginInfo childMarginInfo(childBlockFlow, childBlockFlow->borderBefore() + childBlockFlow->paddingBefore(), childBlockFlow->borderAfter() + childBlockFlow->paddingAfter()); @@ -1063,18 +1062,14 @@ bool RenderBlockFlow::mustSeparateMarginBeforeForChild(const RenderBox* child) c { ASSERT(!child->selfNeedsLayout()); const RenderStyle* childStyle = child->style(); - if (!child->isWritingModeRoot()) - return childStyle->marginBeforeCollapse() == MSEPARATE; - return childStyle->marginAfterCollapse() == MSEPARATE; + return childStyle->marginBeforeCollapse() == MSEPARATE; } bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) const { ASSERT(!child->selfNeedsLayout()); const RenderStyle* childStyle = child->style(); - if (!child->isWritingModeRoot()) - return childStyle->marginAfterCollapse() == MSEPARATE; - return childStyle->marginBeforeCollapse() == MSEPARATE; + return childStyle->marginAfterCollapse() == MSEPARATE; } void RenderBlockFlow::addOverflowFromFloats() diff --git a/engine/core/rendering/RenderBox.cpp b/engine/core/rendering/RenderBox.cpp index f504043380f..b9e708956ad 100644 --- a/engine/core/rendering/RenderBox.cpp +++ b/engine/core/rendering/RenderBox.cpp @@ -3462,7 +3462,7 @@ static bool isReplacedElement(Node* node) bool RenderBox::avoidsFloats() const { - return isReplaced() || isReplacedElement(node()) || hasOverflowClip() || isWritingModeRoot() || isFlexItemIncludingDeprecated(); + return isReplaced() || isReplacedElement(node()) || hasOverflowClip() || isFlexItemIncludingDeprecated(); } InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelObject& paintInvalidationContainer, diff --git a/engine/core/rendering/RenderBox.h b/engine/core/rendering/RenderBox.h index 0571320d95b..58aa088a7a0 100644 --- a/engine/core/rendering/RenderBox.h +++ b/engine/core/rendering/RenderBox.h @@ -509,8 +509,6 @@ public: bool shrinkToAvoidFloats() const; virtual bool avoidsFloats() const; - bool isWritingModeRoot() const { return false; } - bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBox(); } virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override; diff --git a/engine/core/rendering/RenderFlexibleBox.cpp b/engine/core/rendering/RenderFlexibleBox.cpp index a5ff46abfd5..076655c5e97 100644 --- a/engine/core/rendering/RenderFlexibleBox.cpp +++ b/engine/core/rendering/RenderFlexibleBox.cpp @@ -142,7 +142,7 @@ int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di int RenderFlexibleBox::firstLineBoxBaseline() const { - if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0) + if (m_numberOfInFlowChildrenOnFirstLine <= 0) return -1; RenderBox* baselineChild = 0; int childNumber = 0;