Line data Source code
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 : /* Iterator class for frame lists that respect CSS "order" during layout */
8 :
9 : #include "CSSOrderAwareFrameIterator.h"
10 :
11 : namespace mozilla {
12 :
13 : template<>
14 : bool
15 0 : CSSOrderAwareFrameIterator::CSSOrderComparator(nsIFrame* const& a,
16 : nsIFrame* const& b)
17 0 : { return a->StylePosition()->mOrder < b->StylePosition()->mOrder; }
18 :
19 : template<>
20 : bool
21 0 : CSSOrderAwareFrameIterator::CSSBoxOrdinalGroupComparator(nsIFrame* const& a,
22 : nsIFrame* const& b)
23 0 : { return a->StyleXUL()->mBoxOrdinal < b->StyleXUL()->mBoxOrdinal; }
24 :
25 : template<>
26 : bool
27 0 : CSSOrderAwareFrameIterator::IsForward() const { return true; }
28 :
29 : template<>
30 : nsFrameList::iterator
31 0 : CSSOrderAwareFrameIterator::begin(const nsFrameList& aList)
32 0 : { return aList.begin(); }
33 :
34 : template<>
35 0 : nsFrameList::iterator CSSOrderAwareFrameIterator::end(const nsFrameList& aList)
36 0 : { return aList.end(); }
37 :
38 : template<>
39 : bool
40 0 : ReverseCSSOrderAwareFrameIterator::CSSOrderComparator(nsIFrame* const& a,
41 : nsIFrame* const& b)
42 0 : { return a->StylePosition()->mOrder > b->StylePosition()->mOrder; }
43 :
44 : template<>
45 : bool
46 0 : ReverseCSSOrderAwareFrameIterator::CSSBoxOrdinalGroupComparator(nsIFrame* const& a,
47 : nsIFrame* const& b)
48 0 : { return a->StyleXUL()->mBoxOrdinal > b->StyleXUL()->mBoxOrdinal; }
49 :
50 : template<>
51 : bool
52 0 : ReverseCSSOrderAwareFrameIterator::IsForward() const
53 0 : { return false; }
54 :
55 : template<>
56 : nsFrameList::reverse_iterator
57 0 : ReverseCSSOrderAwareFrameIterator::begin(const nsFrameList& aList)
58 0 : { return aList.rbegin(); }
59 :
60 : template<>
61 : nsFrameList::reverse_iterator
62 0 : ReverseCSSOrderAwareFrameIterator::end(const nsFrameList& aList)
63 0 : { return aList.rend(); }
64 :
65 : } // namespace mozilla
|