| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 { | 141 { |
| 142 SelectionState state = getLineLayoutItem().getSelectionState(); | 142 SelectionState state = getLineLayoutItem().getSelectionState(); |
| 143 if (state == SelectionStart || state == SelectionEnd || state == SelectionBo
th) { | 143 if (state == SelectionStart || state == SelectionEnd || state == SelectionBo
th) { |
| 144 int startPos, endPos; | 144 int startPos, endPos; |
| 145 getLineLayoutItem().selectionStartEnd(startPos, endPos); | 145 getLineLayoutItem().selectionStartEnd(startPos, endPos); |
| 146 // The position after a hard line break is considered to be past its end
. | 146 // The position after a hard line break is considered to be past its end
. |
| 147 // See the corresponding code in InlineTextBox::isSelected. | 147 // See the corresponding code in InlineTextBox::isSelected. |
| 148 int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0); | 148 int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0); |
| 149 | 149 |
| 150 // FIXME: Remove -webkit-line-break: LineBreakAfterWhiteSpace. | 150 // FIXME: Remove -webkit-line-break: LineBreakAfterWhiteSpace. |
| 151 int endOfLineAdjustmentForCSSLineBreak = getLineLayoutItem().style()->li
neBreak() == LineBreakAfterWhiteSpace ? -1 : 0; | 151 int endOfLineAdjustmentForCSSLineBreak = getLineLayoutItem().style()->ge
tLineBreak() == LineBreakAfterWhiteSpace ? -1 : 0; |
| 152 bool start = (state != SelectionEnd && startPos >= m_start && startPos <
= m_start + m_len + endOfLineAdjustmentForCSSLineBreak); | 152 bool start = (state != SelectionEnd && startPos >= m_start && startPos <
= m_start + m_len + endOfLineAdjustmentForCSSLineBreak); |
| 153 bool end = (state != SelectionStart && endPos > m_start && endPos <= las
tSelectable); | 153 bool end = (state != SelectionStart && endPos > m_start && endPos <= las
tSelectable); |
| 154 if (start && end) | 154 if (start && end) |
| 155 state = SelectionBoth; | 155 state = SelectionBoth; |
| 156 else if (start) | 156 else if (start) |
| 157 state = SelectionStart; | 157 state = SelectionStart; |
| 158 else if (end) | 158 else if (end) |
| 159 state = SelectionEnd; | 159 state = SelectionEnd; |
| 160 else if ((state == SelectionEnd || startPos < m_start) | 160 else if ((state == SelectionEnd || startPos < m_start) |
| 161 && (state == SelectionStart || endPos > lastSelectable)) | 161 && (state == SelectionStart || endPos > lastSelectable)) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 getLineLayoutItem().updateHitTestResult(result, flipForWritingMode(locat
ionInContainer.point() - toLayoutSize(accumulatedOffset))); | 392 getLineLayoutItem().updateHitTestResult(result, flipForWritingMode(locat
ionInContainer.point() - toLayoutSize(accumulatedOffset))); |
| 393 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), loca
tionInContainer, rect) == StopHitTesting) | 393 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), loca
tionInContainer, rect) == StopHitTesting) |
| 394 return true; | 394 return true; |
| 395 } | 395 } |
| 396 return false; | 396 return false; |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph
asisPosition& emphasisPosition) const | 399 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph
asisPosition& emphasisPosition) const |
| 400 { | 400 { |
| 401 // This function returns true if there are text emphasis marks and they are
suppressed by ruby text. | 401 // This function returns true if there are text emphasis marks and they are
suppressed by ruby text. |
| 402 if (style.textEmphasisMark() == TextEmphasisMarkNone) | 402 if (style.getTextEmphasisMark() == TextEmphasisMarkNone) |
| 403 return false; | 403 return false; |
| 404 | 404 |
| 405 emphasisPosition = style.textEmphasisPosition(); | 405 emphasisPosition = style.getTextEmphasisPosition(); |
| 406 if (emphasisPosition == TextEmphasisPositionUnder) | 406 if (emphasisPosition == TextEmphasisPositionUnder) |
| 407 return true; // Ruby text is always over, so it cannot suppress emphasis
marks under. | 407 return true; // Ruby text is always over, so it cannot suppress emphasis
marks under. |
| 408 | 408 |
| 409 LineLayoutBox containingBlock = getLineLayoutItem().containingBlock(); | 409 LineLayoutBox containingBlock = getLineLayoutItem().containingBlock(); |
| 410 if (!containingBlock.isRubyBase()) | 410 if (!containingBlock.isRubyBase()) |
| 411 return true; // This text is not inside a ruby base, so it does not have
ruby text over it. | 411 return true; // This text is not inside a ruby base, so it does not have
ruby text over it. |
| 412 | 412 |
| 413 if (!containingBlock.parent().isRubyRun()) | 413 if (!containingBlock.parent().isRubyRun()) |
| 414 return true; // Cannot get the ruby text. | 414 return true; // Cannot get the ruby text. |
| 415 | 415 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 charactersWithHyphen->reserveCapacity(string.length() + hyphenString.len
gth()); | 576 charactersWithHyphen->reserveCapacity(string.length() + hyphenString.len
gth()); |
| 577 charactersWithHyphen->append(string); | 577 charactersWithHyphen->append(string); |
| 578 charactersWithHyphen->append(hyphenString); | 578 charactersWithHyphen->append(hyphenString); |
| 579 string = charactersWithHyphen->toString().createView(); | 579 string = charactersWithHyphen->toString().createView(); |
| 580 maximumLength = string.length(); | 580 maximumLength = string.length(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 ASSERT(maximumLength >= static_cast<int>(string.length())); | 583 ASSERT(maximumLength >= static_cast<int>(string.length())); |
| 584 | 584 |
| 585 TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(), d
irection(), dirOverride() || style.rtlOrdering() == VisualOrder); | 585 TextRun run(string, textPos().toFloat(), expansion(), expansionBehavior(), d
irection(), dirOverride() || style.rtlOrdering() == VisualOrder); |
| 586 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); | 586 run.setTabSize(!style.collapseWhiteSpace(), style.getTabSize()); |
| 587 run.setTextJustify(style.textJustify()); | 587 run.setTextJustify(style.getTextJustify()); |
| 588 | 588 |
| 589 // Propagate the maximum length of the characters buffer to the TextRun, eve
n when we're only processing a substring. | 589 // Propagate the maximum length of the characters buffer to the TextRun, eve
n when we're only processing a substring. |
| 590 run.setCharactersLength(maximumLength); | 590 run.setCharactersLength(maximumLength); |
| 591 ASSERT(run.charactersLength() >= run.length()); | 591 ASSERT(run.charactersLength() >= run.length()); |
| 592 return run; | 592 return run; |
| 593 } | 593 } |
| 594 | 594 |
| 595 TextRun InlineTextBox::constructTextRunForInspector(const ComputedStyle& style,
const Font& font) const | 595 TextRun InlineTextBox::constructTextRunForInspector(const ComputedStyle& style,
const Font& font) const |
| 596 { | 596 { |
| 597 return InlineTextBox::constructTextRun(style, font); | 597 return InlineTextBox::constructTextRun(style, font); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 626 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer(
)); | 626 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer(
)); |
| 627 const int layoutObjectCharacterOffset = 75; | 627 const int layoutObjectCharacterOffset = 75; |
| 628 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 628 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) |
| 629 fputc(' ', stderr); | 629 fputc(' ', stderr); |
| 630 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 630 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 631 } | 631 } |
| 632 | 632 |
| 633 #endif | 633 #endif |
| 634 | 634 |
| 635 } // namespace blink | 635 } // namespace blink |
| OLD | NEW |