OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "core/rendering/style/GridCoordinate.h" | 29 #include "core/rendering/style/GridCoordinate.h" |
30 #include "core/rendering/style/GridTrackSize.h" | 30 #include "core/rendering/style/GridTrackSize.h" |
31 #include "core/rendering/style/RenderStyleConstants.h" | 31 #include "core/rendering/style/RenderStyleConstants.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
35 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 typedef HashMap<String, Vector<size_t> > NamedGridLinesMap; | |
40 typedef HashMap<size_t, Vector<String>, WTF::IntHash<size_t>, WTF::UnsignedWithZ
eroKeyHashTraits<size_t> > OrderedNamedGridLines; | 39 typedef HashMap<size_t, Vector<String>, WTF::IntHash<size_t>, WTF::UnsignedWithZ
eroKeyHashTraits<size_t> > OrderedNamedGridLines; |
41 | 40 |
42 class StyleGridData : public RefCounted<StyleGridData> { | 41 class StyleGridData : public RefCounted<StyleGridData> { |
43 public: | 42 public: |
44 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat
a); } | 43 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat
a); } |
45 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(*
this)); } | 44 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(*
this)); } |
46 | 45 |
47 bool operator==(const StyleGridData& o) const | 46 bool operator==(const StyleGridData& o) const |
48 { | 47 { |
49 return m_gridTemplateColumns == o.m_gridTemplateColumns && m_gridTemplat
eRows == o.m_gridTemplateRows && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAut
oRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns && m_named
GridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.m_namedG
ridRowLines && m_orderedNamedGridColumnLines == o.m_orderedNamedGridColumnLines
&& m_orderedNamedGridRowLines == o.m_orderedNamedGridRowLines && m_namedGridArea
== o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea && m_namedGridArea
RowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o.m_named
GridAreaColumnCount; | 48 return m_gridTemplateColumns == o.m_gridTemplateColumns && m_gridTemplat
eRows == o.m_gridTemplateRows && m_gridAutoFlow == o.m_gridAutoFlow && m_gridAut
oRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns && m_order
edNamedGridColumnLines == o.m_orderedNamedGridColumnLines && m_orderedNamedGridR
owLines == o.m_orderedNamedGridRowLines && m_namedGridArea == o.m_namedGridArea
&& m_namedGridArea == o.m_namedGridArea && m_namedGridAreaRowCount == o.m_namedG
ridAreaRowCount && m_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount; |
50 } | 49 } |
51 | 50 |
52 bool operator!=(const StyleGridData& o) const | 51 bool operator!=(const StyleGridData& o) const |
53 { | 52 { |
54 return !(*this == o); | 53 return !(*this == o); |
55 } | 54 } |
56 | 55 |
57 Vector<GridTrackSize> m_gridTemplateColumns; | 56 Vector<GridTrackSize> m_gridTemplateColumns; |
58 Vector<GridTrackSize> m_gridTemplateRows; | 57 Vector<GridTrackSize> m_gridTemplateRows; |
59 | 58 |
60 NamedGridLinesMap m_namedGridColumnLines; | |
61 NamedGridLinesMap m_namedGridRowLines; | |
62 | |
63 // In order to reconstruct the original named grid line order, we can't rely
on NamedGridLinesMap | 59 // In order to reconstruct the original named grid line order, we can't rely
on NamedGridLinesMap |
64 // as it loses the position if multiple grid lines are set on a single track
. | 60 // as it loses the position if multiple grid lines are set on a single track
. |
65 OrderedNamedGridLines m_orderedNamedGridColumnLines; | 61 OrderedNamedGridLines m_orderedNamedGridColumnLines; |
66 OrderedNamedGridLines m_orderedNamedGridRowLines; | 62 OrderedNamedGridLines m_orderedNamedGridRowLines; |
67 | 63 |
68 GridAutoFlow m_gridAutoFlow; | 64 GridAutoFlow m_gridAutoFlow; |
69 | 65 |
70 GridTrackSize m_gridAutoRows; | 66 GridTrackSize m_gridAutoRows; |
71 GridTrackSize m_gridAutoColumns; | 67 GridTrackSize m_gridAutoColumns; |
72 | 68 |
73 NamedGridAreaMap m_namedGridArea; | 69 NamedGridAreaMap m_namedGridArea; |
74 // Because m_namedGridArea doesn't store the unnamed grid areas, we need to
keep track | 70 // Because m_namedGridArea doesn't store the unnamed grid areas, we need to
keep track |
75 // of the explicit grid size defined by both named and unnamed grid areas. | 71 // of the explicit grid size defined by both named and unnamed grid areas. |
76 size_t m_namedGridAreaRowCount; | 72 size_t m_namedGridAreaRowCount; |
77 size_t m_namedGridAreaColumnCount; | 73 size_t m_namedGridAreaColumnCount; |
78 | 74 |
79 private: | 75 private: |
80 StyleGridData(); | 76 StyleGridData(); |
81 StyleGridData(const StyleGridData&); | 77 StyleGridData(const StyleGridData&); |
82 }; | 78 }; |
83 | 79 |
84 } // namespace WebCore | 80 } // namespace WebCore |
85 | 81 |
86 #endif // StyleGridData_h | 82 #endif // StyleGridData_h |
OLD | NEW |