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

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

Issue 1861013003: Separate metrics update and layout attribute resolving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplify-layoutattr-invalidation
Patch Set: Rebase 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) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 28 matching lines...) Expand all
39 // These values are propagated to the corresponding LayoutSVGInlineText layoutOb jects. 39 // These values are propagated to the corresponding LayoutSVGInlineText layoutOb jects.
40 // The first layout phase only extracts the relevant information needed in Layou tBlockFlowLine 40 // The first layout phase only extracts the relevant information needed in Layou tBlockFlowLine
41 // to create the InlineBox tree based on text chunk boundaries & BiDi informatio n. 41 // to create the InlineBox tree based on text chunk boundaries & BiDi informatio n.
42 // The second layout phase is carried out by SVGTextLayoutEngine. 42 // The second layout phase is carried out by SVGTextLayoutEngine.
43 43
44 class SVGTextLayoutAttributesBuilder { 44 class SVGTextLayoutAttributesBuilder {
45 DISALLOW_NEW(); 45 DISALLOW_NEW();
46 WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributesBuilder); 46 WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributesBuilder);
47 public: 47 public:
48 SVGTextLayoutAttributesBuilder(); 48 SVGTextLayoutAttributesBuilder();
49 bool buildLayoutAttributesForForSubtree(LayoutSVGText&);
50 49
51 void rebuildMetricsForTextLayoutObject(LayoutSVGText&, LayoutSVGInlineText&) ; 50 void buildLayoutAttributesForTextRoot(LayoutSVGText&);
52 51
53 // Invoked whenever the underlying DOM tree changes, so that m_textPositions is rebuild. 52 // Invoked whenever the underlying DOM tree changes, so that m_textPositions is rebuild.
54 void clearTextPositioningElements() { m_textPositions.clear(); } 53 void clearTextPositioningElements() { m_textPositions.clear(); }
55 unsigned numberOfTextPositioningElements() const { return m_textPositions.si ze(); } 54 unsigned numberOfTextPositioningElements() const { return m_textPositions.si ze(); }
56 55
57 struct TextPosition { 56 struct TextPosition {
58 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 57 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
59 public: 58 public:
60 TextPosition(SVGTextPositioningElement* newElement = nullptr, unsigned n ewStart = 0, unsigned newLength = 0) 59 TextPosition(SVGTextPositioningElement* newElement = nullptr, unsigned n ewStart = 0, unsigned newLength = 0)
61 : element(newElement) 60 : element(newElement)
62 , start(newStart) 61 , start(newStart)
63 , length(newLength) 62 , length(newLength)
64 { 63 {
65 } 64 }
66 65
67 DECLARE_TRACE(); 66 DECLARE_TRACE();
68 67
69 Member<SVGTextPositioningElement> element; 68 Member<SVGTextPositioningElement> element;
70 unsigned start; 69 unsigned start;
71 unsigned length; 70 unsigned length;
72 }; 71 };
73 72
74 private: 73 private:
75 void buildCharacterDataMap(LayoutSVGText&); 74 void buildCharacterDataMap(LayoutSVGText&);
75 void buildLayoutAttributes(LayoutSVGText&) const;
76 void collectTextPositioningElements(LayoutBoxModelObject&, UChar& lastCharac ter); 76 void collectTextPositioningElements(LayoutBoxModelObject&, UChar& lastCharac ter);
77 void fillCharacterDataMap(const TextPosition&); 77 void fillCharacterDataMap(const TextPosition&);
78 78
79 private: 79 private:
80 unsigned m_textLength; 80 unsigned m_textLength;
81 PersistentHeapVector<TextPosition> m_textPositions; 81 PersistentHeapVector<TextPosition> m_textPositions;
82 SVGCharacterDataMap m_characterDataMap; 82 SVGCharacterDataMap m_characterDataMap;
83 }; 83 };
84 84
85 } // namespace blink 85 } // namespace blink
86 86
87 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SVGTextLayoutAttributesBuilder ::TextPosition); 87 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SVGTextLayoutAttributesBuilder ::TextPosition);
88 88
89 #endif 89 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698