summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderFlexibleBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RenderFlexibleBox.cpp')
-rw-r--r--WebCore/rendering/RenderFlexibleBox.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index 659df8d..636c873 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -137,8 +137,8 @@ void RenderFlexibleBox::calcHorizontalPrefWidths()
marginRight += mr.value();
margin = marginLeft + marginRight;
- m_minPrefWidth += child->minPrefWidth() + margin;
- m_maxPrefWidth += child->maxPrefWidth() + margin;
+ m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin;
+ m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin;
}
}
@@ -160,39 +160,39 @@ void RenderFlexibleBox::calcVerticalPrefWidths()
if (mr.isFixed())
margin += mr.value();
- int w = child->minPrefWidth() + margin;
- m_minPrefWidth = max(w, m_minPrefWidth);
+ int w = child->minPreferredLogicalWidth() + margin;
+ m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
- w = child->maxPrefWidth() + margin;
- m_maxPrefWidth = max(w, m_maxPrefWidth);
+ w = child->maxPreferredLogicalWidth() + margin;
+ m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
}
}
-void RenderFlexibleBox::calcPrefWidths()
+void RenderFlexibleBox::computePreferredLogicalWidths()
{
- ASSERT(prefWidthsDirty());
+ ASSERT(preferredLogicalWidthsDirty());
if (style()->width().isFixed() && style()->width().value() > 0)
- m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
else {
- m_minPrefWidth = m_maxPrefWidth = 0;
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
if (hasMultipleLines() || isVertical())
calcVerticalPrefWidths();
else
calcHorizontalPrefWidths();
- m_maxPrefWidth = max(m_minPrefWidth, m_maxPrefWidth);
+ m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
}
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
- m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
- m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+ m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
}
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
- m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
- m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+ m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
}
int toAdd = borderAndPaddingWidth();
@@ -200,10 +200,10 @@ void RenderFlexibleBox::calcPrefWidths()
if (hasOverflowClip() && style()->overflowY() == OSCROLL)
toAdd += verticalScrollbarWidth();
- m_minPrefWidth += toAdd;
- m_maxPrefWidth += toAdd;
+ m_minPreferredLogicalWidth += toAdd;
+ m_maxPreferredLogicalWidth += toAdd;
- setPrefWidthsDirty(false);
+ setPreferredLogicalWidthsDirty(false);
}
void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXME: Implement */)
@@ -219,8 +219,8 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
int previousWidth = width();
int previousHeight = height();
- calcWidth();
- calcHeight();
+ computeLogicalWidth();
+ computeLogicalHeight();
m_overflow.clear();
@@ -251,7 +251,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
else
layoutVerticalBox(relayoutChildren);
- calcHeight();
+ computeLogicalHeight();
if (previousHeight != height())
relayoutChildren = true;
@@ -266,14 +266,14 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
// bottom margin max values to 0. This way we don't factor in the values
// twice when we collapse with our previous vertically adjacent and
// following vertically adjacent blocks.
- int pos = maxTopPosMargin();
- int neg = maxTopNegMargin();
- if (maxBottomPosMargin() > pos)
- pos = maxBottomPosMargin();
- if (maxBottomNegMargin() > neg)
- neg = maxBottomNegMargin();
- setMaxTopMargins(pos, neg);
- setMaxBottomMargins(0, 0);
+ int pos = maxPosMarginBefore();
+ int neg = maxNegMarginBefore();
+ if (maxPosMarginAfter() > pos)
+ pos = maxPosMarginAfter();
+ if (maxNegMarginAfter() > neg)
+ neg = maxNegMarginAfter();
+ setMaxMarginBeforeValues(pos, neg);
+ setMaxMarginAfterValues(0, 0);
}
// Add in the overflow from children.
@@ -372,7 +372,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
// Compute the child's vertical margins.
- child->calcVerticalMargins();
+ child->computeBlockDirectionMargins(this);
if (!child->needsLayout() && paginated && view()->layoutState()->m_pageHeight) {
RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
@@ -412,7 +412,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
setHeight(height() + toAdd);
oldHeight = height();
- calcHeight();
+ computeLogicalHeight();
relayoutChildren = false;
if (oldHeight != height())
@@ -444,7 +444,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
// fill the height of a containing box by default.
// Now do a layout.
int oldChildHeight = child->height();
- child->calcHeight();
+ child->computeLogicalHeight();
if (oldChildHeight != child->height())
child->setChildNeedsLayout(true, false);
@@ -643,7 +643,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
}
- // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
+ // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
setHeight(oldHeight);
@@ -713,7 +713,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
// Compute the child's vertical margins.
- child->calcVerticalMargins();
+ child->computeBlockDirectionMargins(this);
// Add in the child's marginTop to our height.
setHeight(height() + child->marginTop());
@@ -769,7 +769,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
// Now we have to calc our height, so we know how much space we have remaining.
oldHeight = height();
- calcHeight();
+ computeLogicalHeight();
if (oldHeight != height())
heightSpecified = true;
@@ -925,7 +925,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
}
}
- // So that the calcHeight in layoutBlock() knows to relayout positioned objects because of
+ // So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
setHeight(oldHeight);
@@ -1001,7 +1001,7 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
int totalWidth;
InlineBox* anchorBox = lastLine->lastChild();
if (anchorBox && anchorBox->renderer()->node() && anchorBox->renderer()->node()->isLink())
- totalWidth = anchorBox->width() + font.width(TextRun(ellipsisAndSpace, 2));
+ totalWidth = anchorBox->logicalWidth() + font.width(TextRun(ellipsisAndSpace, 2));
else {
anchorBox = 0;
totalWidth = font.width(TextRun(&horizontalEllipsis, 1));
@@ -1018,12 +1018,12 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
continue;
int ltr = true;
- int blockRightEdge = destBlock->rightOffset(lastVisibleLine->y(), false);
- int blockLeftEdge = destBlock->leftOffset(lastVisibleLine->y(), false);
+ int blockRightEdge = destBlock->logicalRightOffsetForLine(lastVisibleLine->y(), false);
+ int blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisibleLine->y(), false);
int blockEdge = ltr ? blockRightEdge : blockLeftEdge;
if (!lastVisibleLine->canAccommodateEllipsis(ltr, blockEdge,
- lastVisibleLine->x() + lastVisibleLine->width(),
+ lastVisibleLine->x() + lastVisibleLine->logicalWidth(),
totalWidth))
continue;
@@ -1062,9 +1062,9 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
child->style()->maxWidth().isFixed())
maxW = child->style()->maxWidth().value();
else if (child->style()->maxWidth().type() == Intrinsic)
- maxW = child->maxPrefWidth();
+ maxW = child->maxPreferredLogicalWidth();
else if (child->style()->maxWidth().type() == MinIntrinsic)
- maxW = child->minPrefWidth();
+ maxW = child->minPreferredLogicalWidth();
if (maxW == INT_MAX)
return maxW;
return max(0, maxW - w);
@@ -1083,14 +1083,14 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
// FIXME: For now just handle fixed values.
if (isHorizontal()) {
- int minW = child->minPrefWidth();
+ int minW = child->minPreferredLogicalWidth();
int w = child->overrideWidth() - child->borderAndPaddingWidth();
if (child->style()->minWidth().isFixed())
minW = child->style()->minWidth().value();
else if (child->style()->minWidth().type() == Intrinsic)
- minW = child->maxPrefWidth();
+ minW = child->maxPreferredLogicalWidth();
else if (child->style()->minWidth().type() == MinIntrinsic)
- minW = child->minPrefWidth();
+ minW = child->minPreferredLogicalWidth();
int allowedShrinkage = min(0, minW - w);
return allowedShrinkage;