Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 | 32 |
| 33 #include "core/layout/api/LineLayoutBlockFlow.h" | 33 #include "core/layout/api/LineLayoutBlockFlow.h" |
| 34 #include "platform/LayoutUnit.h" | 34 #include "platform/LayoutUnit.h" |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class FloatingObject; | 39 class FloatingObject; |
| 40 class LineLayoutRubyRun; | 40 class LineLayoutRubyRun; |
| 41 | 41 |
| 42 enum IndentTextOrNot { DoNotIndentText, IndentText }; | |
| 43 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace }; | 42 enum WhitespaceTreatment { ExcludeWhitespace, IncludeWhitespace }; |
| 44 | 43 |
| 45 class LineWidth { | 44 class LineWidth { |
| 46 STACK_ALLOCATED(); | 45 STACK_ALLOCATED(); |
| 47 public: | 46 public: |
| 48 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot shouldInden tText); | 47 LineWidth(LineLayoutBlockFlow, bool isFirstLine, IndentTextOrNot shouldInden tText); |
| 49 | 48 |
| 50 bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + Layou tUnit::epsilon()); } | 49 bool fitsOnLine() const { return currentWidth() <= (m_availableWidth + Layou tUnit::epsilon()); } |
| 51 bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_ava ilableWidth + LayoutUnit::epsilon()); } | 50 bool fitsOnLine(float extra) const { return currentWidth() + extra <= (m_ava ilableWidth + LayoutUnit::epsilon()); } |
| 52 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const | 51 bool fitsOnLine(float extra, WhitespaceTreatment whitespaceTreatment) const |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 67 | 66 |
| 68 void updateAvailableWidth(LayoutUnit minimumHeight = 0); | 67 void updateAvailableWidth(LayoutUnit minimumHeight = 0); |
| 69 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); | 68 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); |
| 70 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } | 69 void addUncommittedWidth(float delta) { m_uncommittedWidth += delta; } |
| 71 void commit(); | 70 void commit(); |
| 72 void applyOverhang(LineLayoutRubyRun, LineLayoutItem startLayoutItem, LineLa youtItem endLayoutItem); | 71 void applyOverhang(LineLayoutRubyRun, LineLayoutItem startLayoutItem, LineLa youtItem endLayoutItem); |
| 73 void fitBelowFloats(bool isFirstLine = false); | 72 void fitBelowFloats(bool isFirstLine = false); |
| 74 void setTrailingWhitespaceWidth(float width) { m_trailingWhitespaceWidth = w idth; } | 73 void setTrailingWhitespaceWidth(float width) { m_trailingWhitespaceWidth = w idth; } |
| 75 void snapUncommittedWidth() { m_uncommittedWidth = LayoutUnit(m_uncommittedW idth).toFloat(); } | 74 void snapUncommittedWidth() { m_uncommittedWidth = LayoutUnit(m_uncommittedW idth).toFloat(); } |
| 76 | 75 |
| 77 bool shouldIndentText() const { return m_shouldIndentText == IndentText; } | 76 bool shouldIndentText() const { return m_shouldIndentText == IndentText; } |
|
Julien - ping for review
2016/01/14 16:50:34
Do we still have users of this? If so, we should p
| |
| 77 IndentTextOrNot indentText() const { return m_shouldIndentText ; } | |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 void computeAvailableWidthFromLeftAndRight(); | 80 void computeAvailableWidthFromLeftAndRight(); |
| 81 void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, con st float& newLineLeft, const float& newLineRight); | 81 void updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, con st float& newLineLeft, const float& newLineRight); |
| 82 void wrapNextToShapeOutside(bool isFirstLine); | 82 void wrapNextToShapeOutside(bool isFirstLine); |
| 83 | 83 |
| 84 LineLayoutBlockFlow m_block; | 84 LineLayoutBlockFlow m_block; |
| 85 float m_uncommittedWidth; | 85 float m_uncommittedWidth; |
| 86 float m_committedWidth; | 86 float m_committedWidth; |
| 87 float m_overhangWidth; // The amount by which |m_availableWidth| has been in flated to account for possible contraction due to ruby overhang. | 87 float m_overhangWidth; // The amount by which |m_availableWidth| has been in flated to account for possible contraction due to ruby overhang. |
| 88 float m_trailingWhitespaceWidth; | 88 float m_trailingWhitespaceWidth; |
| 89 float m_left; | 89 float m_left; |
| 90 float m_right; | 90 float m_right; |
| 91 float m_availableWidth; | 91 float m_availableWidth; |
| 92 bool m_isFirstLine; | 92 bool m_isFirstLine; |
| 93 IndentTextOrNot m_shouldIndentText; | 93 IndentTextOrNot m_shouldIndentText; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } | 96 } |
| 97 | 97 |
| 98 #endif // LineWidth_h | 98 #endif // LineWidth_h |
| OLD | NEW |