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

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

Issue 2518363003: Refactor InlineBox::calculateBoundaries() (Closed)
Patch Set: Rebase 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 * 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset); 117 LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset);
118 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x(); 118 LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x();
119 return LayoutRect(x, rect.y(), caretWidth(), rect.height()); 119 return LayoutRect(x, rect.y(), caretWidth(), rect.height());
120 } 120 }
121 121
122 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const { 122 FloatRect LayoutSVGInlineText::floatLinesBoundingBox() const {
123 FloatRect boundingBox; 123 FloatRect boundingBox;
124 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) 124 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
125 boundingBox.unite(FloatRect(box->calculateBoundaries())); 125 boundingBox.unite(FloatRect(box->frameRect()));
126 return boundingBox; 126 return boundingBox;
127 } 127 }
128 128
129 LayoutRect LayoutSVGInlineText::linesBoundingBox() const { 129 LayoutRect LayoutSVGInlineText::linesBoundingBox() const {
130 return enclosingLayoutRect(floatLinesBoundingBox()); 130 return enclosingLayoutRect(floatLinesBoundingBox());
131 } 131 }
132 132
133 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const { 133 bool LayoutSVGInlineText::characterStartsNewTextChunk(int position) const {
134 ASSERT(position >= 0); 134 ASSERT(position >= 0);
135 ASSERT(position < static_cast<int>(textLength())); 135 ASSERT(position < static_cast<int>(textLength()));
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { 415 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const {
416 RefPtr<StringImpl> result = LayoutText::originalText(); 416 RefPtr<StringImpl> result = LayoutText::originalText();
417 if (!result) 417 if (!result)
418 return nullptr; 418 return nullptr;
419 return normalizeWhitespace(result); 419 return normalizeWhitespace(result);
420 } 420 }
421 421
422 } // namespace blink 422 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698