| 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) 2014 Adobe Systems Inc. | 6 * Copyright (C) 2014 Adobe Systems Inc. |
| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // level to exclude the space, allowing it to - in effect - collapse into the | 42 // level to exclude the space, allowing it to - in effect - collapse into the |
| 43 // newline. | 43 // newline. |
| 44 if (lineMidpointState.numMidpoints() % 2) { | 44 if (lineMidpointState.numMidpoints() % 2) { |
| 45 // Find the trailing space object's midpoint. | 45 // Find the trailing space object's midpoint. |
| 46 int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1; | 46 int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1; |
| 47 for (; trailingSpaceMidpoint > 0 && | 47 for (; trailingSpaceMidpoint > 0 && |
| 48 lineMidpointState.midpoints()[trailingSpaceMidpoint] | 48 lineMidpointState.midpoints()[trailingSpaceMidpoint] |
| 49 .getLineLayoutItem() != m_whitespace; | 49 .getLineLayoutItem() != m_whitespace; |
| 50 --trailingSpaceMidpoint) { | 50 --trailingSpaceMidpoint) { |
| 51 } | 51 } |
| 52 ASSERT(trailingSpaceMidpoint >= 0); | 52 DCHECK_GE(trailingSpaceMidpoint, 0); |
| 53 if (collapseFirstSpace == CollapseFirstSpace) | 53 if (collapseFirstSpace == CollapseFirstSpace) |
| 54 lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset( | 54 lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset( |
| 55 lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() - 1); | 55 lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() - 1); |
| 56 | 56 |
| 57 // Now make sure every single trailingPositionedBox following the | 57 // Now make sure every single trailingPositionedBox following the |
| 58 // trailingSpaceMidpoint properly stops and starts ignoring spaces. | 58 // trailingSpaceMidpoint properly stops and starts ignoring spaces. |
| 59 size_t currentMidpoint = trailingSpaceMidpoint + 1; | 59 size_t currentMidpoint = trailingSpaceMidpoint + 1; |
| 60 for (size_t i = 0; i < m_objects.size(); ++i) { | 60 for (size_t i = 0; i < m_objects.size(); ++i) { |
| 61 if (currentMidpoint >= lineMidpointState.numMidpoints()) { | 61 if (currentMidpoint >= lineMidpointState.numMidpoints()) { |
| 62 // We don't have a midpoint for this box yet. | 62 // We don't have a midpoint for this box yet. |
| 63 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, | 63 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, |
| 64 LineLayoutItem(m_objects[i])); | 64 LineLayoutItem(m_objects[i])); |
| 65 } else { | 65 } else { |
| 66 ASSERT(lineMidpointState.midpoints()[currentMidpoint] | 66 DCHECK(lineMidpointState.midpoints()[currentMidpoint] |
| 67 .getLineLayoutItem() == m_objects[i]); | 67 .getLineLayoutItem() == m_objects[i]); |
| 68 ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1] | 68 DCHECK(lineMidpointState.midpoints()[currentMidpoint + 1] |
| 69 .getLineLayoutItem() == m_objects[i]); | 69 .getLineLayoutItem() == m_objects[i]); |
| 70 } | 70 } |
| 71 currentMidpoint += 2; | 71 currentMidpoint += 2; |
| 72 } | 72 } |
| 73 } else if (!lBreak.getLineLayoutItem()) { | 73 } else if (!lBreak.getLineLayoutItem()) { |
| 74 ASSERT(collapseFirstSpace == CollapseFirstSpace); | 74 DCHECK_EQ(collapseFirstSpace, CollapseFirstSpace); |
| 75 // Add a new end midpoint that stops right at the very end. | 75 // Add a new end midpoint that stops right at the very end. |
| 76 unsigned length = m_whitespace.textLength(); | 76 unsigned length = m_whitespace.textLength(); |
| 77 unsigned pos = length >= 2 ? length - 2 : UINT_MAX; | 77 unsigned pos = length >= 2 ? length - 2 : UINT_MAX; |
| 78 InlineIterator endMid(0, m_whitespace, pos); | 78 InlineIterator endMid(0, m_whitespace, pos); |
| 79 lineMidpointState.startIgnoringSpaces(endMid); | 79 lineMidpointState.startIgnoringSpaces(endMid); |
| 80 for (size_t i = 0; i < m_objects.size(); ++i) { | 80 for (size_t i = 0; i < m_objects.size(); ++i) { |
| 81 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, m_objects[i]); | 81 ensureLineBoxInsideIgnoredSpaces(&lineMidpointState, m_objects[i]); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |