• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) 2013 Adobe Systems Incorporated.
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 LineInfo_h
25 #define LineInfo_h
26 
27 #include "core/rendering/line/LineWidth.h"
28 
29 namespace WebCore {
30 
31 class LineInfo {
32 public:
LineInfo()33     LineInfo()
34         : m_isFirstLine(true)
35         , m_isLastLine(false)
36         , m_isEmpty(true)
37         , m_previousLineBrokeCleanly(true)
38         , m_floatPaginationStrut(0)
39         , m_runsFromLeadingWhitespace(0)
40     { }
41 
isFirstLine()42     bool isFirstLine() const { return m_isFirstLine; }
isLastLine()43     bool isLastLine() const { return m_isLastLine; }
isEmpty()44     bool isEmpty() const { return m_isEmpty; }
previousLineBrokeCleanly()45     bool previousLineBrokeCleanly() const { return m_previousLineBrokeCleanly; }
floatPaginationStrut()46     LayoutUnit floatPaginationStrut() const { return m_floatPaginationStrut; }
runsFromLeadingWhitespace()47     unsigned runsFromLeadingWhitespace() const { return m_runsFromLeadingWhitespace; }
resetRunsFromLeadingWhitespace()48     void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; }
incrementRunsFromLeadingWhitespace()49     void incrementRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace++; }
50 
setFirstLine(bool firstLine)51     void setFirstLine(bool firstLine) { m_isFirstLine = firstLine; }
setLastLine(bool lastLine)52     void setLastLine(bool lastLine) { m_isLastLine = lastLine; }
53     void setEmpty(bool empty, RenderBlock* block = 0, LineWidth* lineWidth = 0)
54     {
55         if (m_isEmpty == empty)
56             return;
57         m_isEmpty = empty;
58         if (!empty && block && floatPaginationStrut()) {
59             block->setLogicalHeight(block->logicalHeight() + floatPaginationStrut());
60             setFloatPaginationStrut(0);
61             lineWidth->updateAvailableWidth();
62         }
63     }
64 
setPreviousLineBrokeCleanly(bool previousLineBrokeCleanly)65     void setPreviousLineBrokeCleanly(bool previousLineBrokeCleanly) { m_previousLineBrokeCleanly = previousLineBrokeCleanly; }
setFloatPaginationStrut(LayoutUnit strut)66     void setFloatPaginationStrut(LayoutUnit strut) { m_floatPaginationStrut = strut; }
67 
68 private:
69     bool m_isFirstLine;
70     bool m_isLastLine;
71     bool m_isEmpty;
72     bool m_previousLineBrokeCleanly;
73     LayoutUnit m_floatPaginationStrut;
74     unsigned m_runsFromLeadingWhitespace;
75 };
76 
77 }
78 
79 #endif // LineInfo_h
80