| |
1 /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ |
| |
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
| |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| |
5 |
| |
6 /* struct containing the output from nsIFrame::Reflow */ |
| |
7 |
| |
8 #include "nsHTMLReflowMetrics.h" |
| |
9 #include "nsHTMLReflowState.h" |
| |
10 |
| |
11 void |
| |
12 nsOverflowAreas::UnionWith(const nsOverflowAreas& aOther) |
| |
13 { |
| |
14 // FIXME: We should probably change scrollable overflow to use |
| |
15 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). |
| |
16 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { |
| |
17 mRects[otype].UnionRect(mRects[otype], aOther.mRects[otype]); |
| |
18 } |
| |
19 } |
| |
20 |
| |
21 void |
| |
22 nsOverflowAreas::UnionAllWith(const nsRect& aRect) |
| |
23 { |
| |
24 // FIXME: We should probably change scrollable overflow to use |
| |
25 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). |
| |
26 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { |
| |
27 mRects[otype].UnionRect(mRects[otype], aRect); |
| |
28 } |
| |
29 } |
| |
30 |
| |
31 void |
| |
32 nsOverflowAreas::SetAllTo(const nsRect& aRect) |
| |
33 { |
| |
34 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { |
| |
35 mRects[otype] = aRect; |
| |
36 } |
| |
37 } |
| |
38 |
| |
39 nsHTMLReflowMetrics::nsHTMLReflowMetrics(const nsHTMLReflowState& aState, |
| |
40 uint32_t aFlags) |
| |
41 : mISize(0) |
| |
42 , mBSize(0) |
| |
43 , mBlockStartAscent(ASK_FOR_BASELINE) |
| |
44 , mFlags(aFlags) |
| |
45 , mWritingMode(aState.GetWritingMode()) |
| |
46 { |
| |
47 } |
| |
48 |
| |
49 void |
| |
50 nsHTMLReflowMetrics::SetOverflowAreasToDesiredBounds() |
| |
51 { |
| |
52 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { |
| |
53 mOverflowAreas.Overflow(otype).SetRect(0, 0, Width(), Height()); |
| |
54 } |
| |
55 } |
| |
56 |
| |
57 void |
| |
58 nsHTMLReflowMetrics::UnionOverflowAreasWithDesiredBounds() |
| |
59 { |
| |
60 // FIXME: We should probably change scrollable overflow to use |
| |
61 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). |
| |
62 nsRect rect(0, 0, Width(), Height()); |
| |
63 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { |
| |
64 nsRect& o = mOverflowAreas.Overflow(otype); |
| |
65 o.UnionRect(o, rect); |
| |
66 } |
| |
67 } |