Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(922)

Side by Side Diff: Source/core/rendering/RootInlineBox.cpp

Issue 141683003: Return the right top position for text selections when there are no previous root inline boxes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added [ NeedsRebaseline ] for editing/selection/move-left-right.html Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/platform/linux/fast/text/selection-rect-line-height-too-small-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return 0; 396 return 0;
397 } 397 }
398 398
399 LayoutUnit RootInlineBox::selectionTop() const 399 LayoutUnit RootInlineBox::selectionTop() const
400 { 400 {
401 LayoutUnit selectionTop = m_lineTop; 401 LayoutUnit selectionTop = m_lineTop;
402 402
403 if (m_hasAnnotationsBefore) 403 if (m_hasAnnotationsBefore)
404 selectionTop -= !renderer()->style()->isFlippedLinesWritingMode() ? comp uteOverAnnotationAdjustment(m_lineTop) : computeUnderAnnotationAdjustment(m_line Top); 404 selectionTop -= !renderer()->style()->isFlippedLinesWritingMode() ? comp uteOverAnnotationAdjustment(m_lineTop) : computeUnderAnnotationAdjustment(m_line Top);
405 405
406 if (renderer()->style()->isFlippedLinesWritingMode()) 406 if (renderer()->style()->isFlippedLinesWritingMode() || !prevRootBox())
407 return selectionTop; 407 return selectionTop;
408 408
409 LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : b lock()->borderBefore() + block()->paddingBefore(); 409 LayoutUnit prevBottom = prevRootBox()->selectionBottom();
410 if (prevBottom < selectionTop && block()->containsFloats()) { 410 if (prevBottom < selectionTop && block()->containsFloats()) {
411 // This line has actually been moved further down, probably from a large line-height, but possibly because the 411 // This line has actually been moved further down, probably from a large line-height, but possibly because the
412 // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous 412 // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous
413 // line's bottom if the offsets are greater on both sides. 413 // line's bottom if the offsets are greater on both sides.
414 LayoutUnit prevLeft = block()->logicalLeftOffsetForLine(prevBottom, fals e); 414 LayoutUnit prevLeft = block()->logicalLeftOffsetForLine(prevBottom, fals e);
415 LayoutUnit prevRight = block()->logicalRightOffsetForLine(prevBottom, fa lse); 415 LayoutUnit prevRight = block()->logicalRightOffsetForLine(prevBottom, fa lse);
416 LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionTop, fal se); 416 LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionTop, fal se);
417 LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionTop, f alse); 417 LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionTop, f alse);
418 if (prevLeft > newLeft || prevRight < newRight) 418 if (prevLeft > newLeft || prevRight < newRight)
419 return selectionTop; 419 return selectionTop;
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 869 }
870 870
871 #ifndef NDEBUG 871 #ifndef NDEBUG
872 const char* RootInlineBox::boxName() const 872 const char* RootInlineBox::boxName() const
873 { 873 {
874 return "RootInlineBox"; 874 return "RootInlineBox";
875 } 875 }
876 #endif 876 #endif
877 877
878 } // namespace WebCore 878 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/platform/linux/fast/text/selection-rect-line-height-too-small-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698