Index: third_party/WebKit/WebCore/rendering/InlineFlowBox.cpp |
=================================================================== |
--- third_party/WebKit/WebCore/rendering/InlineFlowBox.cpp (revision 9391) |
+++ third_party/WebKit/WebCore/rendering/InlineFlowBox.cpp (working copy) |
@@ -55,26 +55,14 @@ |
{ |
if (!includeLeftEdge()) |
return 0; |
- |
- Length margin = object()->style()->marginLeft(); |
- if (margin.isAuto()) |
- return 0; |
- if (margin.isFixed()) |
- return margin.value(); |
- return renderBox()->marginLeft(); |
+ return boxModelObject()->marginLeft(); |
} |
int InlineFlowBox::marginRight() |
{ |
if (!includeRightEdge()) |
return 0; |
- |
- Length margin = object()->style()->marginRight(); |
- if (margin.isAuto()) |
- return 0; |
- if (margin.isFixed()) |
- return margin.value(); |
- return renderBox()->marginRight(); |
+ return boxModelObject()->marginRight(); |
} |
int InlineFlowBox::marginBorderPaddingLeft() |
@@ -330,7 +318,7 @@ |
leftPosition = min(x + visualOverflowLeft, leftPosition); |
rightPosition = max(x + text->width() + visualOverflowRight, rightPosition); |
- m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), m_maxHorizontalVisualOverflow); |
+ m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), (int)m_maxHorizontalVisualOverflow); |
x += text->width(); |
} else { |
if (curr->object()->isPositioned()) { |
@@ -349,11 +337,11 @@ |
x = flow->placeBoxesHorizontally(x, leftPosition, rightPosition, needsWordSpacing); |
x += flow->marginRight(); |
} else if (!curr->object()->isListMarker() || static_cast<RenderListMarker*>(curr->object())->isInside()) { |
- x += curr->renderBox()->marginLeft(); |
+ x += curr->boxModelObject()->marginLeft(); |
curr->setXPos(x); |
- leftPosition = min(x + curr->renderBox()->overflowLeft(false), leftPosition); |
- rightPosition = max(x + curr->renderBox()->overflowWidth(false), rightPosition); |
- x += curr->width() + curr->renderBox()->marginRight(); |
+ leftPosition = min(x + toRenderBox(curr->object())->overflowLeft(false), leftPosition); |
+ rightPosition = max(x + toRenderBox(curr->object())->overflowWidth(false), rightPosition); |
+ x += curr->width() + curr->boxModelObject()->marginRight(); |
} |
} |
} |
@@ -457,6 +445,8 @@ |
if (curr->object()->isPositioned()) |
continue; // Positioned placeholders don't affect calculations. |
+ bool isInlineFlow = curr->isInlineFlowBox(); |
+ |
curr->setHeight(curr->object()->lineHeight(m_firstLine)); |
curr->setBaseline(curr->object()->baselinePosition(m_firstLine)); |
curr->setYPos(curr->object()->verticalPositionHint(m_firstLine)); |
@@ -468,7 +458,7 @@ |
if (maxPositionBottom < curr->height()) |
maxPositionBottom = curr->height(); |
} |
- else if (curr->hasTextChildren() || curr->renderBox()->hasHorizontalBordersOrPadding() || strictMode) { |
+ else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasHorizontalBordersOrPadding() || strictMode) { |
int ascent = curr->baseline() - curr->yPos(); |
int descent = curr->height() - ascent; |
if (maxAscent < ascent) |
@@ -494,7 +484,8 @@ |
// Adjust boxes to use their real box y/height and not the logical height (as dictated by |
// line-height). |
- if (curr->isInlineFlowBox()) |
+ bool isInlineFlow = curr->isInlineFlowBox(); |
+ if (isInlineFlow) |
static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom); |
bool childAffectsTopBottomPos = true; |
@@ -503,7 +494,7 @@ |
else if (curr->yPos() == PositionBottom) |
curr->setYPos(y + maxHeight - curr->height()); |
else { |
- if (!curr->hasTextChildren() && !curr->renderBox()->hasHorizontalBordersOrPadding() && !strictMode) |
+ if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode) |
childAffectsTopBottomPos = false; |
curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline()); |
} |
@@ -534,21 +525,23 @@ |
} |
if (curr->object()->hasReflection()) { |
- overflowTop = min(overflowTop, curr->renderBox()->reflectionBox().y()); |
- overflowBottom = max(overflowBottom, curr->renderBox()->reflectionBox().bottom()); |
+ RenderBox* box = toRenderBox(curr->object()); |
+ overflowTop = min(overflowTop, box->reflectionBox().y()); |
+ overflowBottom = max(overflowBottom, box->reflectionBox().bottom()); |
} |
if (curr->isInlineFlowBox()) { |
- newHeight += curr->renderBox()->borderTop() + curr->renderBox()->paddingTop() + |
- curr->renderBox()->borderBottom() + curr->renderBox()->paddingBottom(); |
- newY -= curr->renderBox()->borderTop() + curr->renderBox()->paddingTop(); |
- newBaseline += curr->renderBox()->borderTop() + curr->renderBox()->paddingTop(); |
+ newHeight += curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop() + |
+ curr->boxModelObject()->borderBottom() + curr->boxModelObject()->paddingBottom(); |
+ newY -= curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop(); |
+ newBaseline += curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop(); |
} |
} else if (!curr->object()->isBR()) { |
- newY += curr->renderBox()->marginTop(); |
- newHeight = curr->height() - (curr->renderBox()->marginTop() + curr->renderBox()->marginBottom()); |
- overflowTop = curr->renderBox()->overflowTop(false); |
- overflowBottom = curr->renderBox()->overflowHeight(false) - newHeight; |
+ RenderBox* box = toRenderBox(curr->object()); |
+ newY += box->marginTop(); |
+ newHeight = curr->height() - (box->marginTop() + box->marginBottom()); |
+ overflowTop = box->overflowTop(false); |
+ overflowBottom = box->overflowHeight(false) - newHeight; |
} |
curr->setYPos(newY); |
@@ -587,7 +580,7 @@ |
} |
// See if we have text children. If not, then we need to shrink ourselves to fit on the line. |
- if (!hasTextChildren() && !renderBox()->hasHorizontalBordersOrPadding()) { |
+ if (!hasTextChildren() && !boxModelObject()->hasHorizontalBordersOrPadding()) { |
if (yPos() < topPos) |
setYPos(topPos); |
if (yPos() + height() > bottomPos) |