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

Unified Diff: third_party/WebKit/WebCore/rendering/InlineFlowBox.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 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
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)
« no previous file with comments | « third_party/WebKit/WebCore/rendering/InlineFlowBox.h ('k') | third_party/WebKit/WebCore/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698