Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: Source/core/rendering/style/StyleGridData.h

Issue 18532004: Implement 'grid-template' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined and updated after Ojan's and Elliott's comments Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND A NY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND A NY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR A NY 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR A NY
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THI S 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THI S
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 * 23 *
24 */ 24 */
25 25
26 #ifndef StyleGridData_h 26 #ifndef StyleGridData_h
27 #define StyleGridData_h 27 #define StyleGridData_h
28 28
29 #include "core/rendering/style/GridCoordinate.h"
29 #include "core/rendering/style/GridTrackSize.h" 30 #include "core/rendering/style/GridTrackSize.h"
30 #include "core/rendering/style/RenderStyleConstants.h" 31 #include "core/rendering/style/RenderStyleConstants.h"
31 #include "wtf/PassRefPtr.h" 32 #include "wtf/PassRefPtr.h"
32 #include "wtf/RefCounted.h" 33 #include "wtf/RefCounted.h"
33 #include "wtf/Vector.h" 34 #include "wtf/Vector.h"
34 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 typedef HashMap<String, Vector<size_t> > NamedGridLinesMap; 39 typedef HashMap<String, Vector<size_t> > NamedGridLinesMap;
39 40
40 class StyleGridData : public RefCounted<StyleGridData> { 41 class StyleGridData : public RefCounted<StyleGridData> {
41 public: 42 public:
42 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat a); } 43 static PassRefPtr<StyleGridData> create() { return adoptRef(new StyleGridDat a); }
43 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(* this)); } 44 PassRefPtr<StyleGridData> copy() const { return adoptRef(new StyleGridData(* this)); }
44 45
45 bool operator==(const StyleGridData& o) const 46 bool operator==(const StyleGridData& o) const
46 { 47 {
47 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; 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;
48 } 49 }
49 50
50 bool operator!=(const StyleGridData& o) const 51 bool operator!=(const StyleGridData& o) const
51 { 52 {
52 return !(*this == o); 53 return !(*this == o);
53 } 54 }
54 55
55 Vector<GridTrackSize> m_gridDefinitionColumns; 56 Vector<GridTrackSize> m_gridDefinitionColumns;
56 Vector<GridTrackSize> m_gridDefinitionRows; 57 Vector<GridTrackSize> m_gridDefinitionRows;
57 58
58 NamedGridLinesMap m_namedGridColumnLines; 59 NamedGridLinesMap m_namedGridColumnLines;
59 NamedGridLinesMap m_namedGridRowLines; 60 NamedGridLinesMap m_namedGridRowLines;
60 61
61 GridAutoFlow m_gridAutoFlow; 62 GridAutoFlow m_gridAutoFlow;
62 63
63 GridTrackSize m_gridAutoRows; 64 GridTrackSize m_gridAutoRows;
64 GridTrackSize m_gridAutoColumns; 65 GridTrackSize m_gridAutoColumns;
65 66
67 NamedGridAreaMap m_namedGridArea;
68 // 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.
70 size_t m_namedGridAreaRowCount;
71 size_t m_namedGridAreaColumnCount;
72
66 private: 73 private:
67 StyleGridData(); 74 StyleGridData();
68 StyleGridData(const StyleGridData&); 75 StyleGridData(const StyleGridData&);
69 }; 76 };
70 77
71 } // namespace WebCore 78 } // namespace WebCore
72 79
73 #endif // StyleGridData_h 80 #endif // StyleGridData_h
OLDNEW
« no previous file with comments | « Source/core/rendering/style/RenderStyle.h ('k') | Source/core/rendering/style/StyleGridData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698