layout/generic/nsHTMLReflowMetrics.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     6 /* struct containing the output from nsIFrame::Reflow */
     8 #include "nsHTMLReflowMetrics.h"
     9 #include "nsHTMLReflowState.h"
    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 }
    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 }
    31 void
    32 nsOverflowAreas::SetAllTo(const nsRect& aRect)
    33 {
    34   NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
    35     mRects[otype] = aRect;
    36   }
    37 }
    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 }
    49 void
    50 nsHTMLReflowMetrics::SetOverflowAreasToDesiredBounds()
    51 {
    52   NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
    53     mOverflowAreas.Overflow(otype).SetRect(0, 0, Width(), Height());
    54   }
    55 }
    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 }

mercurial