| 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. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
| 5 * All rights reserved. | 5 * All rights reserved. |
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Bail out as currently looking up selection state can cause the editing code | 197 // Bail out as currently looking up selection state can cause the editing code |
| 198 // can force a re-layout while scrutinizing the editing position, and | 198 // can force a re-layout while scrutinizing the editing position, and |
| 199 // InlineTextBox instances are not guaranteed to survive a re-layout. | 199 // InlineTextBox instances are not guaranteed to survive a re-layout. |
| 200 if (getLineLayoutItem().needsLayout()) | 200 if (getLineLayoutItem().needsLayout()) |
| 201 return false; | 201 return false; |
| 202 | 202 |
| 203 SelectionState state = getSelectionState(); | 203 SelectionState state = getSelectionState(); |
| 204 return (state == SelectionStart || state == SelectionInside) | 204 return (state == SelectionStart || state == SelectionInside) |
| 205 // Checking last leaf child can be slow, so we make sure to do this | 205 // Checking last leaf child can be slow, so we make sure to do this |
| 206 // only after the other simple conditionals. | 206 // only after the other simple conditionals. |
| 207 && (root().lastLeafChild() == this) | 207 && |
| 208 (root().lastLeafChild() == this) |
| 208 // It's possible to have mixed LTR/RTL on a single line, and we only | 209 // It's possible to have mixed LTR/RTL on a single line, and we only |
| 209 // want to paint a newline when we're the last leaf child and we make | 210 // want to paint a newline when we're the last leaf child and we make |
| 210 // sure there isn't a differently-directioned box following us. | 211 // sure there isn't a differently-directioned box following us. |
| 211 && ((!isLeftToRightDirection() && root().firstSelectedBox() == this) || | 212 && |
| 212 (isLeftToRightDirection() && root().lastSelectedBox() == this)); | 213 ((!isLeftToRightDirection() && root().firstSelectedBox() == this) || |
| 214 (isLeftToRightDirection() && root().lastSelectedBox() == this)); |
| 213 } | 215 } |
| 214 | 216 |
| 215 float InlineTextBox::newlineSpaceWidth() const { | 217 float InlineTextBox::newlineSpaceWidth() const { |
| 216 const ComputedStyle& styleToUse = | 218 const ComputedStyle& styleToUse = |
| 217 getLineLayoutItem().styleRef(isFirstLineStyle()); | 219 getLineLayoutItem().styleRef(isFirstLineStyle()); |
| 218 return styleToUse.font().spaceWidth(); | 220 return styleToUse.font().spaceWidth(); |
| 219 } | 221 } |
| 220 | 222 |
| 221 LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const { | 223 LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const { |
| 222 int sPos = std::max(startPos - m_start, 0); | 224 int sPos = std::max(startPos - m_start, 0); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 LayoutUnit /*lineBottom*/) { | 413 LayoutUnit /*lineBottom*/) { |
| 412 if (isLineBreak() || m_truncation == cFullTruncation) | 414 if (isLineBreak() || m_truncation == cFullTruncation) |
| 413 return false; | 415 return false; |
| 414 | 416 |
| 415 LayoutPoint boxOrigin = physicalLocation(); | 417 LayoutPoint boxOrigin = physicalLocation(); |
| 416 boxOrigin.moveBy(accumulatedOffset); | 418 boxOrigin.moveBy(accumulatedOffset); |
| 417 LayoutRect rect(boxOrigin, size()); | 419 LayoutRect rect(boxOrigin, size()); |
| 418 if (visibleToHitTestRequest(result.hitTestRequest()) && | 420 if (visibleToHitTestRequest(result.hitTestRequest()) && |
| 419 locationInContainer.intersects(rect)) { | 421 locationInContainer.intersects(rect)) { |
| 420 getLineLayoutItem().updateHitTestResult( | 422 getLineLayoutItem().updateHitTestResult( |
| 421 result, flipForWritingMode(locationInContainer.point() - | 423 result, |
| 422 toLayoutSize(accumulatedOffset))); | 424 flipForWritingMode(locationInContainer.point() - |
| 425 toLayoutSize(accumulatedOffset))); |
| 423 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), | 426 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), |
| 424 locationInContainer, | 427 locationInContainer, |
| 425 rect) == StopHitTesting) | 428 rect) == StopHitTesting) |
| 426 return true; | 429 return true; |
| 427 } | 430 } |
| 428 return false; | 431 return false; |
| 429 } | 432 } |
| 430 | 433 |
| 431 bool InlineTextBox::getEmphasisMarkPosition( | 434 bool InlineTextBox::getEmphasisMarkPosition( |
| 432 const ComputedStyle& style, | 435 const ComputedStyle& style, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 const int layoutObjectCharacterOffset = 75; | 691 const int layoutObjectCharacterOffset = 75; |
| 689 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 692 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) |
| 690 fputc(' ', stderr); | 693 fputc(' ', stderr); |
| 691 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), | 694 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), |
| 692 value.utf8().data()); | 695 value.utf8().data()); |
| 693 } | 696 } |
| 694 | 697 |
| 695 #endif | 698 #endif |
| 696 | 699 |
| 697 } // namespace blink | 700 } // namespace blink |
| OLD | NEW |