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

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

Issue 734313004: Move InlineTextBox::rotation to TextPainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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/paint/TextPainter.cpp ('k') | no next file » | 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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef InlineTextBox_h 23 #ifndef InlineTextBox_h
24 #define InlineTextBox_h 24 #define InlineTextBox_h
25 25
26 #include "core/rendering/FloatToLayoutUnit.h" 26 #include "core/rendering/FloatToLayoutUnit.h"
27 #include "core/rendering/InlineBox.h" 27 #include "core/rendering/InlineBox.h"
28 #include "core/rendering/RenderText.h" // so textRenderer() can be inline 28 #include "core/rendering/RenderText.h" // so textRenderer() can be inline
29 #include "platform/fonts/TextBlob.h"
30 #include "platform/text/TextRun.h" 29 #include "platform/text/TextRun.h"
31 #include "wtf/Forward.h" 30 #include "wtf/Forward.h"
32 31
33 namespace blink { 32 namespace blink {
34 33
35 class DocumentMarker; 34 class DocumentMarker;
36 class GraphicsContext; 35 class GraphicsContext;
37 36
38 const unsigned short cNoTruncation = USHRT_MAX; 37 const unsigned short cNoTruncation = USHRT_MAX;
39 const unsigned short cFullTruncation = USHRT_MAX - 1; 38 const unsigned short cFullTruncation = USHRT_MAX - 1;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 89
91 // charactersWithHyphen, if provided, must not be destroyed before the TextR un. 90 // charactersWithHyphen, if provided, must not be destroyed before the TextR un.
92 TextRun constructTextRun(RenderStyle*, const Font&, StringBuilder* character sWithHyphen = 0) const; 91 TextRun constructTextRun(RenderStyle*, const Font&, StringBuilder* character sWithHyphen = 0) const;
93 TextRun constructTextRun(RenderStyle*, const Font&, StringView, int maximumL ength, StringBuilder* charactersWithHyphen = 0) const; 92 TextRun constructTextRun(RenderStyle*, const Font&, StringView, int maximumL ength, StringBuilder* charactersWithHyphen = 0) const;
94 93
95 #ifndef NDEBUG 94 #ifndef NDEBUG
96 virtual void showBox(int = 0) const override; 95 virtual void showBox(int = 0) const override;
97 virtual const char* boxName() const override; 96 virtual const char* boxName() const override;
98 #endif 97 #endif
99 98
100 enum RotationDirection { Counterclockwise, Clockwise };
101 static AffineTransform rotation(const FloatRectWillBeLayoutRect& boxRect, Ro tationDirection);
102
103 public: 99 public:
104 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const; 100 TextRun constructTextRunForInspector(RenderStyle*, const Font&) const;
105 virtual FloatRectWillBeLayoutRect calculateBoundaries() const override { ret urn FloatRectWillBeLayoutRect(x(), y(), width(), height()); } 101 virtual FloatRectWillBeLayoutRect calculateBoundaries() const override { ret urn FloatRectWillBeLayoutRect(x(), y(), width(), height()); }
106 102
107 virtual LayoutRect localSelectionRect(int startPos, int endPos); 103 virtual LayoutRect localSelectionRect(int startPos, int endPos);
108 bool isSelected(int startPos, int endPos) const; 104 bool isSelected(int startPos, int endPos) const;
109 void selectionStartEnd(int& sPos, int& ePos) const; 105 void selectionStartEnd(int& sPos, int& ePos) const;
110 106
111 // These functions both paint markers and update the DocumentMarker's render edRect. 107 // These functions both paint markers and update the DocumentMarker's render edRect.
112 virtual void paintDocumentMarker(GraphicsContext*, const FloatPointWillBeLay outPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar); 108 virtual void paintDocumentMarker(GraphicsContext*, const FloatPointWillBeLay outPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 { 167 {
172 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion) 168 return (canHaveLeadingExpansion() ? TextRun::AllowLeadingExpansion : Tex tRun::ForbidLeadingExpansion)
173 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion); 169 | (expansion() && nextLeafChild() ? TextRun::AllowTrailingExpansion : TextRun::ForbidTrailingExpansion);
174 } 170 }
175 }; 171 };
176 172
177 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); 173 DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
178 174
179 void alignSelectionRectToDevicePixels(FloatRectWillBeLayoutRect&); 175 void alignSelectionRectToDevicePixels(FloatRectWillBeLayoutRect&);
180 176
181 inline AffineTransform InlineTextBox::rotation(const FloatRectWillBeLayoutRect& boxRect, RotationDirection rotationDirection)
182 {
183 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x())
184 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
185 }
186
187 } // namespace blink 177 } // namespace blink
188 178
189 #endif // InlineTextBox_h 179 #endif // InlineTextBox_h
OLDNEW
« no previous file with comments | « Source/core/paint/TextPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698