summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderFlexibleBox.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
commit5ea819f80c6840c492386bfafbffb059c7e2091f (patch)
tree42ad0b1d82eff090d14278a088ea0f4840a0f938 /Source/WebCore/rendering/RenderFlexibleBox.cpp
parent43a42f108af6bcbd91f2672731c3047c26213af1 (diff)
downloadqtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
Diffstat (limited to 'Source/WebCore/rendering/RenderFlexibleBox.cpp')
-rw-r--r--Source/WebCore/rendering/RenderFlexibleBox.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp
index 86e655e89..ee425b3f4 100644
--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp
@@ -235,18 +235,22 @@ void RenderFlexibleBox::computePreferredLogicalWidths()
setPreferredLogicalWidthsDirty(false);
}
-LayoutUnit RenderFlexibleBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
+static int synthesizedBaselineFromContentBox(const RenderBox* box, LineDirectionMode direction)
{
- LayoutUnit baseline = firstLineBoxBaseline();
- if (baseline != -1) {
- LayoutUnit marginAscent = direction == HorizontalLine ? marginTop() : marginRight();
- return baseline + marginAscent;
- }
+ return direction == HorizontalLine ? box->borderTop() + box->paddingTop() + box->contentHeight() : box->borderRight() + box->paddingRight() + box->contentWidth();
+}
+
+int RenderFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode direction, LinePositionMode) const
+{
+ int baseline = firstLineBoxBaseline();
+ if (baseline == -1)
+ baseline = synthesizedBaselineFromContentBox(this, direction);
- return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
+ int marginAscent = direction == HorizontalLine ? marginTop() : marginRight();
+ return baseline + marginAscent;
}
-LayoutUnit RenderFlexibleBox::firstLineBoxBaseline() const
+int RenderFlexibleBox::firstLineBoxBaseline() const
{
ASSERT(m_orderIterator);
@@ -273,13 +277,27 @@ LayoutUnit RenderFlexibleBox::firstLineBoxBaseline() const
if (isColumnFlow() && !hasOrthogonalFlow(baselineChild))
return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop();
- LayoutUnit baseline = baselineChild->firstLineBoxBaseline();
- if (baseline == -1)
- return -1;
+ int baseline = baselineChild->firstLineBoxBaseline();
+ if (baseline == -1) {
+ // FIXME: We should pass |direction| into firstLineBoxBaseline and stop bailing out if we're a writing mode root.
+ // This would also fix some cases where the flexbox is orthogonal to its container.
+ LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
+ return synthesizedBaselineFromContentBox(baselineChild, direction) + baselineChild->logicalTop();
+ }
return baseline + baselineChild->logicalTop();
}
+int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const
+{
+ int baseline = firstLineBoxBaseline();
+ if (baseline != -1)
+ return baseline;
+
+ int marginAscent = direction == HorizontalLine ? marginTop() : marginRight();
+ return synthesizedBaselineFromContentBox(this, direction) + marginAscent;
+}
+
void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
{
ASSERT(needsLayout());
@@ -407,7 +425,7 @@ bool RenderFlexibleBox::isLeftToRightFlow() const
bool RenderFlexibleBox::isMultiline() const
{
- return style()->flexWrap() != FlexWrapNone;
+ return style()->flexWrap() != FlexNoWrap;
}
Length RenderFlexibleBox::flexBasisForChild(RenderBox* child) const