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

Side by Side Diff: Source/core/rendering/AbstractInlineTextBox.h

Issue 23983002: Expose InlineTextBoxes in the accessibility tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef AbstractInlineTextBox_h
32 #define AbstractInlineTextBox_h
33
34 #include "core/dom/Range.h"
35 #include "core/rendering/InlineTextBox.h"
36 #include "core/rendering/RenderText.h"
37 #include "wtf/HashMap.h"
38 #include "wtf/RefPtr.h"
39
40 namespace WebCore {
41
42 class InlineTextBox;
43
44 enum AbstractInlineTextBoxDirection {
45 AbstractInlineTextBoxDirectionLR,
eseidel 2013/10/17 18:43:26 AbstractLeftToRight, AbstractRightToLeft, Abstract
dmazzoni 2013/10/17 20:39:20 Spelling out LeftToRight, etc. sounds good but "Ab
46 AbstractInlineTextBoxDirectionRL,
47 AbstractInlineTextBoxDirectionTB,
48 AbstractInlineTextBoxDirectionBT
49 };
50
51 // High-level abstraction of InlineTextBox to allow the accessibility module to
52 // get information about InlineTextBoxes without tight coupling.
53 class AbstractInlineTextBox : public RefCounted<AbstractInlineTextBox> {
54 private:
55 AbstractInlineTextBox(RenderText* renderText, InlineTextBox* inlineTextBox)
56 : m_renderText(renderText)
57 , m_inlineTextBox(inlineTextBox)
58 {
59 }
60
61 static PassRefPtr<AbstractInlineTextBox> getOrCreate(RenderText*, InlineText Box*);
62 static void willDestroy(InlineTextBox*);
63
64 friend class RenderText;
65 friend class InlineTextBox;
66
67 public:
68 struct WordBoundaries {
69 WordBoundaries(int startIndex, int endIndex) : startIndex(startIndex), e ndIndex(endIndex) { }
70 int startIndex;
71 int endIndex;
72 };
73
74 RenderText* renderText() const { return m_renderText; }
75
76 void detach();
77
78 PassRefPtr<AbstractInlineTextBox> nextInlineTextBox() const;
79 LayoutRect bounds() const;
80 unsigned start() const;
81 unsigned len() const;
82 AbstractInlineTextBoxDirection direction() const;
83 void characterWidths(Vector<float>&) const;
84 void wordBoundaries(Vector<WordBoundaries>&) const;
85 String text() const;
86
87 private:
88 RenderText* m_renderText;
eseidel 2013/10/17 18:43:26 I might add a comment like: // These are weak poin
dmazzoni 2013/10/17 20:39:20 Done.
89 InlineTextBox* m_inlineTextBox;
90
91 static HashMap<InlineTextBox*, RefPtr<AbstractInlineTextBox> >* gAbstractInl ineTextBoxMap;
92 };
93
94 } // namespace WebCore
95
96 #endif // AbstractInlineTextBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698