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 /* A namespace class for static muti-column utilities. */ 8 9 #ifndef mozilla_ColumnUtils_h 10 #define mozilla_ColumnUtils_h 11 12 #include "nsCoord.h" 13 #include "nsStyleConsts.h" 14 15 class nsContainerFrame; 16 17 namespace mozilla { 18 19 // ColumnUtils is a namespace class containing utility functions used by 20 // multi-column containers like ColumnSetWrapperFrame and nsColumnSetFrame. 21 // 22 class ColumnUtils final { 23 public: 24 // Compute used value of 'column-gap' for aFrame. 25 static nscoord GetColumnGap(const nsContainerFrame* aFrame, 26 nscoord aPercentageBasis); 27 28 // Clamp used column width to a minimum of 1px. 29 static nscoord ClampUsedColumnWidth(const Length& aColumnWidth); 30 31 // Compute the intrinsic inline-size of a column container, given a non-zero 32 // column-count, column gap, and column box's inline-size. 33 static nscoord IntrinsicISize(uint32_t aColCount, nscoord aColGap, 34 nscoord aColISize); 35 }; 36 37 } // namespace mozilla 38 39 #endif // mozilla_ColumnUtils_h 40