OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ | 24 #ifndef SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ |
25 #define SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ | 25 #define SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ |
26 | 26 |
27 #include "sky/engine/core/rendering/RenderBlockFlow.h" | 27 #include "sky/engine/core/rendering/RenderParagraph.h" |
28 #include "sky/engine/platform/geometry/LayoutRect.h" | 28 #include "sky/engine/platform/geometry/LayoutRect.h" |
29 | 29 |
30 namespace blink { | 30 namespace blink { |
31 | 31 |
32 // LineLayoutState keeps track of global information | 32 // LineLayoutState keeps track of global information |
33 // during an entire linebox tree layout pass (aka RenderParagraph::layoutChildre
n). | 33 // during an entire linebox tree layout pass (aka RenderParagraph::layoutChildre
n). |
34 class LineLayoutState { | 34 class LineLayoutState { |
35 public: | 35 public: |
36 LineLayoutState(bool fullLayout) | 36 LineLayoutState(bool fullLayout) |
37 : m_lastFloat(0) | 37 : m_endLine(0) |
38 , m_endLine(0) | |
39 , m_floatIndex(0) | |
40 , m_endLineLogicalTop(0) | 38 , m_endLineLogicalTop(0) |
41 , m_endLineMatched(false) | 39 , m_endLineMatched(false) |
42 , m_checkForFloatsFromLastLine(false) | |
43 , m_hasInlineChild(false) | 40 , m_hasInlineChild(false) |
44 , m_isFullLayout(fullLayout) | 41 , m_isFullLayout(fullLayout) |
45 , m_adjustedLogicalLineTop(0) | 42 , m_adjustedLogicalLineTop(0) |
46 { } | 43 { } |
47 | 44 |
48 void markForFullLayout() { m_isFullLayout = true; } | 45 void markForFullLayout() { m_isFullLayout = true; } |
49 bool isFullLayout() const { return m_isFullLayout; } | 46 bool isFullLayout() const { return m_isFullLayout; } |
50 | 47 |
51 bool endLineMatched() const { return m_endLineMatched; } | 48 bool endLineMatched() const { return m_endLineMatched; } |
52 void setEndLineMatched(bool endLineMatched) { m_endLineMatched = endLineMatc
hed; } | 49 void setEndLineMatched(bool endLineMatched) { m_endLineMatched = endLineMatc
hed; } |
53 | 50 |
54 bool checkForFloatsFromLastLine() const { return m_checkForFloatsFromLastLin
e; } | |
55 void setCheckForFloatsFromLastLine(bool check) { m_checkForFloatsFromLastLin
e = check; } | |
56 | |
57 bool hasInlineChild() const { return m_hasInlineChild; } | 51 bool hasInlineChild() const { return m_hasInlineChild; } |
58 void setHasInlineChild(bool hasInlineChild) { m_hasInlineChild = hasInlineCh
ild; } | 52 void setHasInlineChild(bool hasInlineChild) { m_hasInlineChild = hasInlineCh
ild; } |
59 | 53 |
60 LineInfo& lineInfo() { return m_lineInfo; } | 54 LineInfo& lineInfo() { return m_lineInfo; } |
61 const LineInfo& lineInfo() const { return m_lineInfo; } | 55 const LineInfo& lineInfo() const { return m_lineInfo; } |
62 | 56 |
63 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } | 57 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } |
64 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } | 58 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } |
65 | 59 |
66 RootInlineBox* endLine() const { return m_endLine; } | 60 RootInlineBox* endLine() const { return m_endLine; } |
67 void setEndLine(RootInlineBox* line) { m_endLine = line; } | 61 void setEndLine(RootInlineBox* line) { m_endLine = line; } |
68 | 62 |
69 FloatingObject* lastFloat() const { return m_lastFloat; } | |
70 void setLastFloat(FloatingObject* lastFloat) { m_lastFloat = lastFloat; } | |
71 | |
72 Vector<RenderBlockFlow::FloatWithRect>& floats() { return m_floats; } | |
73 | |
74 unsigned floatIndex() const { return m_floatIndex; } | |
75 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; } | |
76 | |
77 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} | 63 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} |
78 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } | 64 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } |
79 | 65 |
80 private: | 66 private: |
81 Vector<RenderBlockFlow::FloatWithRect> m_floats; | |
82 FloatingObject* m_lastFloat; | |
83 RootInlineBox* m_endLine; | 67 RootInlineBox* m_endLine; |
84 LineInfo m_lineInfo; | 68 LineInfo m_lineInfo; |
85 unsigned m_floatIndex; | |
86 LayoutUnit m_endLineLogicalTop; | 69 LayoutUnit m_endLineLogicalTop; |
87 bool m_endLineMatched; | 70 bool m_endLineMatched; |
88 bool m_checkForFloatsFromLastLine; | 71 // FIXME(sky): Do we still need this? |
89 // Used as a performance optimization to avoid doing a full paint invalidati
on when our floats | 72 // Used as a performance optimization to avoid doing a full paint invalidati
on when our floats |
90 // change but we don't have any inline children. | 73 // change but we don't have any inline children. |
91 bool m_hasInlineChild; | 74 bool m_hasInlineChild; |
92 | 75 |
93 bool m_isFullLayout; | 76 bool m_isFullLayout; |
94 | 77 |
95 LayoutUnit m_adjustedLogicalLineTop; | 78 LayoutUnit m_adjustedLogicalLineTop; |
96 }; | 79 }; |
97 | 80 |
98 } | 81 } |
99 | 82 |
100 #endif // SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ | 83 #endif // SKY_ENGINE_CORE_RENDERING_LINE_LINELAYOUTSTATE_H_ |
OLD | NEW |