Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1644)

Unified Diff: Source/core/rendering/RenderBox.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index df8ed0ed489547dd48791a0669b43ea0a78cb707..c50e7ac99656b5dbc8ff36dc4ec268f4c8d35c93 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -42,16 +42,13 @@
#include "core/rendering/HitTestResult.h"
#include "core/rendering/LayoutRectRecorder.h"
#include "core/rendering/PaintInfo.h"
-#include "core/rendering/RenderBoxRegionInfo.h"
#include "core/rendering/RenderFlexibleBox.h"
-#include "core/rendering/RenderFlowThread.h"
#include "core/rendering/RenderGeometryMap.h"
#include "core/rendering/RenderGrid.h"
#include "core/rendering/RenderInline.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderLayerCompositor.h"
#include "core/rendering/RenderListMarker.h"
-#include "core/rendering/RenderRegion.h"
#include "core/rendering/RenderTableCell.h"
#include "core/rendering/RenderTheme.h"
#include "core/rendering/RenderView.h"
@@ -106,52 +103,6 @@ RenderBox::~RenderBox()
{
}
-LayoutRect RenderBox::borderBoxRectInRegion(RenderRegion* region, RenderBoxRegionInfoFlags cacheFlag) const
-{
- if (!region)
- return borderBoxRect();
-
- // Compute the logical width and placement in this region.
- RenderBoxRegionInfo* boxInfo = renderBoxRegionInfo(region, cacheFlag);
- if (!boxInfo)
- return borderBoxRect();
-
- // We have cached insets.
- LayoutUnit logicalWidth = boxInfo->logicalWidth();
- LayoutUnit logicalLeft = boxInfo->logicalLeft();
-
- // Now apply the parent inset since it is cumulative whenever anything in the containing block chain shifts.
- // FIXME: Doesn't work right with perpendicular writing modes.
- const RenderBlock* currentBox = containingBlock();
- RenderBoxRegionInfo* currentBoxInfo = currentBox->renderBoxRegionInfo(region);
- while (currentBoxInfo && currentBoxInfo->isShifted()) {
- if (currentBox->style()->direction() == LTR)
- logicalLeft += currentBoxInfo->logicalLeft();
- else
- logicalLeft -= (currentBox->logicalWidth() - currentBoxInfo->logicalWidth()) - currentBoxInfo->logicalLeft();
- currentBox = currentBox->containingBlock();
- region = currentBox->clampToStartAndEndRegions(region);
- currentBoxInfo = currentBox->renderBoxRegionInfo(region);
- }
-
- if (cacheFlag == DoNotCacheRenderBoxRegionInfo)
- delete boxInfo;
-
- if (isHorizontalWritingMode())
- return LayoutRect(logicalLeft, 0, logicalWidth, height());
- return LayoutRect(0, logicalLeft, width(), logicalWidth);
-}
-
-void RenderBox::clearRenderBoxRegionInfo()
-{
- if (isRenderFlowThread())
- return;
-
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (flowThread)
- flowThread->removeRenderBoxRegionInfo(this);
-}
-
void RenderBox::willBeDestroyed()
{
clearOverrideSize();
@@ -602,12 +553,12 @@ void RenderBox::updateLayerTransform()
layer()->updateTransform();
}
-LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region) const
+LayoutUnit RenderBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb) const
{
RenderStyle* styleToUse = style();
if (!styleToUse->logicalMaxWidth().isUndefined())
- logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSize, styleToUse->logicalMaxWidth(), availableWidth, cb, region));
- return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUse->logicalMinWidth(), availableWidth, cb, region));
+ logicalWidth = min(logicalWidth, computeLogicalWidthUsing(MaxSize, styleToUse->logicalMaxWidth(), availableWidth, cb));
+ return max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse->logicalMinWidth(), availableWidth, cb));
}
LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit intrinsicContentHeight) const
@@ -1184,7 +1135,7 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
// Check our bounds next. For this purpose always assume that we can only be hit in the
// foreground phase (which is true for replaced elements like images).
- LayoutRect boundsRect = borderBoxRectInRegion(locationInContainer.region());
+ LayoutRect boundsRect = borderBoxRect();
boundsRect.moveBy(adjustedLocation);
if (visibleToHitTestRequest(request) && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
@@ -1260,7 +1211,7 @@ void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& pai
if (!paintInfo.shouldPaintWithinRoot(this))
return;
- LayoutRect paintRect = borderBoxRectInRegion(paintInfo.renderRegion);
+ LayoutRect paintRect = borderBoxRect();
paintRect.moveBy(paintOffset);
paintBoxDecorationsWithRect(paintInfo, paintOffset, paintRect);
}
@@ -1689,7 +1640,7 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
if (!isControlClip && !isOverflowClip)
return false;
- LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion);
+ LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset);
RoundedRect clipRoundedRect(0, 0, 0, 0);
bool hasBorderRadius = style()->hasBorderRadius();
if (hasBorderRadius)
@@ -1742,11 +1693,11 @@ void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
paintInfo.phase = originalPhase;
}
-LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy)
+LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, OverlayScrollbarSizeRelevancy relevancy)
{
// FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
// here.
- LayoutRect clipRect = borderBoxRectInRegion(region);
+ LayoutRect clipRect = borderBoxRect();
clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(), borderTop()));
clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
@@ -1761,25 +1712,22 @@ LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderRegion
return clipRect;
}
-LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region)
+LayoutRect RenderBox::clipRect(const LayoutPoint& location)
{
- LayoutRect borderBoxRect = borderBoxRectInRegion(region);
- LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size());
+ LayoutRect borderBox = borderBoxRect();
+ LayoutRect clipRect = LayoutRect(borderBox.location() + location, borderBox.size());
if (!style()->clipLeft().isAuto()) {
- LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
+ LayoutUnit c = valueForLength(style()->clipLeft(), borderBox.width());
clipRect.move(c, 0);
clipRect.contract(c, 0);
}
- // We don't use the region-specific border box's width and height since clip offsets are (stupidly) specified
- // from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
-
if (!style()->clipRight().isAuto())
clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0);
if (!style()->clipTop().isAuto()) {
- LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
+ LayoutUnit c = valueForLength(style()->clipTop(), borderBox.height());
clipRect.move(0, c);
clipRect.contract(0, c);
}
@@ -1790,17 +1738,10 @@ LayoutRect RenderBox::clipRect(const LayoutPoint& location, RenderRegion* region
return clipRect;
}
-LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlockFlow* cb, RenderRegion* region) const
+LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const
{
- RenderRegion* containingBlockRegion = 0;
LayoutUnit logicalTopPosition = logicalTop();
- if (region) {
- LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit();
- logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion);
- containingBlockRegion = cb->clampToStartAndEndRegions(region);
- }
-
- LayoutUnit result = cb->availableLogicalWidthForLineInRegion(logicalTopPosition, false, containingBlockRegion) - childMarginStart - childMarginEnd;
+ LayoutUnit result = cb->availableLogicalWidthForLine(logicalTopPosition, false) - childMarginStart - childMarginEnd;
// We need to see if margins on either the start side or the end side can contain the floats in question. If they can,
// then just using the line width is inaccurate. In the case where a float completely fits, we don't need to use the line
@@ -1808,9 +1749,9 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
// doesn't fit, we can use the line offset, but we need to grow it by the margin to reflect the fact that the margin was
// "consumed" by the float. Negative margins aren't consumed by the float, and so we ignore them.
if (childMarginStart > 0) {
- LayoutUnit startContentSide = cb->startOffsetForContent(containingBlockRegion);
+ LayoutUnit startContentSide = cb->startOffsetForContent();
LayoutUnit startContentSideWithMargin = startContentSide + childMarginStart;
- LayoutUnit startOffset = cb->startOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion);
+ LayoutUnit startOffset = cb->startOffsetForLine(logicalTopPosition, false);
if (startOffset > startContentSideWithMargin)
result += childMarginStart;
else
@@ -1818,9 +1759,9 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
}
if (childMarginEnd > 0) {
- LayoutUnit endContentSide = cb->endOffsetForContent(containingBlockRegion);
+ LayoutUnit endContentSide = cb->endOffsetForContent();
LayoutUnit endContentSideWithMargin = endContentSide + childMarginEnd;
- LayoutUnit endOffset = cb->endOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion);
+ LayoutUnit endOffset = cb->endOffsetForLine(logicalTopPosition, false);
if (endOffset > endContentSideWithMargin)
result += childMarginEnd;
else
@@ -1848,34 +1789,12 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei
return cb->availableLogicalHeight(heightType);
}
-LayoutUnit RenderBox::containingBlockLogicalWidthForContentInRegion(RenderRegion* region) const
-{
- if (!region)
- return containingBlockLogicalWidthForContent();
-
- RenderBlock* cb = containingBlock();
- RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region);
- // FIXME: It's unclear if a region's content should use the containing block's override logical width.
- // If it should, the following line should call containingBlockLogicalWidthForContent.
- LayoutUnit result = cb->availableLogicalWidth();
- RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(containingBlockRegion);
- if (!boxInfo)
- return result;
- return max<LayoutUnit>(0, result - (cb->logicalWidth() - boxInfo->logicalWidth()));
-}
-
-LayoutUnit RenderBox::containingBlockAvailableLineWidthInRegion(RenderRegion* region) const
+LayoutUnit RenderBox::containingBlockAvailableLineWidth() const
{
RenderBlock* cb = containingBlock();
- RenderRegion* containingBlockRegion = 0;
LayoutUnit logicalTopPosition = logicalTop();
- if (region) {
- LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit();
- logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion);
- containingBlockRegion = cb->clampToStartAndEndRegions(region);
- }
if (cb->isRenderBlockFlow())
- return toRenderBlockFlow(cb)->availableLogicalWidthForLineInRegion(logicalTopPosition, false, containingBlockRegion, availableLogicalHeight(IncludeMarginBorderPadding));
+ return toRenderBlockFlow(cb)->availableLogicalWidthForLine(logicalTopPosition, false, availableLogicalHeight(IncludeMarginBorderPadding));
return 0;
}
@@ -1977,13 +1896,7 @@ void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const
{
- // A region "has" boxes inside it without being their container.
- // FIXME: change container() / containingBlock() to count for boxes being positioned relative to the region, not the
- // FlowThread. This requires a separate patch as a simple test with such a change in container() causes 129 out of
- // 337 regions tests to fail.
- ASSERT(o == container() || o->isRenderRegion());
-
- LayoutSize offset;
+ LayoutSize offset;
if (isInFlowPositioned())
offset += offsetForInFlowPosition();
@@ -2010,9 +1923,6 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po
if (style()->position() == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline())
offset += toRenderInline(o)->offsetForInFlowPositionedInline(this);
- if (offsetDependsOnPoint)
- *offsetDependsOnPoint |= o->isRenderFlowThread();
-
return offset;
}
@@ -2223,7 +2133,7 @@ void RenderBox::repaintOverhangingFloats(bool)
void RenderBox::updateLogicalWidth()
{
LogicalExtentComputedValues computedValues;
- computeLogicalWidthInRegion(computedValues);
+ computeLogicalWidth(computedValues);
setLogicalWidth(computedValues.m_extent);
setLogicalLeft(computedValues.m_position);
@@ -2263,7 +2173,7 @@ static float getMaxWidthListMarker(const RenderBox* renderer)
return maxWidth;
}
-void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& computedValues, RenderRegion* region) const
+void RenderBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) const
{
computedValues.m_extent = logicalWidth();
computedValues.m_position = logicalLeft();
@@ -2273,7 +2183,7 @@ void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute
if (isOutOfFlowPositioned()) {
// FIXME: This calculation is not patched for block-flow yet.
// https://bugs.webkit.org/show_bug.cgi?id=46500
- computePositionedLogicalWidth(computedValues, region);
+ computePositionedLogicalWidth(computedValues);
return;
}
@@ -2300,7 +2210,7 @@ void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute
Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalWidth(), Fixed) : styleToUse->logicalWidth();
RenderBlock* cb = containingBlock();
- LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContentInRegion(region));
+ LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContent());
bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHorizontalWritingMode();
if (isInline() && !isInlineBlockOrInlineTable()) {
@@ -2319,8 +2229,8 @@ void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute
LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
if (hasPerpendicularContainingBlock)
containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
- LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb, region);
- computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region);
+ LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb);
+ computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
}
// Margin calculations.
@@ -2330,7 +2240,7 @@ void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& compute
} else {
LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth;
if (avoidsFloats() && cb->containsFloats())
- containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(region);
+ containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidth();
bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection();
computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, computedValues.m_extent,
hasInvertedDirection ? computedValues.m_margins.m_end : computedValues.m_margins.m_start,
@@ -2400,8 +2310,7 @@ LayoutUnit RenderBox::computeIntrinsicLogicalWidthUsing(Length logicalWidthLengt
return 0;
}
-LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Length logicalWidth, LayoutUnit availableLogicalWidth,
- const RenderBlock* cb, RenderRegion* region) const
+LayoutUnit RenderBox::computeLogicalWidthUsing(SizeType widthType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* cb) const
{
if (!logicalWidth.isIntrinsicOrAuto()) {
// FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead.
@@ -2416,7 +2325,7 @@ LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Lengt
LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd);
if (shrinkToAvoidFloats() && cb->containsFloats())
- logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, toRenderBlockFlow(cb), region));
+ logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, toRenderBlockFlow(cb)));
if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthType))
return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), logicalWidthResult));
@@ -2564,71 +2473,6 @@ void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, Layo
marginEnd = minimumValueForLength(marginEndLength, containerWidth);
}
-RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, RenderBoxRegionInfoFlags cacheFlag) const
-{
- // Make sure nobody is trying to call this with a null region.
- if (!region)
- return 0;
-
- // If we have computed our width in this region already, it will be cached, and we can
- // just return it.
- RenderBoxRegionInfo* boxInfo = region->renderBoxRegionInfo(this);
- if (boxInfo && cacheFlag == CacheRenderBoxRegionInfo)
- return boxInfo;
-
- // No cached value was found, so we have to compute our insets in this region.
- // FIXME: For now we limit this computation to normal RenderBlocks. Future patches will expand
- // support to cover all boxes.
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (isRenderFlowThread() || !flowThread || !canHaveBoxInfoInRegion() || flowThread->style()->writingMode() != style()->writingMode())
- return 0;
-
- LogicalExtentComputedValues computedValues;
- computeLogicalWidthInRegion(computedValues, region);
-
- // Now determine the insets based off where this object is supposed to be positioned.
- RenderBlock* cb = containingBlock();
- RenderRegion* clampedContainingBlockRegion = cb->clampToStartAndEndRegions(region);
- RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(clampedContainingBlockRegion);
- LayoutUnit containingBlockLogicalWidth = cb->logicalWidth();
- LayoutUnit containingBlockLogicalWidthInRegion = containingBlockInfo ? containingBlockInfo->logicalWidth() : containingBlockLogicalWidth;
-
- LayoutUnit marginStartInRegion = computedValues.m_margins.m_start;
- LayoutUnit startMarginDelta = marginStartInRegion - marginStart();
- LayoutUnit logicalWidthInRegion = computedValues.m_extent;
- LayoutUnit logicalLeftInRegion = computedValues.m_position;
- LayoutUnit widthDelta = logicalWidthInRegion - logicalWidth();
- LayoutUnit logicalLeftDelta = isOutOfFlowPositioned() ? logicalLeftInRegion - logicalLeft() : startMarginDelta;
- LayoutUnit logicalRightInRegion = containingBlockLogicalWidthInRegion - (logicalLeftInRegion + logicalWidthInRegion);
- LayoutUnit oldLogicalRight = containingBlockLogicalWidth - (logicalLeft() + logicalWidth());
- LayoutUnit logicalRightDelta = isOutOfFlowPositioned() ? logicalRightInRegion - oldLogicalRight : startMarginDelta;
-
- LayoutUnit logicalLeftOffset = 0;
-
- if (!isOutOfFlowPositioned() && avoidsFloats() && cb->containsFloats()) {
- LayoutUnit startPositionDelta = toRenderBlockFlow(cb)->computeStartPositionDeltaForChildAvoidingFloats(this, marginStartInRegion, region);
- if (cb->style()->isLeftToRightDirection())
- logicalLeftDelta += startPositionDelta;
- else
- logicalRightDelta += startPositionDelta;
- }
-
- if (cb->style()->isLeftToRightDirection())
- logicalLeftOffset += logicalLeftDelta;
- else
- logicalLeftOffset -= (widthDelta + logicalRightDelta);
-
- LayoutUnit logicalRightOffset = logicalWidth() - (logicalLeftOffset + logicalWidthInRegion);
- bool isShifted = (containingBlockInfo && containingBlockInfo->isShifted())
- || (style()->isLeftToRightDirection() && logicalLeftOffset)
- || (!style()->isLeftToRightDirection() && logicalRightOffset);
-
- // FIXME: Although it's unlikely, these boxes can go outside our bounds, and so we will need to incorporate them into overflow.
- if (cacheFlag == CacheRenderBoxRegionInfo)
- return region->setRenderBoxRegionInfo(this, logicalLeftOffset, logicalWidthInRegion, isShifted);
- return new RenderBoxRegionInfo(logicalLeftOffset, logicalWidthInRegion, isShifted);
-}
-
static bool shouldFlipBeforeAfterMargins(const RenderStyle* containingBlockStyle, const RenderStyle* childStyle)
{
ASSERT(containingBlockStyle->isHorizontalWritingMode() != childStyle->isHorizontalWritingMode());
@@ -3078,7 +2922,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
return logicalHeight() - borderAndPaddingLogicalHeight();
}
- if (h.isPercent() && isOutOfFlowPositioned() && !isRenderFlowThread()) {
+ if (h.isPercent() && isOutOfFlowPositioned()) {
// FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
@@ -3134,7 +2978,7 @@ void RenderBox::computeAndSetBlockDirectionMargins(const RenderBlock* containing
containingBlock->setMarginAfterForChild(this, marginAfter);
}
-LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* region, bool checkForPerpendicularWritingMode) const
+LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode) const
{
if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWritingMode() != isHorizontalWritingMode())
return containingBlockLogicalHeightForPositioned(containingBlock, false);
@@ -3148,30 +2992,8 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
}
}
- if (containingBlock->isBox()) {
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (!flowThread)
- return toRenderBox(containingBlock)->clientLogicalWidth();
-
- const RenderBlock* cb = toRenderBlock(containingBlock);
- RenderBoxRegionInfo* boxInfo = 0;
- if (!region) {
- if (containingBlock->isRenderFlowThread() && !checkForPerpendicularWritingMode)
- return toRenderFlowThread(containingBlock)->contentLogicalWidthOfFirstRegion();
- if (isWritingModeRoot()) {
- LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage();
- RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
- if (cbRegion) {
- cbRegion = cb->clampToStartAndEndRegions(cbRegion);
- boxInfo = cb->renderBoxRegionInfo(cbRegion);
- }
- }
- } else if (region && flowThread->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) {
- RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region);
- boxInfo = cb->renderBoxRegionInfo(containingBlockRegion);
- }
- return (boxInfo) ? max<LayoutUnit>(0, cb->clientLogicalWidth() - (cb->logicalWidth() - boxInfo->logicalWidth())) : cb->clientLogicalWidth();
- }
+ if (containingBlock->isBox())
+ return toRenderBox(containingBlock)->clientLogicalWidth();
ASSERT(containingBlock->isRenderInline() && containingBlock->isInFlowPositioned());
@@ -3199,7 +3021,7 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxMo
LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode) const
{
if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWritingMode() != isHorizontalWritingMode())
- return containingBlockLogicalWidthForPositioned(containingBlock, 0, false);
+ return containingBlockLogicalWidthForPositioned(containingBlock, false);
// Use viewport as container for top-level fixed-position elements.
if (style()->position() == FixedPosition && containingBlock->isRenderView()) {
@@ -3213,9 +3035,6 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
if (containingBlock->isBox()) {
const RenderBlock* cb = toRenderBlock(containingBlock);
LayoutUnit result = cb->clientLogicalHeight();
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (flowThread && containingBlock->isRenderFlowThread() && flowThread->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode())
- return toRenderFlowThread(containingBlock)->contentLogicalHeightOfFirstRegion();
return result;
}
@@ -3239,7 +3058,7 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForPositioned(const RenderBoxM
return heightResult;
}
-static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth, RenderRegion* region)
+static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth)
{
if (!logicalLeft.isAuto() || !logicalRight.isAuto())
return;
@@ -3252,13 +3071,6 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
staticPosition += toRenderBox(curr)->logicalLeft();
if (toRenderBox(curr)->isRelPositioned())
staticPosition += toRenderBox(curr)->relativePositionOffset().width();
- if (region && curr->isRenderBlock()) {
- const RenderBlock* cb = toRenderBlock(curr);
- region = cb->clampToStartAndEndRegions(region);
- RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region);
- if (boxInfo)
- staticPosition += boxInfo->logicalLeft();
- }
} else if (curr->isInline()) {
if (curr->isRelPositioned()) {
if (!curr->style()->logicalLeft().isAuto())
@@ -3281,17 +3093,6 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
}
if (curr == enclosingBox)
staticPosition -= enclosingBox->logicalWidth();
- if (region && curr->isRenderBlock()) {
- const RenderBlock* cb = toRenderBlock(curr);
- region = cb->clampToStartAndEndRegions(region);
- RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region);
- if (boxInfo) {
- if (curr != containerBlock)
- staticPosition -= cb->logicalWidth() - (boxInfo->logicalLeft() + boxInfo->logicalWidth());
- if (curr == enclosingBox)
- staticPosition += enclosingBox->logicalWidth() - boxInfo->logicalWidth();
- }
- }
} else if (curr->isInline()) {
if (curr->isRelPositioned()) {
if (!curr->style()->logicalLeft().isAuto())
@@ -3307,7 +3108,7 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
}
}
-void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues, RenderRegion* region) const
+void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues) const
{
if (isReplaced()) {
// FIXME: Positioned replaced elements inside a flow thread are not working properly
@@ -3336,7 +3137,7 @@ void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu
// relative positioned inline.
const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
- const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, region);
+ const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
// Use the container block's direction except when calculating the static distance
// This conforms with the reference results for abspos-replaced-width-margin-000.htm
@@ -3377,7 +3178,7 @@ void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu
// see FIXME 1
// Calculate the static distance if needed.
- computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, containerBlock, containerLogicalWidth, region);
+ computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, containerBlock, containerLogicalWidth);
// Calculate constraint equation values for 'width' case.
computePositionedLogicalWidthUsing(style()->logicalWidth(), containerBlock, containerDirection,
@@ -3420,25 +3221,6 @@ void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& compu
}
computedValues.m_extent += bordersPlusPadding;
-
- // Adjust logicalLeft if we need to for the flipped version of our writing mode in regions.
- // FIXME: Add support for other types of objects as containerBlock, not only RenderBlock.
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (flowThread && !region && isWritingModeRoot() && isHorizontalWritingMode() == containerBlock->isHorizontalWritingMode() && containerBlock->isRenderBlock()) {
- ASSERT(containerBlock->canHaveBoxInfoInRegion());
- LayoutUnit logicalLeftPos = computedValues.m_position;
- const RenderBlock* cb = toRenderBlock(containerBlock);
- LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage();
- RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
- if (cbRegion) {
- cbRegion = cb->clampToStartAndEndRegions(cbRegion);
- RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion);
- if (boxInfo) {
- logicalLeftPos += boxInfo->logicalLeft();
- computedValues.m_position = logicalLeftPos;
- }
- }
- }
}
static void computeLogicalLeftPositionedOffset(LayoutUnit& logicalLeftPos, const RenderBox* child, LayoutUnit logicalWidthValue, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalWidth)
@@ -3475,7 +3257,7 @@ void RenderBox::computePositionedLogicalWidthUsing(Length logicalWidth, const Re
LayoutUnit logicalLeftValue = 0;
- const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false);
+ const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false);
bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto();
bool logicalLeftIsAuto = logicalLeft.isAuto();
@@ -3749,25 +3531,6 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp
// Set final height value.
computedValues.m_extent += bordersPlusPadding;
-
- // Adjust logicalTop if we need to for perpendicular writing modes in regions.
- // FIXME: Add support for other types of objects as containerBlock, not only RenderBlock.
- RenderFlowThread* flowThread = flowThreadContainingBlock();
- if (flowThread && isHorizontalWritingMode() != containerBlock->isHorizontalWritingMode() && containerBlock->isRenderBlock()) {
- ASSERT(containerBlock->canHaveBoxInfoInRegion());
- LayoutUnit logicalTopPos = computedValues.m_position;
- const RenderBlock* cb = toRenderBlock(containerBlock);
- LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage() - logicalLeft();
- RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset);
- if (cbRegion) {
- cbRegion = cb->clampToStartAndEndRegions(cbRegion);
- RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion);
- if (boxInfo) {
- logicalTopPos += boxInfo->logicalLeft();
- computedValues.m_position = logicalTopPos;
- }
- }
- }
}
static void computeLogicalTopPositionedOffset(LayoutUnit& logicalTopPos, const RenderBox* child, LayoutUnit logicalHeightValue, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight)
@@ -3804,7 +3567,7 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength,
LayoutUnit logicalHeightValue;
LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding;
- const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false);
+ const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false);
LayoutUnit logicalTopValue = 0;
@@ -3935,7 +3698,7 @@ void RenderBox::computePositionedLogicalWidthReplaced(LogicalExtentComputedValue
const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock);
- const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false);
+ const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false);
// To match WinIE, in quirks mode use the parent's 'direction' property
// instead of the the container block's.
@@ -3967,7 +3730,7 @@ void RenderBox::computePositionedLogicalWidthReplaced(LogicalExtentComputedValue
* else if 'direction' is 'rtl', set 'right' to the static position.
\*-----------------------------------------------------------------------*/
// see FIXME 1
- computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock, containerLogicalWidth, 0); // FIXME: Pass the region.
+ computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock, containerLogicalWidth);
/*-----------------------------------------------------------------------*\
* 3. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left'
@@ -4103,7 +3866,7 @@ void RenderBox::computePositionedLogicalHeightReplaced(LogicalExtentComputedValu
const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container());
const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock);
- const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false);
+ const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false);
// Variables to solve.
Length marginBefore = style()->marginBefore();
@@ -4418,10 +4181,6 @@ void RenderBox::addVisualEffectOverflow()
void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta)
{
- // Never allow flow threads to propagate overflow up to a parent.
- if (child->isRenderFlowThread())
- return;
-
// Only propagate layout overflow from the child if the child isn't clipping its overflow. If it is, then
// its overflow is internal to it, and we don't care about it. layoutOverflowRectForPropagation takes care of this
// and just propagates the border box rect instead.
@@ -4910,7 +4669,7 @@ LayoutUnit RenderBox::offsetFromLogicalTopOfFirstPage() const
if (layoutState && !layoutState->isPaginated())
return 0;
- if (!layoutState && !flowThreadContainingBlock())
+ if (!layoutState)
return 0;
RenderBlock* containerBlock = containingBlock();
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698