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

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

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No reference reassignment. Created 6 years, 9 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
« 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 25 matching lines...) Expand all
36 36
37 const unsigned short cNoTruncation = USHRT_MAX; 37 const unsigned short cNoTruncation = USHRT_MAX;
38 const unsigned short cFullTruncation = USHRT_MAX - 1; 38 const unsigned short cFullTruncation = USHRT_MAX - 1;
39 39
40 // Helper functions shared by InlineTextBox / SVGRootInlineBox 40 // Helper functions shared by InlineTextBox / SVGRootInlineBox
41 void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color & strokeColor, float strokeThickness, ColorSpace); 41 void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color & strokeColor, float strokeThickness, ColorSpace);
42 Color correctedTextColor(Color textColor, Color backgroundColor); 42 Color correctedTextColor(Color textColor, Color backgroundColor);
43 43
44 class InlineTextBox : public InlineBox { 44 class InlineTextBox : public InlineBox {
45 public: 45 public:
46 InlineTextBox(RenderObject* obj) 46 InlineTextBox(RenderObject& obj)
47 : InlineBox(obj) 47 : InlineBox(obj)
48 , m_prevTextBox(0) 48 , m_prevTextBox(0)
49 , m_nextTextBox(0) 49 , m_nextTextBox(0)
50 , m_start(0) 50 , m_start(0)
51 , m_len(0) 51 , m_len(0)
52 , m_truncation(cNoTruncation) 52 , m_truncation(cNoTruncation)
53 { 53 {
54 } 54 }
55 55
56 virtual void destroy() OVERRIDE FINAL; 56 virtual void destroy() OVERRIDE FINAL;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 virtual LayoutRect localSelectionRect(int startPos, int endPos); 116 virtual LayoutRect localSelectionRect(int startPos, int endPos);
117 bool isSelected(int startPos, int endPos) const; 117 bool isSelected(int startPos, int endPos) const;
118 void selectionStartEnd(int& sPos, int& ePos); 118 void selectionStartEnd(int& sPos, int& ePos);
119 119
120 protected: 120 protected:
121 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE; 121 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE;
122 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE; 122 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
123 123
124 public: 124 public:
125 RenderText* textRenderer() const; 125 RenderText& textRenderer() const;
126 126
127 private: 127 private:
128 virtual void deleteLine() OVERRIDE FINAL; 128 virtual void deleteLine() OVERRIDE FINAL;
129 virtual void extractLine() OVERRIDE FINAL; 129 virtual void extractLine() OVERRIDE FINAL;
130 virtual void attachLine() OVERRIDE FINAL; 130 virtual void attachLine() OVERRIDE FINAL;
131 131
132 public: 132 public:
133 virtual RenderObject::SelectionState selectionState() OVERRIDE FINAL; 133 virtual RenderObject::SelectionState selectionState() OVERRIDE FINAL;
134 134
135 private: 135 private:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 TextRun::ExpansionBehavior expansionBehavior() const 191 TextRun::ExpansionBehavior expansionBehavior() const
192 { 192 {
193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion) 193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion)
194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion); 194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion);
195 } 195 }
196 }; 196 };
197 197
198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
199 199
200 inline RenderText* InlineTextBox::textRenderer() const 200 inline RenderText& InlineTextBox::textRenderer() const
201 { 201 {
202 return toRenderText(renderer()); 202 return toRenderText(renderer());
203 } 203 }
204 204
205 void alignSelectionRectToDevicePixels(FloatRect&); 205 void alignSelectionRectToDevicePixels(FloatRect&);
206 206
207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
208 { 208 {
209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x())
210 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY()); 210 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
211 } 211 }
212 212
213 } // namespace WebCore 213 } // namespace WebCore
214 214
215 #endif // InlineTextBox_h 215 #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