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 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 current != tabulationCharacter && | 293 current != tabulationCharacter && |
294 current != softHyphenCharacter && | 294 current != softHyphenCharacter && |
295 (current != newlineCharacter || | 295 (current != newlineCharacter || |
296 it.getLineLayoutItem().preservesNewline()); | 296 it.getLineLayoutItem().preservesNewline()); |
297 return notJustWhitespace || isEmptyInline(it.getLineLayoutItem()); | 297 return notJustWhitespace || isEmptyInline(it.getLineLayoutItem()); |
298 } | 298 } |
299 | 299 |
300 inline void setStaticPositions(LineLayoutBlockFlow block, | 300 inline void setStaticPositions(LineLayoutBlockFlow block, |
301 LineLayoutBox child, | 301 LineLayoutBox child, |
302 IndentTextOrNot indentText) { | 302 IndentTextOrNot indentText) { |
303 ASSERT(child.isOutOfFlowPositioned()); | 303 DCHECK(child.isOutOfFlowPositioned()); |
304 // FIXME: The math here is actually not really right. It's a best-guess | 304 // FIXME: The math here is actually not really right. It's a best-guess |
305 // approximation that will work for the common cases | 305 // approximation that will work for the common cases |
306 LineLayoutItem containerBlock = child.container(); | 306 LineLayoutItem containerBlock = child.container(); |
307 LayoutUnit blockHeight = block.logicalHeight(); | 307 LayoutUnit blockHeight = block.logicalHeight(); |
308 if (containerBlock.isLayoutInline()) { | 308 if (containerBlock.isLayoutInline()) { |
309 // A relative positioned inline encloses us. In this case, we also have to | 309 // A relative positioned inline encloses us. In this case, we also have to |
310 // determine our position as though we were an inline. | 310 // determine our position as though we were an inline. |
311 // Set |staticInlinePosition| and |staticBlockPosition| on the relative | 311 // Set |staticInlinePosition| and |staticBlockPosition| on the relative |
312 // positioned inline so that we can obtain the value later. | 312 // positioned inline so that we can obtain the value later. |
313 LineLayoutInline(containerBlock) | 313 LineLayoutInline(containerBlock) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 lineMidpointState.startIgnoringSpaces(InlineIterator(0, o, 0)); | 545 lineMidpointState.startIgnoringSpaces(InlineIterator(0, o, 0)); |
546 return true; | 546 return true; |
547 } | 547 } |
548 } | 548 } |
549 | 549 |
550 return false; | 550 return false; |
551 } | 551 } |
552 | 552 |
553 inline void BreakingContext::handleEmptyInline() { | 553 inline void BreakingContext::handleEmptyInline() { |
554 // This should only end up being called on empty inlines | 554 // This should only end up being called on empty inlines |
555 ASSERT(m_current.getLineLayoutItem()); | 555 DCHECK(m_current.getLineLayoutItem()); |
556 | 556 |
557 LineLayoutInline flowBox(m_current.getLineLayoutItem()); | 557 LineLayoutInline flowBox(m_current.getLineLayoutItem()); |
558 | 558 |
559 bool requiresLineBox = alwaysRequiresLineBox(m_current.getLineLayoutItem()); | 559 bool requiresLineBox = alwaysRequiresLineBox(m_current.getLineLayoutItem()); |
560 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) { | 560 if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) { |
561 // An empty inline that only has line-height, vertical-align or font-metrics | 561 // An empty inline that only has line-height, vertical-align or font-metrics |
562 // will not force linebox creation (and thus affect the height of the line) | 562 // will not force linebox creation (and thus affect the height of the line) |
563 // if the rest of the line is empty. | 563 // if the rest of the line is empty. |
564 if (requiresLineBox) | 564 if (requiresLineBox) |
565 m_lineInfo.setEmpty(false); | 565 m_lineInfo.setEmpty(false); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 // Use LineBreakType::Normal for break-all. When a word does not fit, | 975 // Use LineBreakType::Normal for break-all. When a word does not fit, |
976 // rewindToMidWordBreak() finds the mid-word break point. | 976 // rewindToMidWordBreak() finds the mid-word break point. |
977 LineBreakType lineBreakType = | 977 LineBreakType lineBreakType = |
978 keepAll ? LineBreakType::KeepAll : LineBreakType::Normal; | 978 keepAll ? LineBreakType::KeepAll : LineBreakType::Normal; |
979 bool canBreakMidWord = breakAll || breakWords; | 979 bool canBreakMidWord = breakAll || breakWords; |
980 int nextBreakablePositionForBreakAll = -1; | 980 int nextBreakablePositionForBreakAll = -1; |
981 | 981 |
982 if (layoutText.isWordBreak()) { | 982 if (layoutText.isWordBreak()) { |
983 m_width.commit(); | 983 m_width.commit(); |
984 m_lineBreak.moveToStartOf(m_current.getLineLayoutItem()); | 984 m_lineBreak.moveToStartOf(m_current.getLineLayoutItem()); |
985 ASSERT(m_current.offset() == layoutText.textLength()); | 985 DCHECK_EQ(m_current.offset(), layoutText.textLength()); |
986 } | 986 } |
987 | 987 |
988 if (m_layoutTextInfo.m_text != layoutText) { | 988 if (m_layoutTextInfo.m_text != layoutText) { |
989 m_layoutTextInfo.m_text = layoutText; | 989 m_layoutTextInfo.m_text = layoutText; |
990 m_layoutTextInfo.m_font = &font; | 990 m_layoutTextInfo.m_font = &font; |
991 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator( | 991 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator( |
992 layoutText.text(), localeForLineBreakIterator(style)); | 992 layoutText.text(), localeForLineBreakIterator(style)); |
993 } else if (m_layoutTextInfo.m_font != &font) { | 993 } else if (m_layoutTextInfo.m_font != &font) { |
994 m_layoutTextInfo.m_font = &font; | 994 m_layoutTextInfo.m_font = &font; |
995 } | 995 } |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 | 1551 |
1552 if (style.getTextIndentType() == TextIndentHanging) | 1552 if (style.getTextIndentType() == TextIndentHanging) |
1553 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 1553 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
1554 | 1554 |
1555 return indentText; | 1555 return indentText; |
1556 } | 1556 } |
1557 | 1557 |
1558 } // namespace blink | 1558 } // namespace blink |
1559 | 1559 |
1560 #endif // BreakingContextInlineHeaders_h | 1560 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |