OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef FragmentationContext_h | 5 #ifndef FragmentationContext_h |
6 #define FragmentationContext_h | 6 #define FragmentationContext_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/LayoutUnit.h" | 9 #include "platform/LayoutUnit.h" |
10 #include "platform/geometry/LayoutSize.h" | 10 #include "platform/geometry/LayoutSize.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // A fragmentation context is either established by a multicol container, or by | 14 // A fragmentation context is either established by a multicol container, or by
pages when |
15 // pages when printing. A fragmentation context consists of a series of | 15 // printing. A fragmentation context consists of a series of fragmentainers. A f
ragmentainer is |
16 // fragmentainers. A fragmentainer is simply a column or page, depending on the | 16 // simply a column or page, depending on the type of fragmentation context. [1] |
17 // type of fragmentation context. [1] | |
18 // | 17 // |
19 // A couple of methods here take a |blockOffset| parameter. This is the offset | 18 // A couple of methods here take a |blockOffset| parameter. This is the offset f
rom the start of the |
20 // from the start of the fragmentation context, pretending that everything is | 19 // fragmentation context, pretending that everything is laid out in one single s
trip (and not sliced |
21 // laid out in one single strip (and not sliced into pages or columns). | 20 // into pages or columns). In multicol, this is referred to as the flow thread c
oordinate space. |
22 // In multicol, this is referred to as the flow thread coordinate space. | |
23 // | 21 // |
24 // It should be noted that a multicol container may be nested inside another | 22 // It should be noted that a multicol container may be nested inside another fra
gmentation context |
25 // fragmentation context (another multicol container, or the pages when | 23 // (another multicol container, or the pages when printing), although this class
doesn't deal with |
26 // printing), although this class doesn't deal with that (it's internal to the | 24 // that (it's internal to the multicol implementation). |
27 // multicol implementation). | |
28 // | 25 // |
29 // [1] http://www.w3.org/TR/css3-break/#fragmentation-model | 26 // [1] http://www.w3.org/TR/css3-break/#fragmentation-model |
30 class CORE_EXPORT FragmentationContext { | 27 class CORE_EXPORT FragmentationContext { |
31 public: | 28 public: |
32 virtual ~FragmentationContext() {} | 29 virtual ~FragmentationContext() {} |
33 | 30 |
34 // The height of the fragmentainers may depend on the total height of the | 31 // The height of the fragmentainers may depend on the total height of the cont
ents (column |
35 // contents (column balancing), in which case false is returned if we haven't | 32 // balancing), in which case false is returned if we haven't laid out yet. Oth
erwise, true is |
36 // laid out yet. Otherwise, true is returned. | 33 // returned. |
37 virtual bool isFragmentainerLogicalHeightKnown() = 0; | 34 virtual bool isFragmentainerLogicalHeightKnown() = 0; |
38 | 35 |
39 // Return the height of the fragmentainer at the specified offset. The | 36 // Return the height of the fragmentainer at the specified offset. The fragmen
tainer height |
40 // fragmentainer height isn't necessarily uniform all across the fragmentation | 37 // isn't necessarily uniform all across the fragmentation context. |
41 // context. | |
42 virtual LayoutUnit fragmentainerLogicalHeightAt(LayoutUnit blockOffset) = 0; | 38 virtual LayoutUnit fragmentainerLogicalHeightAt(LayoutUnit blockOffset) = 0; |
43 | 39 |
44 // Return how much is left of the fragmentainer at the specified offset. | 40 // Return how much is left of the fragmentainer at the specified offset. Calle
rs typically want |
45 // Callers typically want this information to decide whether some piece of | 41 // this information to decide whether some piece of content fits in this fragm
entainer, or if it |
46 // content fits in this fragmentainer, or if it has to push the content to the | 42 // has to push the content to the next fragmentainer. |
47 // next fragmentainer. | |
48 virtual LayoutUnit remainingLogicalHeightAt(LayoutUnit blockOffset) = 0; | 43 virtual LayoutUnit remainingLogicalHeightAt(LayoutUnit blockOffset) = 0; |
49 | 44 |
50 // Return the flow thread of the fragmentation context, if it is a multicol | 45 // Return the flow thread of the fragmentation context, if it is a multicol fr
agmentation |
51 // fragmentation context. Since multicol containers may be nested inside other | 46 // context. Since multicol containers may be nested inside other fragmentation
contexts, |
52 // fragmentation contexts, sometimes we need to know if it's a multicol | 47 // sometimes we need to know if it's a multicol container that we're dealing w
ith. |
53 // container that we're dealing with. | |
54 virtual class LayoutMultiColumnFlowThread* associatedFlowThread() { | 48 virtual class LayoutMultiColumnFlowThread* associatedFlowThread() { |
55 return nullptr; | 49 return nullptr; |
56 } | 50 } |
57 }; | 51 }; |
58 | 52 |
59 } // namespace blink | 53 } // namespace blink |
60 | 54 |
61 #endif // FragmentationContext_h | 55 #endif // FragmentationContext_h |
OLD | NEW |