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

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

Issue 203273003: Underline Thickness is not uniform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fix 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 , m_textDecorationThickness(0)
53 { 54 {
54 } 55 }
55 56
56 virtual void destroy() OVERRIDE FINAL; 57 virtual void destroy() OVERRIDE FINAL;
57 58
58 InlineTextBox* prevTextBox() const { return m_prevTextBox; } 59 InlineTextBox* prevTextBox() const { return m_prevTextBox; }
59 InlineTextBox* nextTextBox() const { return m_nextTextBox; } 60 InlineTextBox* nextTextBox() const { return m_nextTextBox; }
60 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } 61 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
61 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } 62 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
62 63
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 public: 113 public:
113 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const; 114 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const;
114 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); } 115 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); }
115 116
116 virtual LayoutRect localSelectionRect(int startPos, int endPos); 117 virtual LayoutRect localSelectionRect(int startPos, int endPos);
117 bool isSelected(int startPos, int endPos) const; 118 bool isSelected(int startPos, int endPos) const;
118 void selectionStartEnd(int& sPos, int& ePos); 119 void selectionStartEnd(int& sPos, int& ePos);
119 120
120 protected: 121 protected:
121 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE; 122 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou tUnit lineBottom) OVERRIDE;
123 virtual void paintDecorationStyle(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom, float decorationThickness) OVERRIDE;
124 virtual void getPaintDecorationSyle(PaintInfo&, const LayoutPoint&, float *) OVERRIDE;
122 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE; 125 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
123 126
124 public: 127 public:
125 RenderText& textRenderer() const; 128 RenderText& textRenderer() const;
126 129
127 private: 130 private:
128 virtual void deleteLine() OVERRIDE FINAL; 131 virtual void deleteLine() OVERRIDE FINAL;
129 virtual void extractLine() OVERRIDE FINAL; 132 virtual void extractLine() OVERRIDE FINAL;
130 virtual void attachLine() OVERRIDE FINAL; 133 virtual void attachLine() OVERRIDE FINAL;
131 134
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 private: 171 private:
169 InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderO bject 172 InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderO bject
170 InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObjec t 173 InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObjec t
171 174
172 int m_start; 175 int m_start;
173 unsigned short m_len; 176 unsigned short m_len;
174 177
175 unsigned short m_truncation; // Where to truncate when text overflow is appl ied. We use special constants to 178 unsigned short m_truncation; // Where to truncate when text overflow is appl ied. We use special constants to
176 // denote no truncation (the whole run paints) and full tr uncation (nothing paints at all). 179 // denote no truncation (the whole run paints) and full tr uncation (nothing paints at all).
177 180
181 float m_textDecorationThickness;
182
178 protected: 183 protected:
179 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigi n, RenderStyle*, const Font&, int startPos, int endPos); 184 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigi n, RenderStyle*, const Font&, int startPos, int endPos);
180 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, Ren derStyle*, const Font&, bool background); 185 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, Ren derStyle*, const Font&, bool background);
181 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin , const CompositionUnderline&); 186 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin , const CompositionUnderline&);
182 187
183 // These functions both paint markers and update the DocumentMarker's render edRect. 188 // These functions both paint markers and update the DocumentMarker's render edRect.
184 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig in, DocumentMarker*, RenderStyle*, const Font&, bool grammar); 189 virtual void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrig in, DocumentMarker*, RenderStyle*, const Font&, bool grammar);
185 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri gin, DocumentMarker*, RenderStyle*, const Font&); 190 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri gin, DocumentMarker*, RenderStyle*, const Font&);
186 191
187 private: 192 private:
188 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDeco ration, const ShadowList*); 193 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDeco ration, const ShadowList*, float decorationThickness = 0);
189 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderSty le*, const Font&, Color textColor); 194 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderSty le*, const Font&, Color textColor);
195 bool isLogicalStartEndCorrect(PaintInfo& , const LayoutPoint&);
190 196
191 TextRun::ExpansionBehavior expansionBehavior() const 197 TextRun::ExpansionBehavior expansionBehavior() const
192 { 198 {
193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion) 199 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion)
194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion); 200 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion);
195 } 201 }
202
203 float getDecorationThickness() { return m_textDecorationThickness; }
204 void setDecorationThickness(float textDecorationThickness) { m_textDecoratio nThickness = textDecorationThickness; }
196 }; 205 };
197 206
198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 207 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
199 208
200 inline RenderText& InlineTextBox::textRenderer() const 209 inline RenderText& InlineTextBox::textRenderer() const
201 { 210 {
202 return toRenderText(renderer()); 211 return toRenderText(renderer());
203 } 212 }
204 213
205 void alignSelectionRectToDevicePixels(FloatRect&); 214 void alignSelectionRectToDevicePixels(FloatRect&);
206 215
207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 216 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
208 { 217 {
209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 218 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()); 219 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
211 } 220 }
212 221
213 } // namespace WebCore 222 } // namespace WebCore
214 223
215 #endif // InlineTextBox_h 224 #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