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

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

Issue 2683233005: Set caret width based on device scale factor (Closed)
Patch Set: Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 4525 matching lines...) Expand 10 before | Expand all | Expand 10 after
4536 LayoutRect LayoutBox::localCaretRect(InlineBox* box, 4536 LayoutRect LayoutBox::localCaretRect(InlineBox* box,
4537 int caretOffset, 4537 int caretOffset,
4538 LayoutUnit* extraWidthToEndOfLine) { 4538 LayoutUnit* extraWidthToEndOfLine) {
4539 // VisiblePositions at offsets inside containers either a) refer to the 4539 // VisiblePositions at offsets inside containers either a) refer to the
4540 // positions before/after those containers (tables and select elements) or 4540 // positions before/after those containers (tables and select elements) or
4541 // b) refer to the position inside an empty block. 4541 // b) refer to the position inside an empty block.
4542 // They never refer to children. 4542 // They never refer to children.
4543 // FIXME: Paint the carets inside empty blocks differently than the carets 4543 // FIXME: Paint the carets inside empty blocks differently than the carets
4544 // before/after elements. 4544 // before/after elements.
4545 4545
4546 LayoutRect rect(location(), LayoutSize(caretWidth(), size().height())); 4546 LayoutRect rect(
4547 location(),
4548 LayoutSize(caretWidth(frameView()->getHostWindow()), size().height()));
oshima 2017/02/10 19:55:16 just get noce
malaykeshav 2017/02/10 21:00:54 Done
4547 bool ltr = 4549 bool ltr =
4548 box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection(); 4550 box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection();
4549 4551
4550 if ((!caretOffset) ^ ltr) 4552 if ((!caretOffset) ^ ltr)
4551 rect.move(LayoutSize(size().width() - caretWidth(), LayoutUnit())); 4553 rect.move(
4554 LayoutSize(size().width() - caretWidth(frameView()->getHostWindow()),
4555 LayoutUnit()));
4552 4556
4553 if (box) { 4557 if (box) {
4554 RootInlineBox& rootBox = box->root(); 4558 RootInlineBox& rootBox = box->root();
4555 LayoutUnit top = rootBox.lineTop(); 4559 LayoutUnit top = rootBox.lineTop();
4556 rect.setY(top); 4560 rect.setY(top);
4557 rect.setHeight(rootBox.lineBottom() - top); 4561 rect.setHeight(rootBox.lineBottom() - top);
4558 } 4562 }
4559 4563
4560 // If height of box is smaller than font height, use the latter one, 4564 // If height of box is smaller than font height, use the latter one,
4561 // otherwise the caret might become invisible. 4565 // otherwise the caret might become invisible.
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
5705 block->adjustChildDebugRect(rect); 5709 block->adjustChildDebugRect(rect);
5706 5710
5707 return rect; 5711 return rect;
5708 } 5712 }
5709 5713
5710 bool LayoutBox::shouldClipOverflow() const { 5714 bool LayoutBox::shouldClipOverflow() const {
5711 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5715 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5712 } 5716 }
5713 5717
5714 } // namespace blink 5718 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698