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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/AbstractInlineTextBox.h

Issue 1433253003: [Line Layout API] Convert AbstractInlineTextBox to new line layout API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove layoutObject() method Created 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef AbstractInlineTextBox_h 31 #ifndef AbstractInlineTextBox_h
32 #define AbstractInlineTextBox_h 32 #define AbstractInlineTextBox_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/dom/Range.h" 35 #include "core/dom/Range.h"
36 #include "core/layout/LayoutText.h" 36 #include "core/layout/api/LineLayoutText.h"
37 #include "core/layout/line/InlineTextBox.h" 37 #include "core/layout/line/InlineTextBox.h"
38 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
39 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class InlineTextBox; 43 class InlineTextBox;
44 44
45 // High-level abstraction of InlineTextBox to allow the accessibility module to 45 // High-level abstraction of InlineTextBox to allow the accessibility module to
46 // get information about InlineTextBoxes without tight coupling. 46 // get information about InlineTextBoxes without tight coupling.
47 class CORE_EXPORT AbstractInlineTextBox : public RefCounted<AbstractInlineTextBo x> { 47 class CORE_EXPORT AbstractInlineTextBox : public RefCounted<AbstractInlineTextBo x> {
48 private: 48 private:
49 AbstractInlineTextBox(LayoutText* layoutText, InlineTextBox* inlineTextBox) 49 AbstractInlineTextBox(LineLayoutText lineLayoutItem, InlineTextBox* inlineTe xtBox)
50 : m_layoutText(layoutText) 50 : m_lineLayoutItem(lineLayoutItem)
51 , m_inlineTextBox(inlineTextBox) 51 , m_inlineTextBox(inlineTextBox)
52 { 52 {
53 } 53 }
54 54
55 static PassRefPtr<AbstractInlineTextBox> getOrCreate(LayoutText*, InlineText Box*); 55 static PassRefPtr<AbstractInlineTextBox> getOrCreate(LineLayoutText, InlineT extBox*);
56 static void willDestroy(InlineTextBox*); 56 static void willDestroy(InlineTextBox*);
57 57
58 friend class LayoutText; 58 friend class LayoutText;
59 friend class InlineTextBox; 59 friend class InlineTextBox;
60 60
61 public: 61 public:
62 struct WordBoundaries { 62 struct WordBoundaries {
63 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 63 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
64 WordBoundaries(int startIndex, int endIndex) : startIndex(startIndex), e ndIndex(endIndex) { } 64 WordBoundaries(int startIndex, int endIndex) : startIndex(startIndex), e ndIndex(endIndex) { }
65 int startIndex; 65 int startIndex;
66 int endIndex; 66 int endIndex;
67 }; 67 };
68 68
69 enum Direction { 69 enum Direction {
70 LeftToRight, 70 LeftToRight,
71 RightToLeft, 71 RightToLeft,
72 TopToBottom, 72 TopToBottom,
73 BottomToTop 73 BottomToTop
74 }; 74 };
75 75
76 ~AbstractInlineTextBox(); 76 ~AbstractInlineTextBox();
77 77
78 LayoutText* layoutText() const { return m_layoutText; } 78 LineLayoutText lineLayoutItem() const { return m_lineLayoutItem; }
79 79
80 PassRefPtr<AbstractInlineTextBox> nextInlineTextBox() const; 80 PassRefPtr<AbstractInlineTextBox> nextInlineTextBox() const;
81 LayoutRect bounds() const; 81 LayoutRect bounds() const;
82 unsigned len() const; 82 unsigned len() const;
83 Direction direction() const; 83 Direction direction() const;
84 void characterWidths(Vector<float>&) const; 84 void characterWidths(Vector<float>&) const;
85 void wordBoundaries(Vector<WordBoundaries>&) const; 85 void wordBoundaries(Vector<WordBoundaries>&) const;
86 String text() const; 86 String text() const;
87 bool isFirst() const; 87 bool isFirst() const;
88 bool isLast() const; 88 bool isLast() const;
89 PassRefPtr<AbstractInlineTextBox> nextOnLine() const; 89 PassRefPtr<AbstractInlineTextBox> nextOnLine() const;
90 PassRefPtr<AbstractInlineTextBox> previousOnLine() const; 90 PassRefPtr<AbstractInlineTextBox> previousOnLine() const;
91 91
92 private: 92 private:
93 void detach(); 93 void detach();
94 94
95 // Weak ptrs; these are nulled when InlineTextBox::destroy() calls AbstractI nlineTextBox::willDestroy. 95 // Weak ptrs; these are nulled when InlineTextBox::destroy() calls AbstractI nlineTextBox::willDestroy.
96 LayoutText* m_layoutText; 96 LineLayoutText m_lineLayoutItem;
97 InlineTextBox* m_inlineTextBox; 97 InlineTextBox* m_inlineTextBox;
98 98
99 typedef HashMap<InlineTextBox*, RefPtr<AbstractInlineTextBox>> InlineToAbstr actInlineTextBoxHashMap; 99 typedef HashMap<InlineTextBox*, RefPtr<AbstractInlineTextBox>> InlineToAbstr actInlineTextBoxHashMap;
100 static InlineToAbstractInlineTextBoxHashMap* gAbstractInlineTextBoxMap; 100 static InlineToAbstractInlineTextBoxHashMap* gAbstractInlineTextBoxMap;
101 }; 101 };
102 102
103 } // namespace blink 103 } // namespace blink
104 104
105 #endif // AbstractInlineTextBox_h 105 #endif // AbstractInlineTextBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698