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)34 ReflowOutput::ReflowOutput(const ReflowInput& aReflowInput)
35     : ReflowOutput(aReflowInput.GetWritingMode()) {}
36 
SetOverflowAreasToDesiredBounds()37 void ReflowOutput::SetOverflowAreasToDesiredBounds() {
38   NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
39     mOverflowAreas.Overflow(otype).SetRect(0, 0, Width(), Height());
40   }
41 }
42 
UnionOverflowAreasWithDesiredBounds()43 void ReflowOutput::UnionOverflowAreasWithDesiredBounds() {
44   // FIXME: We should probably change scrollable overflow to use
45   // UnionRectIncludeEmpty (but leave visual overflow using UnionRect).
46   nsRect rect(0, 0, Width(), Height());
47   NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
48     nsRect& o = mOverflowAreas.Overflow(otype);
49     o.UnionRect(o, rect);
50   }
51 }
52 
53 }  // namespace mozilla
54