Chromium Code Reviews| 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. All r ight reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * Copyright (C) 2013 Adobe Systems Incorporated. | 5 * Copyright (C) 2013 Adobe Systems Incorporated. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/rendering/line/BreakingContextInlineHeaders.h" | 25 #include "core/rendering/line/BreakingContextInlineHeaders.h" |
| 26 | 26 |
| 27 namespace WebCore { | 27 namespace WebCore { |
| 28 | 28 |
| 29 InlineIterator BreakingContext::handleEndOfLine() | 29 InlineIterator BreakingContext::handleEndOfLine() |
| 30 { | 30 { |
| 31 ShapeInsideInfo* shapeInfo = m_block->layoutShapeInsideInfo(); | 31 if (m_lineBreak == m_resolver.position() && (!m_lineBreak.object() || !m_lin eBreak.object()->isBR())) { |
| 32 bool segmentAllowsOverflow = !shapeInfo || !shapeInfo->hasSegments(); | |
| 33 | |
| 34 if (m_lineBreak == m_resolver.position() && (!m_lineBreak.object() || !m_lin eBreak.object()->isBR()) && segmentAllowsOverflow) { | |
| 35 // we just add as much as possible | 32 // we just add as much as possible |
| 36 if (m_blockStyle->whiteSpace() == PRE && !m_current.offset()) { | 33 if (m_blockStyle->whiteSpace() == PRE && !m_current.offset()) { |
| 37 m_lineBreak.moveTo(m_lastObject, m_lastObject->isText() ? m_lastObje ct->length() : 0); | 34 m_lineBreak.moveTo(m_lastObject, m_lastObject->isText() ? m_lastObje ct->length() : 0); |
| 38 } else if (m_lineBreak.object()) { | 35 } else if (m_lineBreak.object()) { |
| 39 // Don't ever break in the middle of a word if we can help it. | 36 // Don't ever break in the middle of a word if we can help it. |
| 40 // There's no room at all. We just have to be on this line, | 37 // There's no room at all. We just have to be on this line, |
| 41 // even though we'll spill out. | 38 // even though we'll spill out. |
| 42 m_lineBreak.moveTo(m_current.object(), m_current.offset()); | 39 m_lineBreak.moveTo(m_current.object(), m_current.offset()); |
| 43 } | 40 } |
| 44 } | 41 } |
| 45 | 42 |
| 46 // FIXME Bug 100049: We do not need to consume input in a multi-segment line | 43 // FIXME Bug 100049: We do not need to consume input in a multi-segment line |
| 47 // unless no segment will. | 44 // unless no segment will. |
| 48 // make sure we consume at least one char/object. | 45 // make sure we consume at least one char/object. |
|
Bem Jones-Bey (adobe)
2014/03/27 00:09:47
This comment is obsolete, it should be removed.
| |
| 49 if (m_lineBreak == m_resolver.position() && segmentAllowsOverflow) | 46 if (m_lineBreak == m_resolver.position()) |
| 50 m_lineBreak.increment(); | 47 m_lineBreak.increment(); |
| 51 | 48 |
| 52 // Sanity check our midpoints. | 49 // Sanity check our midpoints. |
| 53 m_lineMidpointState.checkMidpoints(m_lineBreak); | 50 m_lineMidpointState.checkMidpoints(m_lineBreak); |
| 54 | 51 |
| 55 m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, m_lin eBreak, TrailingObjects::CollapseFirstSpace); | 52 m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, m_lin eBreak, TrailingObjects::CollapseFirstSpace); |
| 56 | 53 |
| 57 // We might have made lineBreak an iterator that points past the end | 54 // We might have made lineBreak an iterator that points past the end |
| 58 // of the object. Do this adjustment to make it point to the start | 55 // of the object. Do this adjustment to make it point to the start |
| 59 // of the next object instead to avoid confusing the rest of the | 56 // of the next object instead to avoid confusing the rest of the |
| 60 // code. | 57 // code. |
| 61 if (m_lineBreak.offset()) { | 58 if (m_lineBreak.offset()) { |
| 62 // This loop enforces the invariant that line breaks should never point | 59 // This loop enforces the invariant that line breaks should never point |
| 63 // at an empty inline. See http://crbug.com/305904. | 60 // at an empty inline. See http://crbug.com/305904. |
| 64 do { | 61 do { |
| 65 m_lineBreak.setOffset(m_lineBreak.offset() - 1); | 62 m_lineBreak.setOffset(m_lineBreak.offset() - 1); |
| 66 m_lineBreak.increment(); | 63 m_lineBreak.increment(); |
| 67 } while (!m_lineBreak.atEnd() && isEmptyInline(m_lineBreak.object())); | 64 } while (!m_lineBreak.atEnd() && isEmptyInline(m_lineBreak.object())); |
| 68 } | 65 } |
| 69 | 66 |
| 70 return m_lineBreak; | 67 return m_lineBreak; |
| 71 } | 68 } |
| 72 | 69 |
| 73 } | 70 } |
| OLD | NEW |