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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.cpp ('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) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/layout/svg/LayoutSVGInlineText.h" 24 #include "core/layout/svg/LayoutSVGInlineText.h"
25 25
26 #include "core/css/CSSFontSelector.h" 26 #include "core/css/CSSFontSelector.h"
27 #include "core/css/FontSize.h" 27 #include "core/css/FontSize.h"
28 #include "core/dom/StyleEngine.h" 28 #include "core/dom/StyleEngine.h"
29 #include "core/editing/TextAffinity.h" 29 #include "core/editing/TextAffinity.h"
30 #include "core/editing/VisiblePosition.h" 30 #include "core/editing/VisiblePosition.h"
31 #include "core/frame/FrameView.h"
31 #include "core/layout/svg/LayoutSVGText.h" 32 #include "core/layout/svg/LayoutSVGText.h"
32 #include "core/layout/svg/SVGLayoutSupport.h" 33 #include "core/layout/svg/SVGLayoutSupport.h"
33 #include "core/layout/svg/line/SVGInlineTextBox.h" 34 #include "core/layout/svg/line/SVGInlineTextBox.h"
34 #include "platform/fonts/CharacterRange.h" 35 #include "platform/fonts/CharacterRange.h"
35 #include "platform/text/BidiCharacterRun.h" 36 #include "platform/text/BidiCharacterRun.h"
36 #include "platform/text/BidiResolver.h" 37 #include "platform/text/BidiResolver.h"
37 #include "platform/text/TextDirection.h" 38 #include "platform/text/TextDirection.h"
38 #include "platform/text/TextRun.h" 39 #include "platform/text/TextRun.h"
39 #include "platform/text/TextRunIterator.h" 40 #include "platform/text/TextRunIterator.h"
40 41
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 InlineTextBox* textBox = toInlineTextBox(box); 106 InlineTextBox* textBox = toInlineTextBox(box);
106 if (static_cast<unsigned>(caretOffset) < textBox->start() || 107 if (static_cast<unsigned>(caretOffset) < textBox->start() ||
107 static_cast<unsigned>(caretOffset) > textBox->start() + textBox->len()) 108 static_cast<unsigned>(caretOffset) > textBox->start() + textBox->len())
108 return LayoutRect(); 109 return LayoutRect();
109 110
110 // Use the edge of the selection rect to determine the caret rect. 111 // Use the edge of the selection rect to determine the caret rect.
111 if (static_cast<unsigned>(caretOffset) < textBox->start() + textBox->len()) { 112 if (static_cast<unsigned>(caretOffset) < textBox->start() + textBox->len()) {
112 LayoutRect rect = textBox->localSelectionRect(caretOffset, caretOffset + 1); 113 LayoutRect rect = textBox->localSelectionRect(caretOffset, caretOffset + 1);
113 LayoutUnit x = box->isLeftToRightDirection() ? rect.x() : rect.maxX(); 114 LayoutUnit x = box->isLeftToRightDirection() ? rect.x() : rect.maxX();
114 return LayoutRect(x, rect.y(), caretWidth(), rect.height()); 115 return LayoutRect(x, rect.y(), frameView()->caretWidth(), rect.height());
115 } 116 }
116 117
117 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset); 118 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset);
118 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x(); 119 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x();
119 return LayoutRect(x, rect.y(), caretWidth(), rect.height()); 120 return LayoutRect(x, rect.y(), frameView()->caretWidth(), rect.height());
120 } 121 }
121 122
122 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const { 123 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const {
123 FloatRect boundingBox; 124 FloatRect boundingBox;
124 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) 125 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
125 boundingBox.unite(FloatRect(box->frameRect())); 126 boundingBox.unite(FloatRect(box->frameRect()));
126 return boundingBox; 127 return boundingBox;
127 } 128 }
128 129
129 LayoutRect LayoutSVGInlineText::linesBoundingBox() const { 130 LayoutRect LayoutSVGInlineText::linesBoundingBox() const {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 416 }
416 417
417 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { 418 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const {
418 RefPtr<StringImpl> result = LayoutText::originalText(); 419 RefPtr<StringImpl> result = LayoutText::originalText();
419 if (!result) 420 if (!result)
420 return nullptr; 421 return nullptr;
421 return normalizeWhitespace(result); 422 return normalizeWhitespace(result);
422 } 423 }
423 424
424 } // namespace blink 425 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutText.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698