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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2517383002: Use the font height as caret height instead of the line height (Closed)
Patch Set: fix rebase fail Created 4 years 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
OLDNEW
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 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 LayoutUnit* extraWidthToEndOfLine) { 724 LayoutUnit* extraWidthToEndOfLine) {
725 if (!inlineBox) 725 if (!inlineBox)
726 return LayoutRect(); 726 return LayoutRect();
727 727
728 ASSERT(inlineBox->isInlineTextBox()); 728 ASSERT(inlineBox->isInlineTextBox());
729 if (!inlineBox->isInlineTextBox()) 729 if (!inlineBox->isInlineTextBox())
730 return LayoutRect(); 730 return LayoutRect();
731 731
732 InlineTextBox* box = toInlineTextBox(inlineBox); 732 InlineTextBox* box = toInlineTextBox(inlineBox);
733 733
734 int height = box->root().selectionHeight().toInt(); 734 int height = (box->root().selectionBottom() -
735 int top = box->root().selectionTop().toInt(); 735 box->root().lineTop()).clampNegativeToZero().toInt();
736 int top = box->root().lineTop().toInt();
736 737
737 // Go ahead and round left to snap it to the nearest pixel. 738 // Go ahead and round left to snap it to the nearest pixel.
738 LayoutUnit left = box->positionForOffset(caretOffset); 739 LayoutUnit left = box->positionForOffset(caretOffset);
739 740
740 // Distribute the caret's width to either side of the offset. 741 // Distribute the caret's width to either side of the offset.
741 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2; 742 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2;
742 left -= caretWidthLeftOfOffset; 743 left -= caretWidthLeftOfOffset;
743 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset; 744 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset;
744 745
745 left = LayoutUnit(left.round()); 746 left = LayoutUnit(left.round());
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 LayoutRect rect = LayoutRect( 1974 LayoutRect rect = LayoutRect(
1974 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 1975 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
1975 LayoutBlock* block = containingBlock(); 1976 LayoutBlock* block = containingBlock();
1976 if (block && hasTextBoxes()) 1977 if (block && hasTextBoxes())
1977 block->adjustChildDebugRect(rect); 1978 block->adjustChildDebugRect(rect);
1978 1979
1979 return rect; 1980 return rect;
1980 } 1981 }
1981 1982
1982 } // namespace blink 1983 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698