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 
12 namespace mozilla {
13 
UnionWith(const OverflowAreas & aOther)14 void OverflowAreas::UnionWith(const OverflowAreas& aOther) {
15   InkOverflow().UnionRect(InkOverflow(), aOther.InkOverflow());
16   ScrollableOverflow().UnionRect(ScrollableOverflow(),
17                                  aOther.ScrollableOverflow());
18 }
19 
UnionAllWith(const nsRect & aRect)20 void OverflowAreas::UnionAllWith(const nsRect& aRect) {
21   InkOverflow().UnionRect(InkOverflow(), aRect);
22   ScrollableOverflow().UnionRect(ScrollableOverflow(), aRect);
23 }
24 
SetAllTo(const nsRect & aRect)25 void OverflowAreas::SetAllTo(const nsRect& aRect) {
26   InkOverflow() = aRect;
27   ScrollableOverflow() = aRect;
28 }
29 
ReflowOutput(const ReflowInput & aReflowInput)30 ReflowOutput::ReflowOutput(const ReflowInput& aReflowInput)
31     : ReflowOutput(aReflowInput.GetWritingMode()) {}
32 
SetOverflowAreasToDesiredBounds()33 void ReflowOutput::SetOverflowAreasToDesiredBounds() {
34   mOverflowAreas.SetAllTo(nsRect(0, 0, Width(), Height()));
35 }
36 
UnionOverflowAreasWithDesiredBounds()37 void ReflowOutput::UnionOverflowAreasWithDesiredBounds() {
38   mOverflowAreas.UnionAllWith(nsRect(0, 0, Width(), Height()));
39 }
40 
41 }  // namespace mozilla
42