| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 LayoutUnit RootInlineBox::selectionTop() const | 372 LayoutUnit RootInlineBox::selectionTop() const |
| 373 { | 373 { |
| 374 LayoutUnit selectionTop = m_lineTop; | 374 LayoutUnit selectionTop = m_lineTop; |
| 375 | 375 |
| 376 if (m_hasAnnotationsBefore) | 376 if (m_hasAnnotationsBefore) |
| 377 selectionTop -= computeOverAnnotationAdjustment(m_lineTop); | 377 selectionTop -= computeOverAnnotationAdjustment(m_lineTop); |
| 378 | 378 |
| 379 if (!prevRootBox()) | 379 if (!prevRootBox()) |
| 380 return selectionTop; | 380 return selectionTop; |
| 381 | 381 |
| 382 LayoutUnit prevBottom = prevRootBox()->selectionBottom(); | 382 return prevRootBox()->selectionBottom(); |
| 383 if (prevBottom < selectionTop && block().containsFloats()) { | |
| 384 // This line has actually been moved further down, probably from a large
line-height, but possibly because the | |
| 385 // line was forced to clear floats. If so, let's check the offsets, and
only be willing to use the previous | |
| 386 // line's bottom if the offsets are greater on both sides. | |
| 387 LayoutUnit prevLeft = block().logicalLeftOffsetForLine(prevBottom, false
); | |
| 388 LayoutUnit prevRight = block().logicalRightOffsetForLine(prevBottom, fal
se); | |
| 389 LayoutUnit newLeft = block().logicalLeftOffsetForLine(selectionTop, fals
e); | |
| 390 LayoutUnit newRight = block().logicalRightOffsetForLine(selectionTop, fa
lse); | |
| 391 if (prevLeft > newLeft || prevRight < newRight) | |
| 392 return selectionTop; | |
| 393 } | |
| 394 | |
| 395 return prevBottom; | |
| 396 } | 383 } |
| 397 | 384 |
| 398 LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const | 385 LayoutUnit RootInlineBox::selectionTopAdjustedForPrecedingBlock() const |
| 399 { | 386 { |
| 400 LayoutUnit top = selectionTop(); | 387 LayoutUnit top = selectionTop(); |
| 401 | 388 |
| 402 RenderObject::SelectionState blockSelectionState = root().block().selectionS
tate(); | 389 RenderObject::SelectionState blockSelectionState = root().block().selectionS
tate(); |
| 403 if (blockSelectionState != RenderObject::SelectionInside && blockSelectionSt
ate != RenderObject::SelectionEnd) | 390 if (blockSelectionState != RenderObject::SelectionInside && blockSelectionSt
ate != RenderObject::SelectionEnd) |
| 404 return top; | 391 return top; |
| 405 | 392 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 806 } |
| 820 | 807 |
| 821 #ifndef NDEBUG | 808 #ifndef NDEBUG |
| 822 const char* RootInlineBox::boxName() const | 809 const char* RootInlineBox::boxName() const |
| 823 { | 810 { |
| 824 return "RootInlineBox"; | 811 return "RootInlineBox"; |
| 825 } | 812 } |
| 826 #endif | 813 #endif |
| 827 | 814 |
| 828 } // namespace blink | 815 } // namespace blink |
| OLD | NEW |