1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 /* struct containing the output from nsIFrame::Reflow */
8
9 #include "mozilla/ReflowOutput.h"
10 #include "mozilla/ReflowInput.h"
11
UnionWith(const nsOverflowAreas & aOther)12 void nsOverflowAreas::UnionWith(const nsOverflowAreas& aOther) {
13 // FIXME: We should probably change scrollable overflow to use
14 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect).
15 NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
16 mRects[otype].UnionRect(mRects[otype], aOther.mRects[otype]);
17 }
18 }
19
UnionAllWith(const nsRect & aRect)20 void nsOverflowAreas::UnionAllWith(const nsRect& aRect) {
21 // FIXME: We should probably change scrollable overflow to use
22 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect).
23 NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
24 mRects[otype].UnionRect(mRects[otype], aRect);
25 }
26 }
27
SetAllTo(const nsRect & aRect)28 void nsOverflowAreas::SetAllTo(const nsRect& aRect) {
29 NS_FOR_FRAME_OVERFLOW_TYPES(otype) { mRects[otype] = aRect; }
30 }
31
32 namespace mozilla {
33
ReflowOutput(const ReflowInput & aReflowInput,uint32_t aFlags)34 ReflowOutput::ReflowOutput(const ReflowInput& aReflowInput, uint32_t aFlags)
35 : mISize(0),
36 mBSize(0),
37 mBlockStartAscent(ASK_FOR_BASELINE),
38 mFlags(aFlags),
39 mWritingMode(aReflowInput.GetWritingMode()) {}
40
SetOverflowAreasToDesiredBounds()41 void ReflowOutput::SetOverflowAreasToDesiredBounds() {
42 NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
43 mOverflowAreas.Overflow(otype).SetRect(0, 0, Width(), Height());
44 }
45 }
46
UnionOverflowAreasWithDesiredBounds()47 void ReflowOutput::UnionOverflowAreasWithDesiredBounds() {
48 // FIXME: We should probably change scrollable overflow to use
49 // UnionRectIncludeEmpty (but leave visual overflow using UnionRect).
50 nsRect rect(0, 0, Width(), Height());
51 NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
52 nsRect& o = mOverflowAreas.Overflow(otype);
53 o.UnionRect(o, rect);
54 }
55 }
56
57 } // namespace mozilla
58