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

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: Update TestExpectations 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html ('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 * (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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 LayoutUnit* extraWidthToEndOfLine) { 726 LayoutUnit* extraWidthToEndOfLine) {
727 if (!inlineBox) 727 if (!inlineBox)
728 return LayoutRect(); 728 return LayoutRect();
729 729
730 ASSERT(inlineBox->isInlineTextBox()); 730 ASSERT(inlineBox->isInlineTextBox());
731 if (!inlineBox->isInlineTextBox()) 731 if (!inlineBox->isInlineTextBox())
732 return LayoutRect(); 732 return LayoutRect();
733 733
734 InlineTextBox* box = toInlineTextBox(inlineBox); 734 InlineTextBox* box = toInlineTextBox(inlineBox);
735 735
736 int height = box->root().selectionHeight().toInt(); 736 int height = style()->font().primaryFont()->getFontMetrics().height();
yosin_UTC9 2016/11/30 01:44:02 Could you use font ascendant and descendant instea
joone 2016/12/02 01:24:43 But, we need the height value and can get it easil
yosin_UTC9 2016/12/02 01:42:35 This function returns rectangle rather than height
737 int top = box->root().selectionTop().toInt(); 737 int top = box->root().selectionBottom().toInt() - height;
738 738
739 // Go ahead and round left to snap it to the nearest pixel. 739 // Go ahead and round left to snap it to the nearest pixel.
740 LayoutUnit left = box->positionForOffset(caretOffset); 740 LayoutUnit left = box->positionForOffset(caretOffset);
741 741
742 // Distribute the caret's width to either side of the offset. 742 // Distribute the caret's width to either side of the offset.
743 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2; 743 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2;
744 left -= caretWidthLeftOfOffset; 744 left -= caretWidthLeftOfOffset;
745 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset; 745 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset;
746 746
747 left = LayoutUnit(left.round()); 747 left = LayoutUnit(left.round());
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 LayoutRect rect = LayoutRect( 1975 LayoutRect rect = LayoutRect(
1976 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 1976 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
1977 LayoutBlock* block = containingBlock(); 1977 LayoutBlock* block = containingBlock();
1978 if (block && hasTextBoxes()) 1978 if (block && hasTextBoxes())
1979 block->adjustChildDebugRect(rect); 1979 block->adjustChildDebugRect(rect);
1980 1980
1981 return rect; 1981 return rect;
1982 } 1982 }
1983 1983
1984 } // namespace blink 1984 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/caret/caret-height-multi-line.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698