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

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

Issue 414863002: Minimize RenderObject* casting to RenderText* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 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
« no previous file with comments | « Source/core/rendering/InlineFlowBox.cpp ('k') | Source/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
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 *
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 InlineTextBox(RenderObject& obj) 42 InlineTextBox(RenderObject& obj)
43 : InlineBox(obj) 43 : InlineBox(obj)
44 , m_prevTextBox(0) 44 , m_prevTextBox(0)
45 , m_nextTextBox(0) 45 , m_nextTextBox(0)
46 , m_start(0) 46 , m_start(0)
47 , m_len(0) 47 , m_len(0)
48 , m_truncation(cNoTruncation) 48 , m_truncation(cNoTruncation)
49 { 49 {
50 } 50 }
51 51
52 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); }
53
52 virtual void destroy() OVERRIDE FINAL; 54 virtual void destroy() OVERRIDE FINAL;
53 55
54 InlineTextBox* prevTextBox() const { return m_prevTextBox; } 56 InlineTextBox* prevTextBox() const { return m_prevTextBox; }
55 InlineTextBox* nextTextBox() const { return m_nextTextBox; } 57 InlineTextBox* nextTextBox() const { return m_nextTextBox; }
56 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } 58 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
57 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } 59 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
58 60
59 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264 61 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264
60 unsigned start() const { return m_start; } 62 unsigned start() const { return m_start; }
61 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } 63 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); } 110 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); }
109 111
110 virtual LayoutRect localSelectionRect(int startPos, int endPos); 112 virtual LayoutRect localSelectionRect(int startPos, int endPos);
111 bool isSelected(int startPos, int endPos) const; 113 bool isSelected(int startPos, int endPos) const;
112 void selectionStartEnd(int& sPos, int& ePos); 114 void selectionStartEnd(int& sPos, int& ePos);
113 115
114 protected: 116 protected:
115 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE; 117 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE;
116 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE; 118 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
117 119
118 public:
119 RenderText& textRenderer() const { return toRenderText(renderer()); }
120
121 private: 120 private:
122 virtual void deleteLine() OVERRIDE FINAL; 121 virtual void deleteLine() OVERRIDE FINAL;
123 virtual void extractLine() OVERRIDE FINAL; 122 virtual void extractLine() OVERRIDE FINAL;
124 virtual void attachLine() OVERRIDE FINAL; 123 virtual void attachLine() OVERRIDE FINAL;
125 124
126 public: 125 public:
127 virtual RenderObject::SelectionState selectionState() OVERRIDE FINAL; 126 virtual RenderObject::SelectionState selectionState() OVERRIDE FINAL;
128 127
129 private: 128 private:
130 virtual void clearTruncation() OVERRIDE FINAL { m_truncation = cNoTruncation ; } 129 virtual void clearTruncation() OVERRIDE FINAL { m_truncation = cNoTruncation ; }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 198
200 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 199 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
201 { 200 {
202 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 201 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x())
203 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY()); 202 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
204 } 203 }
205 204
206 } // namespace blink 205 } // namespace blink
207 206
208 #endif // InlineTextBox_h 207 #endif // InlineTextBox_h
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineFlowBox.cpp ('k') | Source/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698