| 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. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 4 * All right reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2014 Adobe Systems Inc. | 6 * Copyright (C) 2014 Adobe Systems Inc. |
| 6 * | 7 * |
| 7 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 10 * 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. |
| 11 * | 12 * |
| 12 * 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, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 23 matching lines...) Expand all Loading... |
| 37 struct BidiIsolatedRun; | 38 struct BidiIsolatedRun; |
| 38 | 39 |
| 39 template <class Iterator, class Run, class IsolatedRun> | 40 template <class Iterator, class Run, class IsolatedRun> |
| 40 class BidiResolver; | 41 class BidiResolver; |
| 41 template <class Iterator> | 42 template <class Iterator> |
| 42 class MidpointState; | 43 class MidpointState; |
| 43 typedef BidiResolver<InlineIterator, BidiRun, BidiIsolatedRun> | 44 typedef BidiResolver<InlineIterator, BidiRun, BidiIsolatedRun> |
| 44 InlineBidiResolver; | 45 InlineBidiResolver; |
| 45 typedef MidpointState<InlineIterator> LineMidpointState; | 46 typedef MidpointState<InlineIterator> LineMidpointState; |
| 46 | 47 |
| 47 // This class allows us to ensure lineboxes are created in the right place on th
e line when | 48 // This class allows us to ensure lineboxes are created in the right place on |
| 48 // an out-of-flow positioned object or an empty inline is encountered between a
trailing space | 49 // the line when an out-of-flow positioned object or an empty inline is |
| 49 // and subsequent spaces and we want to ignore (i.e. collapse) surplus whitespac
e. So for example: | 50 // encountered between a trailing space and subsequent spaces and we want to |
| 51 // ignore (i.e. collapse) surplus whitespace. So for example: |
| 50 // <div>X <span></span> Y</div> | 52 // <div>X <span></span> Y</div> |
| 51 // or | 53 // or |
| 52 // <div>X <div style="position: absolute"></div> Y</div> | 54 // <div>X <div style="position: absolute"></div> Y</div> |
| 53 // In both of the above snippets the inline and the positioned object occur afte
r a trailing space | 55 // In both of the above snippets the inline and the positioned object occur |
| 54 // and before a space that will cause our line breaking algorithm to start ignor
ing spaces. When it | 56 // after a trailing space and before a space that will cause our line breaking |
| 55 // does that we want to ensure that the inline/positioned object gets a linebox
and that it is part | 57 // algorithm to start ignoring spaces. When it does that we want to ensure that |
| 56 // of the collapsed whitespace. So to achieve this we use appendObjectIfNeeded()
to keep track of | 58 // the inline/positioned object gets a linebox and that it is part of the |
| 57 // objects encountered after a trailing whitespace and updateMidpointsForTrailin
gObjects() to put | 59 // collapsed whitespace. So to achieve this we use appendObjectIfNeeded() to |
| 58 // them in the right place when we start ignoring surplus whitespace. | 60 // keep track of objects encountered after a trailing whitespace and |
| 61 // updateMidpointsForTrailingObjects() to put them in the right place when we |
| 62 // start ignoring surplus whitespace. |
| 59 | 63 |
| 60 class TrailingObjects { | 64 class TrailingObjects { |
| 61 STACK_ALLOCATED(); | 65 STACK_ALLOCATED(); |
| 62 | 66 |
| 63 public: | 67 public: |
| 64 TrailingObjects() : m_whitespace(nullptr) {} | 68 TrailingObjects() : m_whitespace(nullptr) {} |
| 65 | 69 |
| 66 void setTrailingWhitespace(LineLayoutText whitespace) { | 70 void setTrailingWhitespace(LineLayoutText whitespace) { |
| 67 ASSERT(whitespace); | 71 ASSERT(whitespace); |
| 68 m_whitespace = whitespace; | 72 m_whitespace = whitespace; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 88 CollapseFirstSpaceOrNot); | 92 CollapseFirstSpaceOrNot); |
| 89 | 93 |
| 90 private: | 94 private: |
| 91 LineLayoutText m_whitespace; | 95 LineLayoutText m_whitespace; |
| 92 Vector<LineLayoutItem, 4> m_objects; | 96 Vector<LineLayoutItem, 4> m_objects; |
| 93 }; | 97 }; |
| 94 | 98 |
| 95 } // namespace blink | 99 } // namespace blink |
| 96 | 100 |
| 97 #endif // TrailingObjects_h | 101 #endif // TrailingObjects_h |
| OLD | NEW |