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

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

Issue 622253002: Pass start/length at InlineTextBox construction time. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: condense by one line Created 6 years, 2 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 | Annotate | Revision Log
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 22 matching lines...) Expand all
33 33
34 struct CompositionUnderline; 34 struct CompositionUnderline;
35 class DocumentMarker; 35 class DocumentMarker;
36 class GraphicsContext; 36 class GraphicsContext;
37 37
38 const unsigned short cNoTruncation = USHRT_MAX; 38 const unsigned short cNoTruncation = USHRT_MAX;
39 const unsigned short cFullTruncation = USHRT_MAX - 1; 39 const unsigned short cFullTruncation = USHRT_MAX - 1;
40 40
41 class InlineTextBox : public InlineBox { 41 class InlineTextBox : public InlineBox {
42 public: 42 public:
43 InlineTextBox(RenderObject& obj) 43 InlineTextBox(RenderObject& obj, int start, unsigned short length)
44 : InlineBox(obj) 44 : InlineBox(obj)
45 , m_prevTextBox(0) 45 , m_prevTextBox(0)
46 , m_nextTextBox(0) 46 , m_nextTextBox(0)
47 , m_start(0) 47 , m_start(start)
48 , m_len(0) 48 , m_len(length)
49 , m_truncation(cNoTruncation) 49 , m_truncation(cNoTruncation)
50 { 50 {
51 setIsText(true);
51 } 52 }
52 53
53 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); } 54 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); }
54 55
55 virtual void destroy() OVERRIDE FINAL; 56 virtual void destroy() OVERRIDE FINAL;
56 57
57 InlineTextBox* prevTextBox() const { return m_prevTextBox; } 58 InlineTextBox* prevTextBox() const { return m_prevTextBox; }
58 InlineTextBox* nextTextBox() const { return m_nextTextBox; } 59 InlineTextBox* nextTextBox() const { return m_nextTextBox; }
59 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } 60 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; }
60 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } 61 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; }
61 62
62 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264 63 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit .org/show_bug.cgi?id=97264
63 unsigned start() const { return m_start; } 64 unsigned start() const { return m_start; }
64 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } 65 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; }
65 unsigned len() const { return m_len; } 66 unsigned len() const { return m_len; }
66 67
67 void setStart(unsigned start) { m_start = start; } 68 void offsetRun(int delta);
68 void setLen(unsigned len) { m_len = len; }
69
70 void offsetRun(int d) { ASSERT(!isDirty()); m_start += d; }
71 69
72 unsigned short truncation() { return m_truncation; } 70 unsigned short truncation() { return m_truncation; }
73 71
74 virtual void markDirty() OVERRIDE FINAL; 72 virtual void markDirty() OVERRIDE FINAL;
75 73
76 using InlineBox::hasHyphen; 74 using InlineBox::hasHyphen;
77 using InlineBox::setHasHyphen; 75 using InlineBox::setHasHyphen;
78 using InlineBox::canHaveLeadingExpansion; 76 using InlineBox::canHaveLeadingExpansion;
79 using InlineBox::setCanHaveLeadingExpansion; 77 using InlineBox::setCanHaveLeadingExpansion;
80 78
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 197
200 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection) 198 inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, Rotatio nDirection rotationDirection)
201 { 199 {
202 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 200 return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect .x() + boxRect.maxY(), boxRect.maxY() - boxRect.x())
203 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY()); 201 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
204 } 202 }
205 203
206 } // namespace blink 204 } // namespace blink
207 205
208 #endif // InlineTextBox_h 206 #endif // InlineTextBox_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/InlineTextBox.cpp » ('j') | Source/core/rendering/RenderBlockLineLayout.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698