Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / line / LineLayoutState.h
blobfc63d8fd0dc68284ba4e0a37fbfb4bbce4b8684f
1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All right reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
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.
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.
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.
24 #ifndef LineLayoutState_h
25 #define LineLayoutState_h
27 #include "core/layout/LayoutBlockFlow.h"
28 #include "platform/geometry/LayoutRect.h"
29 #include "wtf/Allocator.h"
31 namespace blink {
33 // Like LayoutState for layout(), LineLayoutState keeps track of global information
34 // during an entire linebox tree layout pass (aka layoutInlineChildren).
35 class LineLayoutState {
36 STACK_ALLOCATED();
37 public:
38 LineLayoutState(bool fullLayout, LayoutUnit& paintInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutFlowThread* flowThread)
39 : m_lastFloat(nullptr)
40 , m_endLine(nullptr)
41 , m_floatIndex(0)
42 , m_endLineLogicalTop(0)
43 , m_endLineMatched(false)
44 , m_hasInlineChild(false)
45 , m_isFullLayout(fullLayout)
46 , m_paintInvalidationLogicalTop(paintInvalidationLogicalTop)
47 , m_paintInvalidationLogicalBottom(paintInvalidationLogicalBottom)
48 , m_adjustedLogicalLineTop(0)
49 , m_usesPaintInvalidationBounds(false)
50 , m_flowThread(flowThread)
51 { }
53 void markForFullLayout() { m_isFullLayout = true; }
54 bool isFullLayout() const { return m_isFullLayout; }
56 bool usesPaintInvalidationBounds() const { return m_usesPaintInvalidationBounds; }
58 void setPaintInvalidationRange(LayoutUnit logicalHeight)
60 m_usesPaintInvalidationBounds = true;
61 m_paintInvalidationLogicalTop = m_paintInvalidationLogicalBottom = logicalHeight;
64 void updatePaintInvalidationRangeFromBox(RootInlineBox* box, LayoutUnit paginationDelta = 0)
66 m_usesPaintInvalidationBounds = true;
67 m_paintInvalidationLogicalTop = std::min(m_paintInvalidationLogicalTop, box->logicalTopVisualOverflow() + std::min<LayoutUnit>(paginationDelta, 0));
68 m_paintInvalidationLogicalBottom = std::max(m_paintInvalidationLogicalBottom, box->logicalBottomVisualOverflow() + std::max<LayoutUnit>(paginationDelta, 0));
71 bool endLineMatched() const { return m_endLineMatched; }
72 void setEndLineMatched(bool endLineMatched) { m_endLineMatched = endLineMatched; }
74 bool hasInlineChild() const { return m_hasInlineChild; }
75 void setHasInlineChild(bool hasInlineChild) { m_hasInlineChild = hasInlineChild; }
78 LineInfo& lineInfo() { return m_lineInfo; }
79 const LineInfo& lineInfo() const { return m_lineInfo; }
81 LayoutUnit endLineLogicalTop() const { return m_endLineLogicalTop; }
82 void setEndLineLogicalTop(LayoutUnit logicalTop) { m_endLineLogicalTop = logicalTop; }
84 RootInlineBox* endLine() const { return m_endLine; }
85 void setEndLine(RootInlineBox* line) { m_endLine = line; }
87 FloatingObject* lastFloat() const { return m_lastFloat; }
88 void setLastFloat(FloatingObject* lastFloat) { m_lastFloat = lastFloat; }
90 Vector<LayoutBlockFlow::FloatWithRect>& floats() { return m_floats; }
92 unsigned floatIndex() const { return m_floatIndex; }
93 void setFloatIndex(unsigned floatIndex) { m_floatIndex = floatIndex; }
95 LayoutUnit adjustedLogicalLineTop() const { return m_adjustedLogicalLineTop; }
96 void setAdjustedLogicalLineTop(LayoutUnit value) { m_adjustedLogicalLineTop = value; }
98 LayoutFlowThread* flowThread() const { return m_flowThread; }
100 private:
101 Vector<LayoutBlockFlow::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 // Used as a performance optimization to avoid doing a full paint invalidation when our floats
109 // change but we don't have any inline children.
110 bool m_hasInlineChild;
112 bool m_isFullLayout;
114 // FIXME: Should this be a range object instead of two ints?
115 LayoutUnit& m_paintInvalidationLogicalTop;
116 LayoutUnit& m_paintInvalidationLogicalBottom;
118 LayoutUnit m_adjustedLogicalLineTop;
120 bool m_usesPaintInvalidationBounds;
122 LayoutFlowThread* m_flowThread;
127 #endif // LineLayoutState_h