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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef BreakingContextInlineHeaders_h | 24 #ifndef BreakingContextInlineHeaders_h |
25 #define BreakingContextInlineHeaders_h | 25 #define BreakingContextInlineHeaders_h |
26 | 26 |
27 #include "core/layout/Layer.h" | 27 #include "core/layout/Layer.h" |
| 28 #include "core/layout/LayoutListMarker.h" |
28 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
29 #include "core/layout/LayoutRubyRun.h" | 30 #include "core/layout/LayoutRubyRun.h" |
30 #include "core/layout/TextRunConstructor.h" | 31 #include "core/layout/TextRunConstructor.h" |
31 #include "core/layout/line/InlineIterator.h" | 32 #include "core/layout/line/InlineIterator.h" |
32 #include "core/layout/line/InlineTextBox.h" | 33 #include "core/layout/line/InlineTextBox.h" |
33 #include "core/layout/line/LayoutTextInfo.h" | 34 #include "core/layout/line/LayoutTextInfo.h" |
34 #include "core/layout/line/LineBreaker.h" | 35 #include "core/layout/line/LineBreaker.h" |
35 #include "core/layout/line/LineInfo.h" | 36 #include "core/layout/line/LineInfo.h" |
36 #include "core/layout/line/LineWidth.h" | 37 #include "core/layout/line/LineWidth.h" |
37 #include "core/layout/line/TrailingObjects.h" | 38 #include "core/layout/line/TrailingObjects.h" |
38 #include "core/layout/line/WordMeasurement.h" | 39 #include "core/layout/line/WordMeasurement.h" |
39 #include "core/layout/svg/LayoutSVGInlineText.h" | 40 #include "core/layout/svg/LayoutSVGInlineText.h" |
40 #include "core/rendering/RenderCombineText.h" | 41 #include "core/rendering/RenderCombineText.h" |
41 #include "core/rendering/RenderInline.h" | 42 #include "core/rendering/RenderInline.h" |
42 #include "core/rendering/RenderListMarker.h" | |
43 #include "platform/text/TextBreakIterator.h" | 43 #include "platform/text/TextBreakIterator.h" |
44 | 44 |
45 namespace blink { | 45 namespace blink { |
46 | 46 |
47 // We don't let our line box tree for a single line get any deeper than this. | 47 // We don't let our line box tree for a single line get any deeper than this. |
48 const unsigned cMaxLineDepth = 200; | 48 const unsigned cMaxLineDepth = 200; |
49 | 49 |
50 class BreakingContext { | 50 class BreakingContext { |
51 public: | 51 public: |
52 BreakingContext(InlineBidiResolver& resolver, LineInfo& inLineInfo, LineWidt
h& lineWidth, LayoutTextInfo& inLayoutTextInfo, FloatingObject* inLastFloatFromP
reviousLine, bool appliedStartWidth, RenderBlockFlow* block) | 52 BreakingContext(InlineBidiResolver& resolver, LineInfo& inLineInfo, LineWidt
h& lineWidth, LayoutTextInfo& inLayoutTextInfo, FloatingObject* inLastFloatFromP
reviousLine, bool appliedStartWidth, RenderBlockFlow* block) |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // Optimize for a common case. If we can't find whitespace after the list | 462 // Optimize for a common case. If we can't find whitespace after the list |
463 // item, then this is all moot. | 463 // item, then this is all moot. |
464 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(*replacedBox
) + m_block->marginStartForChild(*replacedBox) + m_block->marginEndForChild(*rep
lacedBox) + inlineLogicalWidth(m_current.object()); | 464 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(*replacedBox
) + m_block->marginStartForChild(*replacedBox) + m_block->marginEndForChild(*rep
lacedBox) + inlineLogicalWidth(m_current.object()); |
465 if (m_current.object()->isListMarker()) { | 465 if (m_current.object()->isListMarker()) { |
466 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { | 466 if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStart
Object(m_block, m_current.object(), m_lineMidpointState)) { |
467 // Like with inline flows, we start ignoring spaces to make sure tha
t any | 467 // Like with inline flows, we start ignoring spaces to make sure tha
t any |
468 // additional spaces we see will be discarded. | 468 // additional spaces we see will be discarded. |
469 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; | 469 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace
= true; |
470 m_ignoringSpaces = true; | 470 m_ignoringSpaces = true; |
471 } | 471 } |
472 if (toRenderListMarker(m_current.object())->isInside()) | 472 if (toLayoutListMarker(m_current.object())->isInside()) |
473 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); | 473 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); |
474 } else { | 474 } else { |
475 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); | 475 m_width.addUncommittedWidth(replacedLogicalWidth.toFloat()); |
476 } | 476 } |
477 if (m_current.object()->isRubyRun()) | 477 if (m_current.object()->isRubyRun()) |
478 m_width.applyOverhang(toLayoutRubyRun(m_current.object()), m_lastObject,
m_nextObject); | 478 m_width.applyOverhang(toLayoutRubyRun(m_current.object()), m_lastObject,
m_nextObject); |
479 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM
ENT CHARACTER) for replaced element. | 479 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEM
ENT CHARACTER) for replaced element. |
480 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter
); | 480 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter
); |
481 } | 481 } |
482 | 482 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 return; | 869 return; |
870 } | 870 } |
871 } else if (m_blockStyle->autoWrap() && !m_width.fitsOnLine() && !m_width.com
mittedWidth()) { | 871 } else if (m_blockStyle->autoWrap() && !m_width.fitsOnLine() && !m_width.com
mittedWidth()) { |
872 // If the container autowraps but the current child does not then we sti
ll need to ensure that it | 872 // If the container autowraps but the current child does not then we sti
ll need to ensure that it |
873 // wraps and moves below any floats. | 873 // wraps and moves below any floats. |
874 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); | 874 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); |
875 } | 875 } |
876 | 876 |
877 if (!m_current.object()->isFloatingOrOutOfFlowPositioned()) { | 877 if (!m_current.object()->isFloatingOrOutOfFlowPositioned()) { |
878 m_lastObject = m_current.object(); | 878 m_lastObject = m_current.object(); |
879 if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage(
) || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMark
er(m_lastObject)->isInside())) { | 879 if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage(
) || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toLayoutListMark
er(m_lastObject)->isInside())) { |
880 m_width.commit(); | 880 m_width.commit(); |
881 m_lineBreak.moveToStartOf(m_nextObject); | 881 m_lineBreak.moveToStartOf(m_nextObject); |
882 } | 882 } |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, const LayoutStyle& style) | 886 inline IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBrea
k, const LayoutStyle& style) |
887 { | 887 { |
888 IndentTextOrNot shouldIndentText = DoNotIndentText; | 888 IndentTextOrNot shouldIndentText = DoNotIndentText; |
889 if (isFirstLine || (isAfterHardLineBreak && style.textIndentLine()) == TextI
ndentEachLine) | 889 if (isFirstLine || (isAfterHardLineBreak && style.textIndentLine()) == TextI
ndentEachLine) |
890 shouldIndentText = IndentText; | 890 shouldIndentText = IndentText; |
891 | 891 |
892 if (style.textIndentType() == TextIndentHanging) | 892 if (style.textIndentType() == TextIndentHanging) |
893 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 893 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
894 | 894 |
895 return shouldIndentText; | 895 return shouldIndentText; |
896 } | 896 } |
897 | 897 |
898 } | 898 } |
899 | 899 |
900 #endif // BreakingContextInlineHeaders_h | 900 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |