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 19 matching lines...) Expand all Loading... |
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; | 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; |
40 | 41 |
41 class StyleGridData : public RefCounted<StyleGridData> { | 42 class StyleGridData : public RefCounted<StyleGridData> { |
42 public: | 43 public: |
43 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat
a); } | 44 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat
a); } |
44 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(*
this)); } | 45 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(*
this)); } |
45 | 46 |
46 bool operator==(const StyleGridData& o) const | 47 bool operator==(const StyleGridData& o) const |
47 { | 48 { |
48 return m_gridDefinitionColumns == o.m_gridDefinitionColumns && m_gridDef
initionRows == o.m_gridDefinitionRows && m_gridAutoFlow == o.m_gridAutoFlow && m
_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns &&
m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.
m_namedGridRowLines && m_namedGridArea == o.m_namedGridArea && m_namedGridArea =
= o.m_namedGridArea && m_namedGridAreaRowCount == o.m_namedGridAreaRowCount && m
_namedGridAreaColumnCount == o.m_namedGridAreaColumnCount; | 49 return m_gridDefinitionColumns == o.m_gridDefinitionColumns && m_gridDef
initionRows == o.m_gridDefinitionRows && m_gridAutoFlow == o.m_gridAutoFlow && m
_gridAutoRows == o.m_gridAutoRows && m_gridAutoColumns == o.m_gridAutoColumns &&
m_namedGridColumnLines == o.m_namedGridColumnLines && m_namedGridRowLines == o.
m_namedGridRowLines && m_orderedNamedGridColumnLines == o.m_orderedNamedGridColu
mnLines && m_orderedNamedGridRowLines == o.m_orderedNamedGridRowLines && m_named
GridArea == o.m_namedGridArea && m_namedGridArea == o.m_namedGridArea && m_named
GridAreaRowCount == o.m_namedGridAreaRowCount && m_namedGridAreaColumnCount == o
.m_namedGridAreaColumnCount; |
49 } | 50 } |
50 | 51 |
51 bool operator!=(const StyleGridData& o) const | 52 bool operator!=(const StyleGridData& o) const |
52 { | 53 { |
53 return !(*this == o); | 54 return !(*this == o); |
54 } | 55 } |
55 | 56 |
56 Vector<GridTrackSize> m_gridDefinitionColumns; | 57 Vector<GridTrackSize> m_gridDefinitionColumns; |
57 Vector<GridTrackSize> m_gridDefinitionRows; | 58 Vector<GridTrackSize> m_gridDefinitionRows; |
58 | 59 |
59 NamedGridLinesMap m_namedGridColumnLines; | 60 NamedGridLinesMap m_namedGridColumnLines; |
60 NamedGridLinesMap m_namedGridRowLines; | 61 NamedGridLinesMap m_namedGridRowLines; |
61 | 62 |
| 63 // 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
. |
| 65 OrderedNamedGridLines m_orderedNamedGridColumnLines; |
| 66 OrderedNamedGridLines m_orderedNamedGridRowLines; |
| 67 |
62 GridAutoFlow m_gridAutoFlow; | 68 GridAutoFlow m_gridAutoFlow; |
63 | 69 |
64 GridTrackSize m_gridAutoRows; | 70 GridTrackSize m_gridAutoRows; |
65 GridTrackSize m_gridAutoColumns; | 71 GridTrackSize m_gridAutoColumns; |
66 | 72 |
67 NamedGridAreaMap m_namedGridArea; | 73 NamedGridAreaMap m_namedGridArea; |
68 // Because m_namedGridArea doesn't store the unnamed grid areas, we need to
keep track | 74 // Because m_namedGridArea doesn't store the unnamed grid areas, we need to
keep track |
69 // of the explicit grid size defined by both named and unnamed grid areas. | 75 // of the explicit grid size defined by both named and unnamed grid areas. |
70 size_t m_namedGridAreaRowCount; | 76 size_t m_namedGridAreaRowCount; |
71 size_t m_namedGridAreaColumnCount; | 77 size_t m_namedGridAreaColumnCount; |
72 | 78 |
73 private: | 79 private: |
74 StyleGridData(); | 80 StyleGridData(); |
75 StyleGridData(const StyleGridData&); | 81 StyleGridData(const StyleGridData&); |
76 }; | 82 }; |
77 | 83 |
78 } // namespace WebCore | 84 } // namespace WebCore |
79 | 85 |
80 #endif // StyleGridData_h | 86 #endif // StyleGridData_h |
OLD | NEW |