summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp')
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp71
1 files changed, 69 insertions, 2 deletions
diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
index 562506842..dfa017dcd 100644
--- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
@@ -26,17 +26,27 @@
#include "config.h"
#include "RenderMultiColumnFlowThread.h"
+#include "RenderMultiColumnBlock.h"
+#include "RenderMultiColumnSet.h"
+
namespace WebCore {
-RenderMultiColumnFlowThread::RenderMultiColumnFlowThread(Node* node)
- : RenderFlowThread(node)
+RenderMultiColumnFlowThread::RenderMultiColumnFlowThread()
{
+ setFlowThreadState(InsideInFlowThread);
}
RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread()
{
}
+RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Document* document)
+{
+ RenderMultiColumnFlowThread* renderer = new (document->renderArena()) RenderMultiColumnFlowThread();
+ renderer->setDocumentForAnonymous(document);
+ return renderer;
+}
+
const char* RenderMultiColumnFlowThread::renderName() const
{
return "RenderMultiColumnFlowThread";
@@ -49,4 +59,61 @@ void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight,
computedValues.m_position = logicalTop;
}
+LayoutUnit RenderMultiColumnFlowThread::initialLogicalWidth() const
+{
+ RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent());
+ return parentBlock->columnWidth();
+}
+
+void RenderMultiColumnFlowThread::autoGenerateRegionsToBlockOffset(LayoutUnit /*offset*/)
+{
+ // This function ensures we have the correct column set information at all times.
+ // For a simple multi-column layout in continuous media, only one column set child is required.
+ // Once a column is nested inside an enclosing pagination context, the number of column sets
+ // required becomes 2n-1, where n is the total number of nested pagination contexts. For example:
+ //
+ // Column layout with no enclosing pagination model = 2 * 1 - 1 = 1 column set.
+ // Columns inside pages = 2 * 2 - 1 = 3 column sets (bottom of first page, all the subsequent pages, then the last page).
+ // Columns inside columns inside pages = 2 * 3 - 1 = 5 column sets.
+ //
+ // In addition, column spans will force a column set to "split" into before/after sets around the spanning element.
+ //
+ // Finally, we will need to deal with columns inside regions. If regions have variable widths, then there will need
+ // to be unique column sets created inside any region whose width is different from its surrounding regions. This is
+ // actually pretty similar to the spanning case, in that we break up the column sets whenever the width varies.
+ //
+ // FIXME: For now just make one column set. This matches the old multi-column code.
+ // Right now our goal is just feature parity with the old multi-column code so that we can switch over to the
+ // new code as soon as possible.
+ RenderMultiColumnSet* firstSet = toRenderMultiColumnSet(firstRegion());
+ if (firstSet)
+ return;
+
+ invalidateRegions();
+
+ RenderMultiColumnBlock* parentBlock = toRenderMultiColumnBlock(parent());
+ firstSet = RenderMultiColumnSet::createAnonymous(this);
+ firstSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(parentBlock->style(), BLOCK));
+ parentBlock->RenderBlock::addChild(firstSet);
+
+ // Even though we aren't placed yet, we can go ahead and set up our size. At this point we're
+ // typically in the middle of laying out the thread, attempting to paginate, and we need to do
+ // some rudimentary "layout" of the set now, so that pagination will work.
+ firstSet->prepareForLayout();
+
+ validateRegions();
+}
+
+void RenderMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage)
+{
+ if (RenderMultiColumnSet* multicolSet = toRenderMultiColumnSet(regionAtBlockOffset(offset)))
+ multicolSet->recordSpaceShortage(spaceShortage);
+}
+
+void RenderMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight)
+{
+ if (RenderMultiColumnSet* multicolSet = toRenderMultiColumnSet(regionAtBlockOffset(offset)))
+ multicolSet->updateMinimumColumnHeight(minHeight);
+}
+
}