| 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. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 All right reserved. | 4 All right reserved. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * Copyright (C) 2013 Adobe Systems Incorporated. | 6 * Copyright (C) 2013 Adobe Systems Incorporated. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef LineInfo_h | 25 #ifndef LineInfo_h |
| 26 #define LineInfo_h | 26 #define LineInfo_h |
| 27 | 27 |
| 28 #include "core/layout/line/LineWidth.h" | 28 #include "core/layout/line/LineWidth.h" |
| 29 #include "core/style/ComputedStyleConstants.h" |
| 29 #include "wtf/Allocator.h" | 30 #include "wtf/Allocator.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 class LineInfo { | 34 class LineInfo { |
| 34 STACK_ALLOCATED(); | 35 STACK_ALLOCATED(); |
| 35 | 36 |
| 36 public: | 37 public: |
| 37 LineInfo() | 38 LineInfo() |
| 38 : m_isFirstLine(true), | 39 : m_isFirstLine(true), |
| 39 m_isLastLine(false), | 40 m_isLastLine(false), |
| 40 m_isEmpty(true), | 41 m_isEmpty(true), |
| 41 m_previousLineBrokeCleanly(true), | 42 m_previousLineBrokeCleanly(true), |
| 42 m_runsFromLeadingWhitespace(0) {} | 43 m_runsFromLeadingWhitespace(0), |
| 44 m_textAlign(ETextAlign::kLeft) {} |
| 43 | 45 |
| 44 bool isFirstLine() const { return m_isFirstLine; } | 46 bool isFirstLine() const { return m_isFirstLine; } |
| 45 bool isLastLine() const { return m_isLastLine; } | 47 bool isLastLine() const { return m_isLastLine; } |
| 46 bool isEmpty() const { return m_isEmpty; } | 48 bool isEmpty() const { return m_isEmpty; } |
| 47 bool previousLineBrokeCleanly() const { return m_previousLineBrokeCleanly; } | 49 bool previousLineBrokeCleanly() const { return m_previousLineBrokeCleanly; } |
| 48 unsigned runsFromLeadingWhitespace() const { | 50 unsigned runsFromLeadingWhitespace() const { |
| 49 return m_runsFromLeadingWhitespace; | 51 return m_runsFromLeadingWhitespace; |
| 50 } | 52 } |
| 51 void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; } | 53 void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; } |
| 52 void incrementRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace++; } | 54 void incrementRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace++; } |
| 53 | 55 |
| 54 void setFirstLine(bool firstLine) { m_isFirstLine = firstLine; } | 56 void setFirstLine(bool firstLine) { m_isFirstLine = firstLine; } |
| 55 void setLastLine(bool lastLine) { m_isLastLine = lastLine; } | 57 void setLastLine(bool lastLine) { m_isLastLine = lastLine; } |
| 56 void setEmpty(bool empty) { m_isEmpty = empty; } | 58 void setEmpty(bool empty) { m_isEmpty = empty; } |
| 57 | 59 |
| 58 void setPreviousLineBrokeCleanly(bool previousLineBrokeCleanly) { | 60 void setPreviousLineBrokeCleanly(bool previousLineBrokeCleanly) { |
| 59 m_previousLineBrokeCleanly = previousLineBrokeCleanly; | 61 m_previousLineBrokeCleanly = previousLineBrokeCleanly; |
| 60 } | 62 } |
| 61 | 63 |
| 64 ETextAlign textAlign() const { return m_textAlign; } |
| 65 void setTextAlign(ETextAlign textAlign) { m_textAlign = textAlign; } |
| 66 |
| 62 private: | 67 private: |
| 63 bool m_isFirstLine; | 68 bool m_isFirstLine; |
| 64 bool m_isLastLine; | 69 bool m_isLastLine; |
| 65 bool m_isEmpty; | 70 bool m_isEmpty; |
| 66 bool m_previousLineBrokeCleanly; | 71 bool m_previousLineBrokeCleanly; |
| 67 unsigned m_runsFromLeadingWhitespace; | 72 unsigned m_runsFromLeadingWhitespace; |
| 73 ETextAlign m_textAlign; |
| 68 }; | 74 }; |
| 69 | 75 |
| 70 } // namespace blink | 76 } // namespace blink |
| 71 | 77 |
| 72 #endif // LineInfo_h | 78 #endif // LineInfo_h |
| OLD | NEW |