/src/mozilla-central/layout/tables/TableArea.h
Line | Count | Source (jump to first uncovered line) |
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 | | #ifndef mozilla_TableArea_h_ |
7 | | #define mozilla_TableArea_h_ |
8 | | |
9 | | #include "nsRect.h" |
10 | | |
11 | | namespace mozilla { |
12 | | |
13 | | struct TableArea |
14 | | { |
15 | | TableArea() |
16 | 0 | : mStartCol(0), mStartRow(0), mColCount(0), mRowCount(0) { } |
17 | | TableArea(int32_t aStartCol, int32_t aStartRow, |
18 | | int32_t aColCount, int32_t aRowCount) |
19 | | : mStartCol(aStartCol), |
20 | | mStartRow(aStartRow), |
21 | | mColCount(aColCount), |
22 | 0 | mRowCount(aRowCount) { } |
23 | | |
24 | 0 | int32_t& StartCol() { return mStartCol; } |
25 | 0 | int32_t& StartRow() { return mStartRow; } |
26 | 0 | int32_t& ColCount() { return mColCount; } |
27 | 0 | int32_t& RowCount() { return mRowCount; } |
28 | | |
29 | 0 | int32_t StartCol() const { return mStartCol; } |
30 | 0 | int32_t StartRow() const { return mStartRow; } |
31 | | int32_t ColCount() const { return mColCount; } |
32 | | int32_t RowCount() const { return mRowCount; } |
33 | 0 | int32_t EndCol() const { return mStartCol + mColCount; } |
34 | 0 | int32_t EndRow() const { return mStartRow + mRowCount; } |
35 | | |
36 | | void UnionArea(const TableArea& aArea1, const TableArea& aArea2) |
37 | 0 | { |
38 | 0 | nsIntRect rect(aArea1.mStartCol, aArea1.mStartRow, |
39 | 0 | aArea1.mColCount, aArea1.mRowCount); |
40 | 0 | rect.UnionRect(rect, nsIntRect(aArea2.mStartCol, aArea2.mStartRow, |
41 | 0 | aArea2.mColCount, aArea2.mRowCount)); |
42 | 0 | rect.GetRect(&mStartCol, &mStartRow, &mColCount, &mRowCount); |
43 | 0 | } |
44 | | |
45 | | private: |
46 | | int32_t mStartCol, mStartRow, mColCount, mRowCount; |
47 | | }; |
48 | | |
49 | | } // namespace mozilla |
50 | | |
51 | | #endif // mozilla_TableArea_h_ |