OLD | NEW |
(Empty) | |
| 1 /* |
| 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. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. |
| 6 * |
| 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. |
| 11 * |
| 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. |
| 16 * |
| 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 |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. |
| 21 * |
| 22 */ |
| 23 |
| 24 #ifndef LineLayoutState_h |
| 25 #define LineLayoutState_h |
| 26 |
| 27 #include "core/rendering/RenderBlockFlow.h" |
| 28 #include "platform/geometry/LayoutRect.h" |
| 29 |
| 30 namespace WebCore { |
| 31 |
| 32 class RenderBlockFlow; |
| 33 |
| 34 // Like LayoutState for layout(), LineLayoutState keeps track of global informat
ion |
| 35 // during an entire linebox tree layout pass (aka layoutInlineChildren). |
| 36 class LineLayoutState { |
| 37 public: |
| 38 LineLayoutState(bool fullLayout, LayoutUnit& repaintLogicalTop, LayoutUnit&
repaintLogicalBottom, RenderFlowThread* flowThread) |
| 39 : m_lastFloat(0) |
| 40 , m_endLine(0) |
| 41 , m_floatIndex(0) |
| 42 , m_endLineLogicalTop(0) |
| 43 , m_endLineMatched(false) |
| 44 , m_checkForFloatsFromLastLine(false) |
| 45 , m_isFullLayout(fullLayout) |
| 46 , m_repaintLogicalTop(repaintLogicalTop) |
| 47 , m_repaintLogicalBottom(repaintLogicalBottom) |
| 48 , m_adjustedLogicalLineTop(0) |
| 49 , m_usesRepaintBounds(false) |
| 50 , m_flowThread(flowThread) |
| 51 { } |
| 52 |
| 53 void markForFullLayout() { m_isFullLayout = true; } |
| 54 bool isFullLayout() const { return m_isFullLayout; } |
| 55 |
| 56 bool usesRepaintBounds() const { return m_usesRepaintBounds; } |
| 57 |
| 58 void setRepaintRange(LayoutUnit logicalHeight) |
| 59 { |
| 60 m_usesRepaintBounds = true; |
| 61 m_repaintLogicalTop = m_repaintLogicalBottom = logicalHeight; |
| 62 } |
| 63 |
| 64 void updateRepaintRangeFromBox(RootInlineBox* box, LayoutUnit paginationDelt
a = 0) |
| 65 { |
| 66 m_usesRepaintBounds = true; |
| 67 m_repaintLogicalTop = min(m_repaintLogicalTop, box->logicalTopVisualOver
flow() + min<LayoutUnit>(paginationDelta, 0)); |
| 68 m_repaintLogicalBottom = max(m_repaintLogicalBottom, box->logicalBottomV
isualOverflow() + max<LayoutUnit>(paginationDelta, 0)); |
| 69 } |
| 70 |
| 71 bool endLineMatched() const { return m_endLineMatched; } |
| 72 void setEndLineMatched(bool endLineMatched) { m_endLineMatched = endLineMatc
hed; } |
| 73 |
| 74 bool checkForFloatsFromLastLine() const { return m_checkForFloatsFromLastLin
e; } |
| 75 void setCheckForFloatsFromLastLine(bool check) { m_checkForFloatsFromLastLin
e = check; } |
| 76 |
| 77 LineInfo& lineInfo() { return m_lineInfo; } |
| 78 const LineInfo& lineInfo() const { return m_lineInfo; } |
| 79 |
| 80 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; } |
| 81 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = log
icalTop; } |
| 82 |
| 83 RootInlineBox* endLine() const { return m_endLine; } |
| 84 void setEndLine(RootInlineBox* line) { m_endLine = line; } |
| 85 |
| 86 FloatingObject* lastFloat() const { return m_lastFloat; } |
| 87 void setLastFloat(FloatingObject* lastFloat) { m_lastFloat = lastFloat; } |
| 88 |
| 89 Vector<RenderBlockFlow::FloatWithRect>& floats() { return m_floats; } |
| 90 |
| 91 unsigned floatIndex() const { return m_floatIndex; } |
| 92 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; } |
| 93 |
| 94 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop;
} |
| 95 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop
= value; } |
| 96 |
| 97 RenderFlowThread* flowThread() const { return m_flowThread; } |
| 98 void setFlowThread(RenderFlowThread* thread) { m_flowThread = thread; } |
| 99 |
| 100 private: |
| 101 Vector<RenderBlockFlow::FloatWithRect> m_floats; |
| 102 FloatingObject* m_lastFloat; |
| 103 RootInlineBox* m_endLine; |
| 104 LineInfo m_lineInfo; |
| 105 unsigned m_floatIndex; |
| 106 LayoutUnit m_endLineLogicalTop; |
| 107 bool m_endLineMatched; |
| 108 bool m_checkForFloatsFromLastLine; |
| 109 |
| 110 bool m_isFullLayout; |
| 111 |
| 112 // FIXME: Should this be a range object instead of two ints? |
| 113 LayoutUnit& m_repaintLogicalTop; |
| 114 LayoutUnit& m_repaintLogicalBottom; |
| 115 |
| 116 LayoutUnit m_adjustedLogicalLineTop; |
| 117 |
| 118 bool m_usesRepaintBounds; |
| 119 |
| 120 RenderFlowThread* m_flowThread; |
| 121 }; |
| 122 |
| 123 } |
| 124 |
| 125 #endif // LineLayoutState_h |
OLD | NEW |