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

Side by Side Diff: Source/core/rendering/RenderMultiColumnFlowThread.h

Issue 267373005: [New Multicolumn] Use the term "content run" in favor of "forced break". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/rendering/RenderMultiColumnFlowThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // "region" children, which are used to position the columns visually. The flow thread is in charge 43 // "region" children, which are used to position the columns visually. The flow thread is in charge
44 // of layout, and, after having calculated the column width, it lays out content as if everything 44 // of layout, and, after having calculated the column width, it lays out content as if everything
45 // were in one tall single column, except that there will typically be some amou nt of blank space 45 // were in one tall single column, except that there will typically be some amou nt of blank space
46 // (also known as pagination struts) at the offsets where the actual column boun daries are. This 46 // (also known as pagination struts) at the offsets where the actual column boun daries are. This
47 // way, content that needs to be preceded by a break will appear at the top of t he next 47 // way, content that needs to be preceded by a break will appear at the top of t he next
48 // column. Content needs to be preceded by a break when there's a forced break o r when the content 48 // column. Content needs to be preceded by a break when there's a forced break o r when the content
49 // is unbreakable and cannot fully fit in the same column as the preceding piece of 49 // is unbreakable and cannot fully fit in the same column as the preceding piece of
50 // content. Although a RenderMultiColumnFlowThread is laid out, it does not take up any space in its 50 // content. Although a RenderMultiColumnFlowThread is laid out, it does not take up any space in its
51 // container. It's the RenderMultiColumnSet objects that take up the necessary a mount of space, and 51 // container. It's the RenderMultiColumnSet objects that take up the necessary a mount of space, and
52 // make sure that the columns are painted and hit-tested correctly. 52 // make sure that the columns are painted and hit-tested correctly.
53 //
54 // The width of the flow thread is the same as the column width. The width of a column set is the
55 // same as the content box width of the multicol container; in other words exact ly enough to hold
56 // the number of columns to be used, stacked horizontally, plus column gaps betw een them.
57 //
58 // Since it's the first child of the multicol container, the flow thread is laid out first, albeit
59 // in a slightly special way, since it's not to take up any space in its ancesto rs. Afterwards, the
60 // column sets are laid out. They get their height from the columns that they ho ld. In single
61 // column-row constrained height non-balancing cases this will simply be the sam e as the content
62 // height of the multicol container itself. In most other cases we'll have to ca lculate optimal
63 // column heights ourselves, though. This process is referred to as column balan cing, and then we
64 // infer the column set height from the flow thread's height.
65 //
66 // More on column balancing: the columns' height is unknown in the first layout pass when
67 // balancing. This means that we cannot insert any implicit (soft / unforced) br eaks (and pagination
68 // struts) when laying out the contents of the flow thread. We'll just lay out e verything in tall
69 // single strip. After the initial flow thread layout pass we can determine a te ntative / minimal /
70 // initial column height. This is calculated by simply dividing the flow thread' s height by the
71 // number of specified columns. In the layout pass that follows, we can insert b reaks (and
72 // pagination struts) at column boundaries, since we now have a column height. I t may very easily
73 // turn out that the calculated height wasn't enough, though. We'll notice this at end of layout. If
74 // we end up with too many columns (i.e. columns overflowing the multicol contai ner), it wasn't
75 // enough. In this case we need to increase the column heights. We'll increase t hem by the lowest
76 // amount of space that could possibly affect where the breaks occur (see
77 // RenderMultiColumnSet::recordSpaceShortage()). We'll relayout (to find new bre ak points and the
78 // new lowest amount of space increase that could affect where they occur, in ca se we need another
79 // round) until we've reached an acceptable height (where everything fits perfec tly in the number of
80 // columns that we have specified). The rule of thumb is that we shouldn't have to perform more of
81 // such iterations than the number of columns that we have.
82 //
83 // For each layout iteration done for column balancing, the flow thread will nee d a deep layout if
84 // column heights changed in the previous pass, since column height changes may affect break points
85 // and pagination struts anywhere in the tree, and currently no way exists to do this in a more
86 // optimized manner.
53 class RenderMultiColumnFlowThread FINAL : public RenderFlowThread { 87 class RenderMultiColumnFlowThread FINAL : public RenderFlowThread {
54 public: 88 public:
55 virtual ~RenderMultiColumnFlowThread(); 89 virtual ~RenderMultiColumnFlowThread();
56 90
57 static RenderMultiColumnFlowThread* createAnonymous(Document&, RenderStyle* parentStyle); 91 static RenderMultiColumnFlowThread* createAnonymous(Document&, RenderStyle* parentStyle);
58 92
59 virtual bool isRenderMultiColumnFlowThread() const OVERRIDE FINAL { return t rue; } 93 virtual bool isRenderMultiColumnFlowThread() const OVERRIDE FINAL { return t rue; }
60 94
61 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par ent()); } 95 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par ent()); }
62 96
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 LayoutUnit m_columnWidth; // The used value of column-width 139 LayoutUnit m_columnWidth; // The used value of column-width
106 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto. 140 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or 0 if auto.
107 bool m_inBalancingPass; // Set when relayouting for column balancing. 141 bool m_inBalancingPass; // Set when relayouting for column balancing.
108 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t he column set heights after layout. 142 bool m_needsColumnHeightsRecalculation; // Set when we need to recalculate t he column set heights after layout.
109 }; 143 };
110 144
111 } // namespace WebCore 145 } // namespace WebCore
112 146
113 #endif // RenderMultiColumnFlowThread_h 147 #endif // RenderMultiColumnFlowThread_h
114 148
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderMultiColumnFlowThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698