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

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: 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
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 public: 112 public:
113 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const; 113 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const;
114 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); } 114 virtual FloatRect calculateBoundaries() const OVERRIDE { return FloatRect(x( ), y(), width(), height()); }
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 void paintDecorationStyle(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom, float underlineThickness) OVERRIDE;
123 virtual void getPaintDecorationSyle(PaintInfo&, const LayoutPoint&, float *, TextDecorationStyle *) OVERRIDE;
122 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE; 124 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
123 125
124 public: 126 public:
125 RenderText& textRenderer() const; 127 RenderText& textRenderer() const;
126 128
127 private: 129 private:
128 virtual void deleteLine() OVERRIDE FINAL; 130 virtual void deleteLine() OVERRIDE FINAL;
129 virtual void extractLine() OVERRIDE FINAL; 131 virtual void extractLine() OVERRIDE FINAL;
130 virtual void attachLine() OVERRIDE FINAL; 132 virtual void attachLine() OVERRIDE FINAL;
131 133
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 private: 170 private:
169 InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderO bject 171 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 172 InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObjec t
171 173
172 int m_start; 174 int m_start;
173 unsigned short m_len; 175 unsigned short m_len;
174 176
175 unsigned short m_truncation; // Where to truncate when text overflow is appl ied. We use special constants to 177 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). 178 // denote no truncation (the whole run paints) and full tr uncation (nothing paints at all).
177 179
180 float m_textDecorationThickness;
181 TextDecorationStyle m_textDecorations;
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, TextDecorationStyle, const ShadowList*); 193 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDeco ration, TextDecorationStyle, const ShadowList*, float underlineThickness = 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);
190 195
191 TextRun::ExpansionBehavior expansionBehavior() const 196 TextRun::ExpansionBehavior expansionBehavior() const
192 { 197 {
193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion) 198 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion)
194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion); 199 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion);
195 } 200 }
201
202 float getUnderlineThickness() { return m_textDecorationThickness; }
203 void setUnderlineThickness(float textDecorationThickness) { m_textDecoration Thickness = textDecorationThickness; }
andersr 2014/03/19 13:18:12 Again, it should be [get,set]DecorationThickness i
h.joshi 2014/03/19 13:59:54 Will make required changes. On 2014/03/19 13:18:1
204
205 TextDecorationStyle getTextDecorations() { return m_textDecorations; }
206 void setTextDecoration(TextDecorationStyle textDecorations) { m_textDecorati ons = textDecorations; }
andersr 2014/03/19 13:18:12 Looks like you ended up not really using these for
h.joshi 2014/03/19 13:59:54 Will remove "s" from method name, get/set are used
196 }; 207 };
197 208
198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 209 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
199 210
200 inline RenderText& InlineTextBox::textRenderer() const 211 inline RenderText& InlineTextBox::textRenderer() const
201 { 212 {
202 return toRenderText(renderer()); 213 return toRenderText(renderer());
203 } 214 }
204 215
205 void alignSelectionRectToDevicePixels(FloatRect&); 216 void alignSelectionRectToDevicePixels(FloatRect&);
206 217
207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 218 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
208 { 219 {
209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 220 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()); 221 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
211 } 222 }
212 223
213 } // namespace WebCore 224 } // namespace WebCore
214 225
215 #endif // InlineTextBox_h 226 #endif // InlineTextBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698