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

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: Fixing comments and adding new test case 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 decorationThickness) OVERRIDE;
123 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; 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
178 protected: 182 protected:
179 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigi n, RenderStyle*, const Font&, int startPos, int endPos); 183 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); 184 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, Ren derStyle*, const Font&, bool background);
181 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin , const CompositionUnderline&); 185 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin , const CompositionUnderline&);
182 186
183 // These functions both paint markers and update the DocumentMarker's render edRect. 187 // 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); 188 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&); 189 virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOri gin, DocumentMarker*, RenderStyle*, const Font&);
186 190
187 private: 191 private:
188 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDeco ration, const ShadowList*); 192 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); 193 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderSty le*, const Font&, Color textColor);
190 194
191 TextRun::ExpansionBehavior expansionBehavior() const 195 TextRun::ExpansionBehavior expansionBehavior() const
192 { 196 {
193 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion) 197 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion)
194 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion); 198 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion);
195 } 199 }
200
201 float getDecorationThickness() { return m_textDecorationThickness; }
202 void setDecorationThickness(float textDecorationThickness) { m_textDecoratio nThickness = textDecorationThickness; }
196 }; 203 };
197 204
198 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 205 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
199 206
200 inline RenderText& InlineTextBox::textRenderer() const 207 inline RenderText& InlineTextBox::textRenderer() const
201 { 208 {
202 return toRenderText(renderer()); 209 return toRenderText(renderer());
203 } 210 }
204 211
205 void alignSelectionRectToDevicePixels(FloatRect&); 212 void alignSelectionRectToDevicePixels(FloatRect&);
206 213
207 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 214 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
208 { 215 {
209 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 216 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()); 217 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
211 } 218 }
212 219
213 } // namespace WebCore 220 } // namespace WebCore
214 221
215 #endif // InlineTextBox_h 222 #endif // InlineTextBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698