1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/nsHTMLReflowMetrics.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* struct containing the output from nsIFrame::Reflow */ 1.10 + 1.11 +#include "nsHTMLReflowMetrics.h" 1.12 +#include "nsHTMLReflowState.h" 1.13 + 1.14 +void 1.15 +nsOverflowAreas::UnionWith(const nsOverflowAreas& aOther) 1.16 +{ 1.17 + // FIXME: We should probably change scrollable overflow to use 1.18 + // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). 1.19 + NS_FOR_FRAME_OVERFLOW_TYPES(otype) { 1.20 + mRects[otype].UnionRect(mRects[otype], aOther.mRects[otype]); 1.21 + } 1.22 +} 1.23 + 1.24 +void 1.25 +nsOverflowAreas::UnionAllWith(const nsRect& aRect) 1.26 +{ 1.27 + // FIXME: We should probably change scrollable overflow to use 1.28 + // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). 1.29 + NS_FOR_FRAME_OVERFLOW_TYPES(otype) { 1.30 + mRects[otype].UnionRect(mRects[otype], aRect); 1.31 + } 1.32 +} 1.33 + 1.34 +void 1.35 +nsOverflowAreas::SetAllTo(const nsRect& aRect) 1.36 +{ 1.37 + NS_FOR_FRAME_OVERFLOW_TYPES(otype) { 1.38 + mRects[otype] = aRect; 1.39 + } 1.40 +} 1.41 + 1.42 +nsHTMLReflowMetrics::nsHTMLReflowMetrics(const nsHTMLReflowState& aState, 1.43 + uint32_t aFlags) 1.44 + : mISize(0) 1.45 + , mBSize(0) 1.46 + , mBlockStartAscent(ASK_FOR_BASELINE) 1.47 + , mFlags(aFlags) 1.48 + , mWritingMode(aState.GetWritingMode()) 1.49 +{ 1.50 +} 1.51 + 1.52 +void 1.53 +nsHTMLReflowMetrics::SetOverflowAreasToDesiredBounds() 1.54 +{ 1.55 + NS_FOR_FRAME_OVERFLOW_TYPES(otype) { 1.56 + mOverflowAreas.Overflow(otype).SetRect(0, 0, Width(), Height()); 1.57 + } 1.58 +} 1.59 + 1.60 +void 1.61 +nsHTMLReflowMetrics::UnionOverflowAreasWithDesiredBounds() 1.62 +{ 1.63 + // FIXME: We should probably change scrollable overflow to use 1.64 + // UnionRectIncludeEmpty (but leave visual overflow using UnionRect). 1.65 + nsRect rect(0, 0, Width(), Height()); 1.66 + NS_FOR_FRAME_OVERFLOW_TYPES(otype) { 1.67 + nsRect& o = mOverflowAreas.Overflow(otype); 1.68 + o.UnionRect(o, rect); 1.69 + } 1.70 +}