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

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

Issue 254883003: [New Multicolumn] Faster and more direct RenderMultiColumnSet::multiColumnFlowThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review #2 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
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 26
27 #ifndef RenderMultiColumnSet_h 27 #ifndef RenderMultiColumnSet_h
28 #define RenderMultiColumnSet_h 28 #define RenderMultiColumnSet_h
29 29
30 #include "core/rendering/RenderMultiColumnFlowThread.h"
30 #include "core/rendering/RenderRegionSet.h" 31 #include "core/rendering/RenderRegionSet.h"
31 #include "wtf/Vector.h" 32 #include "wtf/Vector.h"
32 33
33 namespace WebCore { 34 namespace WebCore {
34 35
35 // RenderMultiColumnSet represents a set of columns that all have the same width and height. By 36 // RenderMultiColumnSet represents a set of columns that all have the same width and height. By
36 // combining runs of same-size columns into a single object, we significantly re duce the number of 37 // combining runs of same-size columns into a single object, we significantly re duce the number of
37 // unique RenderObjects required to represent columns. 38 // unique RenderObjects required to represent columns.
38 // 39 //
39 // Column sets are inserted as anonymous children of the actual multicol contain er (i.e. the 40 // Column sets are inserted as anonymous children of the actual multicol contain er (i.e. the
40 // renderer whose style computes to non-auto column-count and/or column-width). 41 // renderer whose style computes to non-auto column-count and/or column-width).
41 // 42 //
42 // Being a "region", a column set has no children on its own, but is merely used to slice a portion 43 // Being a "region", a column set has no children on its own, but is merely used to slice a portion
43 // of the tall "single-column" flow thread into actual columns visually, to conv ert from flow thread 44 // of the tall "single-column" flow thread into actual columns visually, to conv ert from flow thread
44 // coordinates to visual ones. It is in charge of both positioning columns corre ctly relatively to 45 // coordinates to visual ones. It is in charge of both positioning columns corre ctly relatively to
45 // the parent multicol container, and to calculate the correct translation for e ach column's 46 // the parent multicol container, and to calculate the correct translation for e ach column's
46 // contents, and to paint any rules between them. RenderMultiColumnSet objects a re used for 47 // contents, and to paint any rules between them. RenderMultiColumnSet objects a re used for
47 // painting, hit testing, and any other type of operation that requires mapping from flow thread 48 // painting, hit testing, and any other type of operation that requires mapping from flow thread
48 // coordinates to visual coordinates. 49 // coordinates to visual coordinates.
49 // 50 //
50 // Column spans result in the creation of new column sets, since a spanning rend erer has to be 51 // Column spans result in the creation of new column sets, since a spanning rend erer has to be
51 // placed in between the column sets that come before and after the span. 52 // placed in between the column sets that come before and after the span.
52 class RenderMultiColumnSet FINAL : public RenderRegionSet { 53 class RenderMultiColumnSet FINAL : public RenderRegionSet {
53 public: 54 public:
54 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle* parentStyle); 55 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle* parentStyle);
55 56
56 virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; } 57 virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; }
57 58
58 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par ent()); } 59 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par ent()); }
59 RenderMultiColumnFlowThread* multiColumnFlowThread() const { return multiCol umnBlockFlow()->multiColumnFlowThread(); } 60 RenderMultiColumnFlowThread* multiColumnFlowThread() const
61 {
62 ASSERT_WITH_SECURITY_IMPLICATION(!flowThread() || flowThread()->isRender MultiColumnFlowThread());
63 return static_cast<RenderMultiColumnFlowThread*>(flowThread());
64 }
60 65
61 RenderMultiColumnSet* nextSiblingMultiColumnSet() const; 66 RenderMultiColumnSet* nextSiblingMultiColumnSet() const;
62 67
63 unsigned computedColumnCount() const { return m_computedColumnCount; } 68 unsigned computedColumnCount() const { return m_computedColumnCount; }
64 LayoutUnit computedColumnWidth() const { return m_computedColumnWidth; } 69 LayoutUnit computedColumnWidth() const { return m_computedColumnWidth; }
65 LayoutUnit computedColumnHeight() const { return m_computedColumnHeight; } 70 LayoutUnit computedColumnHeight() const { return m_computedColumnHeight; }
66 71
67 void setComputedColumnWidthAndCount(LayoutUnit width, unsigned count) 72 void setComputedColumnWidthAndCount(LayoutUnit width, unsigned count)
68 { 73 {
69 m_computedColumnWidth = width; 74 m_computedColumnWidth = width;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 }; 184 };
180 Vector<ContentRun, 1> m_contentRuns; 185 Vector<ContentRun, 1> m_contentRuns;
181 }; 186 };
182 187
183 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); 188 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet());
184 189
185 } // namespace WebCore 190 } // namespace WebCore
186 191
187 #endif // RenderMultiColumnSet_h 192 #endif // RenderMultiColumnSet_h
188 193
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.h ('k') | Source/core/rendering/RenderMultiColumnSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698