summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
commitb1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch)
treec88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WebCore/rendering/RenderMultiColumnBlock.cpp
parentbe01689f43cf6882cf670d33df49ead1f570c53a (diff)
downloadqtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WebCore/rendering/RenderMultiColumnBlock.cpp')
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnBlock.cpp59
1 files changed, 58 insertions, 1 deletions
diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
index d7f43ff50..536d5fa22 100644
--- a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "RenderMultiColumnBlock.h"
#include "RenderMultiColumnFlowThread.h"
+#include "RenderMultiColumnSet.h"
using namespace std;
@@ -35,7 +36,8 @@ RenderMultiColumnBlock::RenderMultiColumnBlock(Node* node)
: RenderBlock(node)
, m_flowThread(0)
, m_columnCount(1)
- , m_columnWidth(0)
+ , m_columnWidth(ZERO_LAYOUT_UNIT)
+ , m_columnHeight(ZERO_LAYOUT_UNIT)
{
}
@@ -75,6 +77,33 @@ bool RenderMultiColumnBlock::recomputeLogicalWidth()
return relayoutChildren;
}
+void RenderMultiColumnBlock::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight)
+{
+ // We need to go ahead and set our explicit page height if one exists, so that we can
+ // avoid doing multiple layout passes.
+ computeLogicalHeight();
+ LayoutUnit newContentLogicalHeight = contentLogicalHeight();
+ if (newContentLogicalHeight > ZERO_LAYOUT_UNIT) {
+ pageLogicalHeight = newContentLogicalHeight;
+ hasSpecifiedPageLogicalHeight = true;
+ }
+ setLogicalHeight(ZERO_LAYOUT_UNIT);
+
+ if (columnHeight() != pageLogicalHeight && everHadLayout()) {
+ setColumnHeight(pageLogicalHeight);
+ pageLogicalHeightChanged = true;
+ }
+
+ // Set up our column sets.
+ ensureColumnSets();
+}
+
+bool RenderMultiColumnBlock::relayoutForPagination(bool, LayoutUnit, LayoutStateMaintainer&)
+{
+ // FIXME: Implement.
+ return false;
+}
+
void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild)
{
if (!m_flowThread) {
@@ -91,6 +120,34 @@ void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* befo
m_flowThread->addChild(newChild, beforeChild);
}
+void RenderMultiColumnBlock::ensureColumnSets()
+{
+ // This function ensures we have the correct column set information before we get into layout.
+ // 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 region.
+ //
+ // 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.
+ if (flowThread() && !firstChild()->isRenderMultiColumnSet()) {
+ RenderMultiColumnSet* columnSet = new (renderArena()) RenderMultiColumnSet(document(), flowThread());
+ columnSet->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
+ RenderBlock::addChild(columnSet, firstChild());
+ flowThread()->addRegionToThread(columnSet);
+ }
+}
+
const char* RenderMultiColumnBlock::renderName() const
{
if (isFloating())