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

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: Sync with ToT again 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 4532 matching lines...) Expand 10 before | Expand all | Expand 10 after
4543 4543
4544 LayoutRect LayoutBox::localCaretRect(InlineBox* box, 4544 LayoutRect LayoutBox::localCaretRect(InlineBox* box,
4545 int caretOffset, 4545 int caretOffset,
4546 LayoutUnit* extraWidthToEndOfLine) { 4546 LayoutUnit* extraWidthToEndOfLine) {
4547 // VisiblePositions at offsets inside containers either a) refer to the 4547 // VisiblePositions at offsets inside containers either a) refer to the
4548 // positions before/after those containers (tables and select elements) or 4548 // positions before/after those containers (tables and select elements) or
4549 // b) refer to the position inside an empty block. 4549 // b) refer to the position inside an empty block.
4550 // They never refer to children. 4550 // They never refer to children.
4551 // FIXME: Paint the carets inside empty blocks differently than the carets 4551 // FIXME: Paint the carets inside empty blocks differently than the carets
4552 // before/after elements. 4552 // before/after elements.
4553 4553 LayoutUnit caretWidth = frameView()->caretWidth();
4554 LayoutRect rect(location(), LayoutSize(caretWidth(), size().height())); 4554 LayoutRect rect(location(), LayoutSize(caretWidth, size().height()));
4555 bool ltr = 4555 bool ltr =
4556 box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection(); 4556 box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection();
4557 4557
4558 if ((!caretOffset) ^ ltr) 4558 if ((!caretOffset) ^ ltr)
4559 rect.move(LayoutSize(size().width() - caretWidth(), LayoutUnit())); 4559 rect.move(LayoutSize(size().width() - caretWidth, LayoutUnit()));
4560 4560
4561 if (box) { 4561 if (box) {
4562 RootInlineBox& rootBox = box->root(); 4562 RootInlineBox& rootBox = box->root();
4563 LayoutUnit top = rootBox.lineTop(); 4563 LayoutUnit top = rootBox.lineTop();
4564 rect.setY(top); 4564 rect.setY(top);
4565 rect.setHeight(rootBox.lineBottom() - top); 4565 rect.setHeight(rootBox.lineBottom() - top);
4566 } 4566 }
4567 4567
4568 // If height of box is smaller than font height, use the latter one, 4568 // If height of box is smaller than font height, use the latter one,
4569 // otherwise the caret might become invisible. 4569 // otherwise the caret might become invisible.
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 block->adjustChildDebugRect(rect); 5714 block->adjustChildDebugRect(rect);
5715 5715
5716 return rect; 5716 return rect;
5717 } 5717 }
5718 5718
5719 bool LayoutBox::shouldClipOverflow() const { 5719 bool LayoutBox::shouldClipOverflow() const {
5720 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5720 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5721 } 5721 }
5722 5722
5723 } // namespace blink 5723 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698