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

Unified Diff: Source/core/rendering/RenderMultiColumnFlowThread.h

Issue 584033002: [New Multicolumn] Add support for column-span:all (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix ref in test. Tables don't do subpixel, and that made a difference on Windows and Mac. Created 6 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderFlowThread.cpp ('k') | Source/core/rendering/RenderMultiColumnFlowThread.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnFlowThread.h
diff --git a/Source/core/rendering/RenderMultiColumnFlowThread.h b/Source/core/rendering/RenderMultiColumnFlowThread.h
index 18841e3cc970d0ecb28232c0b9b9b056d1f9791c..4dbe0c644b541bc02bed00127baf0b1f630362a3 100644
--- a/Source/core/rendering/RenderMultiColumnFlowThread.h
+++ b/Source/core/rendering/RenderMultiColumnFlowThread.h
@@ -28,10 +28,12 @@
#define RenderMultiColumnFlowThread_h
#include "core/rendering/RenderFlowThread.h"
+#include "wtf/HashMap.h"
namespace blink {
class RenderMultiColumnSet;
+class RenderMultiColumnSpannerSet;
// Flow thread implementation for CSS multicol. This will be inserted as an anonymous child block of
// the actual multicol container (i.e. the RenderBlockFlow whose style computes to non-auto
@@ -51,17 +53,24 @@ class RenderMultiColumnSet;
// container. It's the RenderMultiColumnSet objects that take up the necessary amount of space, and
// make sure that the columns are painted and hit-tested correctly.
//
+// If there is any column content inside the multicol container, we create a
+// RenderMultiColumnSet. We only need to create multiple sets if there are spanners
+// (column-span:all) in the multicol container. When a spanner is inserted, content preceding it
+// gets its own set, and content succeeding it will get another set. The spanner itself will also
+// get its own set (RenderMultiColumnSpannerSet).
+//
// The width of the flow thread is the same as the column width. The width of a column set is the
// same as the content box width of the multicol container; in other words exactly enough to hold
// the number of columns to be used, stacked horizontally, plus column gaps between them.
//
// Since it's the first child of the multicol container, the flow thread is laid out first, albeit
// in a slightly special way, since it's not to take up any space in its ancestors. Afterwards, the
-// column sets are laid out. They get their height from the columns that they hold. In single
-// column-row constrained height non-balancing cases this will simply be the same as the content
-// height of the multicol container itself. In most other cases we'll have to calculate optimal
-// column heights ourselves, though. This process is referred to as column balancing, and then we
-// infer the column set height from the flow thread's height.
+// column sets are laid out. Column sets get their height from the columns that they hold. In single
+// column-row constrained height non-balancing cases without spanners this will simply be the same
+// as the content height of the multicol container itself. In most other cases we'll have to
+// calculate optimal column heights ourselves, though. This process is referred to as column
+// balancing, and then we infer the column set height from the height of the flow thread portion
+// occupied by each set.
//
// More on column balancing: the columns' height is unknown in the first layout pass when
// balancing. This means that we cannot insert any implicit (soft / unforced) breaks (and pagination
@@ -97,7 +106,12 @@ public:
RenderMultiColumnSet* firstMultiColumnSet() const;
RenderMultiColumnSet* lastMultiColumnSet() const;
- virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
+ // Find the first set inside which the specified renderer would be rendered.
+ RenderMultiColumnSet* findSetRendering(RenderObject*) const;
+
+ // Return the spanner set (if any) that contains the specified renderer. This includes the
+ // renderer for the element that actually establishes the spanner too.
+ RenderMultiColumnSpannerSet* containingColumnSpanner(const RenderObject* descendant) const;
// Populate the flow thread with what's currently its siblings. Called when a regular block
// becomes a multicol container.
@@ -111,7 +125,6 @@ public:
unsigned columnCount() const { return m_columnCount; }
LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; }
void setColumnHeightAvailable(LayoutUnit available) { m_columnHeightAvailable = available; }
- virtual bool heightIsAuto() const { return !columnHeightAvailable() || multiColumnBlockFlow()->style()->columnFill() == ColumnFillBalance; }
bool progressionIsInline() const { return m_progressionIsInline; }
virtual LayoutSize columnOffset(const LayoutPoint&) const override final;
@@ -131,10 +144,18 @@ protected:
private:
void calculateColumnCountAndWidth(LayoutUnit& width, unsigned& count) const;
+ virtual bool isDescendantValidColumnSpanner(RenderObject* descendant) const;
virtual const char* renderName() const override;
virtual void addRegionToThread(RenderMultiColumnSet*) override;
virtual void willBeRemovedFromTree() override;
+ virtual bool isColumnSpanner(const RenderObject*) const override;
+ virtual bool isInsideColumnSpanner(const RenderObject*) const override final;
+ virtual LayoutUnit enterColumnSpanner(RenderBox*, LayoutUnit logicalTop, SubtreeLayoutScope&) override;
+ virtual void leaveColumnSpanner(RenderBox*, LayoutUnit logicalBottom) override;
+ virtual void flowThreadDescendantInserted(RenderObject*) override;
+ virtual void flowThreadDescendantWillBeRemoved(RenderObject*) override;
+ virtual void flowThreadDescendantStyleDidChange(RenderObject*) override;
virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const override;
virtual void updateLogicalWidth() override;
virtual void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage) override;
@@ -143,11 +164,20 @@ private:
virtual bool addForcedRegionBreak(LayoutUnit, RenderObject* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0) override;
virtual bool isPageLogicalHeightKnown() const override;
+ typedef HashMap<const RenderObject*, RenderMultiColumnSpannerSet*> SpannerMap;
+ SpannerMap m_spannerMap;
+
+ // The last set we worked on. It's not to be used as the "current set". The concept of a
+ // "current set" is difficult, since layout may jump back and forth in the tree, due to wrong
+ // top location estimates (due to e.g. margin collapsing), and possibly for other reasons.
+ RenderMultiColumnSet* m_lastSetWorkedOn;
+
unsigned m_columnCount; // The used value of column-count
LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto.
bool m_inBalancingPass; // Set when relayouting for column balancing.
bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate the column set heights after layout.
bool m_progressionIsInline; // Always true for regular multicol. False for paged-y overflow.
+ bool m_beingEvacuated;
};
} // namespace blink
« no previous file with comments | « Source/core/rendering/RenderFlowThread.cpp ('k') | Source/core/rendering/RenderMultiColumnFlowThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698