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

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

Issue 1844723003: Move metrics list storage to LayoutSVGInlineText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2008 Rob Buis <buis@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #ifndef LayoutSVGInlineText_h 22 #ifndef LayoutSVGInlineText_h
23 #define LayoutSVGInlineText_h 23 #define LayoutSVGInlineText_h
24 24
25 #include "core/layout/LayoutText.h" 25 #include "core/layout/LayoutText.h"
26 #include "core/layout/svg/SVGTextLayoutAttributes.h" 26 #include "core/layout/svg/SVGTextLayoutAttributes.h"
27 #include "core/layout/svg/SVGTextMetrics.h"
28 #include "wtf/Vector.h"
27 29
28 namespace blink { 30 namespace blink {
29 31
30 class LayoutSVGInlineText final : public LayoutText { 32 class LayoutSVGInlineText final : public LayoutText {
31 public: 33 public:
32 LayoutSVGInlineText(Node*, PassRefPtr<StringImpl>); 34 LayoutSVGInlineText(Node*, PassRefPtr<StringImpl>);
33 35
34 bool characterStartsNewTextChunk(int position) const; 36 bool characterStartsNewTextChunk(int position) const;
35 SVGTextLayoutAttributes* layoutAttributes() { return &m_layoutAttributes; } 37 SVGTextLayoutAttributes* layoutAttributes() { return &m_layoutAttributes; }
36 const SVGTextLayoutAttributes* layoutAttributes() const { return &m_layoutAt tributes; } 38 const SVGTextLayoutAttributes* layoutAttributes() const { return &m_layoutAt tributes; }
37 39
40 Vector<SVGTextMetrics>& metricsList() { return m_metrics; }
41 const Vector<SVGTextMetrics>& metricsList() const { return m_metrics; }
42
38 float scalingFactor() const { return m_scalingFactor; } 43 float scalingFactor() const { return m_scalingFactor; }
39 const Font& scaledFont() const { return m_scaledFont; } 44 const Font& scaledFont() const { return m_scaledFont; }
40 void updateScaledFont(); 45 void updateScaledFont();
41 static void computeNewScaledFontForStyle(LayoutObject*, float& scalingFactor , Font& scaledFont); 46 static void computeNewScaledFontForStyle(LayoutObject*, float& scalingFactor , Font& scaledFont);
42 47
43 // Preserves floating point precision for the use in DRT. It knows how to ro und and does a better job than enclosingIntRect. 48 // Preserves floating point precision for the use in DRT. It knows how to ro und and does a better job than enclosingIntRect.
44 FloatRect floatLinesBoundingBox() const; 49 FloatRect floatLinesBoundingBox() const;
45 50
46 PassRefPtr<StringImpl> originalText() const override; 51 PassRefPtr<StringImpl> originalText() const override;
47 52
(...skipping 11 matching lines...) Expand all
59 LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidt hToEndOfLine = nullptr) override; 64 LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidt hToEndOfLine = nullptr) override;
60 IntRect linesBoundingBox() const override; 65 IntRect linesBoundingBox() const override;
61 InlineTextBox* createTextBox(int start, unsigned short length) override; 66 InlineTextBox* createTextBox(int start, unsigned short length) override;
62 67
63 LayoutRect absoluteClippedOverflowRect() const final; 68 LayoutRect absoluteClippedOverflowRect() const final;
64 FloatRect paintInvalidationRectInLocalSVGCoordinates() const final; 69 FloatRect paintInvalidationRectInLocalSVGCoordinates() const final;
65 70
66 float m_scalingFactor; 71 float m_scalingFactor;
67 Font m_scaledFont; 72 Font m_scaledFont;
68 SVGTextLayoutAttributes m_layoutAttributes; 73 SVGTextLayoutAttributes m_layoutAttributes;
74 Vector<SVGTextMetrics> m_metrics;
69 }; 75 };
70 76
71 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGInlineText, isSVGInlineText()); 77 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGInlineText, isSVGInlineText());
72 78
73 } // namespace blink 79 } // namespace blink
74 80
75 #endif // LayoutSVGInlineText_h 81 #endif // LayoutSVGInlineText_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698