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