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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 return style.collapseWhiteSpace() | 178 return style.collapseWhiteSpace() |
179 || (whitespacePosition == TrailingWhitespace && style.whiteSpace() == PR
E_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); | 179 || (whitespacePosition == TrailingWhitespace && style.whiteSpace() == PR
E_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); |
180 } | 180 } |
181 | 181 |
182 inline bool requiresLineBoxForContent(LineLayoutInline flow, const LineInfo& lin
eInfo) | 182 inline bool requiresLineBoxForContent(LineLayoutInline flow, const LineInfo& lin
eInfo) |
183 { | 183 { |
184 LineLayoutItem parent = flow.parent(); | 184 LineLayoutItem parent = flow.parent(); |
185 if (flow.document().inNoQuirksMode() | 185 if (flow.document().inNoQuirksMode() |
186 && (flow.style(lineInfo.isFirstLine())->lineHeight() != parent.style(lin
eInfo.isFirstLine())->lineHeight() | 186 && (flow.style(lineInfo.isFirstLine())->lineHeight() != parent.style(lin
eInfo.isFirstLine())->lineHeight() |
187 || flow.style()->verticalAlign() != parent.style()->verticalAlign() | 187 || flow.style()->verticalAlign() != parent.style()->verticalAlign() |
188 || !parent.style()->font().fontMetrics().hasIdenticalAscentDescentAndLin
eGap(flow.style()->font().fontMetrics()))) | 188 || !parent.style()->font().getFontMetrics().hasIdenticalAscentDescentAnd
LineGap(flow.style()->font().getFontMetrics()))) |
189 return true; | 189 return true; |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 inline bool alwaysRequiresLineBox(LineLayoutItem flow) | 193 inline bool alwaysRequiresLineBox(LineLayoutItem flow) |
194 { | 194 { |
195 // FIXME: Right now, we only allow line boxes for inlines that are truly emp
ty. | 195 // FIXME: Right now, we only allow line boxes for inlines that are truly emp
ty. |
196 // We need to fix this, though, because at the very least, inlines containin
g only | 196 // We need to fix this, though, because at the very least, inlines containin
g only |
197 // ignorable whitespace should should also have line boxes. | 197 // ignorable whitespace should should also have line boxes. |
198 return isEmptyInline(flow) && LineLayoutInline(flow).hasInlineDirectionBorde
rsPaddingOrMargin(); | 198 return isEmptyInline(flow) && LineLayoutInline(flow).hasInlineDirectionBorde
rsPaddingOrMargin(); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if (m_layoutTextInfo.m_text != layoutText) { | 595 if (m_layoutTextInfo.m_text != layoutText) { |
596 m_layoutTextInfo.m_text = layoutText; | 596 m_layoutTextInfo.m_text = layoutText; |
597 m_layoutTextInfo.m_font = &font; | 597 m_layoutTextInfo.m_font = &font; |
598 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(layou
tText.text(), style.locale()); | 598 m_layoutTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(layou
tText.text(), style.locale()); |
599 } else if (m_layoutTextInfo.m_font != &font) { | 599 } else if (m_layoutTextInfo.m_font != &font) { |
600 m_layoutTextInfo.m_font = &font; | 600 m_layoutTextInfo.m_font = &font; |
601 } | 601 } |
602 | 602 |
603 // Non-zero only when kerning is enabled, in which case we measure | 603 // Non-zero only when kerning is enabled, in which case we measure |
604 // words with their trailing space, then subtract its width. | 604 // words with their trailing space, then subtract its width. |
605 float wordTrailingSpaceWidth = (font.fontDescription().getTypesettingFeature
s() & Kerning) ? | 605 float wordTrailingSpaceWidth = (font.getFontDescription().getTypesettingFeat
ures() & Kerning) ? |
606 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc
tion())) + wordSpacing | 606 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc
tion())) + wordSpacing |
607 : 0; | 607 : 0; |
608 | 608 |
609 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter(); | 609 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter(); |
610 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL
astCharacter(); | 610 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL
astCharacter(); |
611 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement
InTextNode()) { | 611 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement
InTextNode()) { |
612 bool previousCharacterIsSpace = m_currentCharacterIsSpace; | 612 bool previousCharacterIsSpace = m_currentCharacterIsSpace; |
613 UChar c = m_current.current(); | 613 UChar c = m_current.current(); |
614 m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharac
ter || (!m_preservesNewline && (c == newlineCharacter)); | 614 m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharac
ter || (!m_preservesNewline && (c == newlineCharacter)); |
615 | 615 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 980 |
981 if (style.getTextIndentType() == TextIndentHanging) | 981 if (style.getTextIndentType() == TextIndentHanging) |
982 indentText = indentText == IndentText ? DoNotIndentText : IndentText; | 982 indentText = indentText == IndentText ? DoNotIndentText : IndentText; |
983 | 983 |
984 return indentText; | 984 return indentText; |
985 } | 985 } |
986 | 986 |
987 } // namespace blink | 987 } // namespace blink |
988 | 988 |
989 #endif // BreakingContextInlineHeaders_h | 989 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |