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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.h

Issue 1907443003: Translate flow thread coords to the nearest enclosing coord space when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a unit test too. Created 4 years, 8 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
(...skipping 18 matching lines...) Expand all
29 29
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "core/layout/FragmentationContext.h" 31 #include "core/layout/FragmentationContext.h"
32 #include "core/layout/LayoutFlowThread.h" 32 #include "core/layout/LayoutFlowThread.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 class LayoutMultiColumnSet; 36 class LayoutMultiColumnSet;
37 class LayoutMultiColumnSpannerPlaceholder; 37 class LayoutMultiColumnSpannerPlaceholder;
38 38
39 // What to translate *to* when translating from a flow thread coordinate space.
40 enum class CoordinateSpaceConversion {
41 // Just translate to the nearest containing coordinate space (i.e. where our multicol container
42 // lives) of this flow thread, i.e. don't walk ancestral flow threads, if an y.
43 Containing,
44
45 // Translate to visual coordinates, by walking all ancestral flow threads.
46 Visual
47 };
48
39 // Flow thread implementation for CSS multicol. This will be inserted as an anon ymous child block of 49 // Flow thread implementation for CSS multicol. This will be inserted as an anon ymous child block of
40 // the actual multicol container (i.e. the LayoutBlockFlow whose style computes to non-auto 50 // the actual multicol container (i.e. the LayoutBlockFlow whose style computes to non-auto
41 // column-count and/or column-width). LayoutMultiColumnFlowThread is the heart o f the multicol 51 // column-count and/or column-width). LayoutMultiColumnFlowThread is the heart o f the multicol
42 // implementation, and there is only one instance per multicol container. Child content of the 52 // implementation, and there is only one instance per multicol container. Child content of the
43 // multicol container is parented into the flow thread at the time of layoutObje ct insertion. 53 // multicol container is parented into the flow thread at the time of layoutObje ct insertion.
44 // 54 //
45 // Apart from this flow thread child, the multicol container will also have Layo utMultiColumnSet 55 // Apart from this flow thread child, the multicol container will also have Layo utMultiColumnSet
46 // children, which are used to position the columns visually. The flow thread is in charge 56 // children, which are used to position the columns visually. The flow thread is in charge
47 // of layout, and, after having calculated the column width, it lays out content as if everything 57 // of layout, and, after having calculated the column width, it lays out content as if everything
48 // were in one tall single column, except that there will typically be some amou nt of blank space 58 // were in one tall single column, except that there will typically be some amou nt of blank space
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 184
175 LayoutUnit tallestUnbreakableLogicalHeight(LayoutUnit offsetInFlowThread) co nst; 185 LayoutUnit tallestUnbreakableLogicalHeight(LayoutUnit offsetInFlowThread) co nst;
176 186
177 LayoutSize columnOffset(const LayoutPoint&) const final; 187 LayoutSize columnOffset(const LayoutPoint&) const final;
178 188
179 // Do we need to set a new width and lay out? 189 // Do we need to set a new width and lay out?
180 virtual bool needsNewWidth() const; 190 virtual bool needsNewWidth() const;
181 191
182 bool isPageLogicalHeightKnown() const final; 192 bool isPageLogicalHeightKnown() const final;
183 193
184 LayoutSize flowThreadTranslationAtOffset(LayoutUnit) const; 194 LayoutSize flowThreadTranslationAtOffset(LayoutUnit, CoordinateSpaceConversi on) const;
195 LayoutSize flowThreadTranslationAtPoint(const LayoutPoint& flowThreadPoint, CoordinateSpaceConversion) const;
185 196
197 LayoutPoint flowThreadPointToVisualPoint(const LayoutPoint& flowThreadPoint) const override;
186 LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) con st override; 198 LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) con st override;
187 199
188 int inlineBlockBaseline(LineDirectionMode) const override; 200 int inlineBlockBaseline(LineDirectionMode) const override;
189 201
190 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const final; 202 LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const final;
191 203
192 void layoutColumns(SubtreeLayoutScope&); 204 void layoutColumns(SubtreeLayoutScope&);
193 205
194 // Skip past a column spanner during flow thread layout. Spanners are not la id out inside the 206 // Skip past a column spanner during flow thread layout. Spanners are not la id out inside the
195 // flow thread, since the flow thread is not in a spanner's containing block chain (since the 207 // flow thread, since the flow thread is not in a spanner's containing block chain (since the
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 bool m_isBeingEvacuated; 281 bool m_isBeingEvacuated;
270 }; 282 };
271 283
272 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr ead() is defined in 284 // Cannot use DEFINE_LAYOUT_OBJECT_TYPE_CASTS here, because isMultiColumnFlowThr ead() is defined in
273 // LayoutFlowThread, not in LayoutObject. 285 // LayoutFlowThread, not in LayoutObject.
274 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object- >isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread()); 286 DEFINE_TYPE_CASTS(LayoutMultiColumnFlowThread, LayoutFlowThread, object, object- >isLayoutMultiColumnFlowThread(), object.isLayoutMultiColumnFlowThread());
275 287
276 } // namespace blink 288 } // namespace blink
277 289
278 #endif // LayoutMultiColumnFlowThread_h 290 #endif // LayoutMultiColumnFlowThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698