| OLD | NEW |
| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 InlineTextBox(RenderObject* obj) | 50 InlineTextBox(RenderObject* obj) |
| 51 : InlineBox(obj) | 51 : InlineBox(obj) |
| 52 , m_prevTextBox(0) | 52 , m_prevTextBox(0) |
| 53 , m_nextTextBox(0) | 53 , m_nextTextBox(0) |
| 54 , m_start(0) | 54 , m_start(0) |
| 55 , m_len(0) | 55 , m_len(0) |
| 56 , m_truncation(cNoTruncation) | 56 , m_truncation(cNoTruncation) |
| 57 { | 57 { |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void destroy(RenderArena*); | 60 virtual void destroy(RenderArena*) FINAL; |
| 61 | 61 |
| 62 InlineTextBox* prevTextBox() const { return m_prevTextBox; } | 62 InlineTextBox* prevTextBox() const { return m_prevTextBox; } |
| 63 InlineTextBox* nextTextBox() const { return m_nextTextBox; } | 63 InlineTextBox* nextTextBox() const { return m_nextTextBox; } |
| 64 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } | 64 void setNextTextBox(InlineTextBox* n) { m_nextTextBox = n; } |
| 65 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } | 65 void setPreviousTextBox(InlineTextBox* p) { m_prevTextBox = p; } |
| 66 | 66 |
| 67 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit
.org/show_bug.cgi?id=97264 | 67 // FIXME: These accessors should ASSERT(!isDirty()). See https://bugs.webkit
.org/show_bug.cgi?id=97264 |
| 68 unsigned start() const { return m_start; } | 68 unsigned start() const { return m_start; } |
| 69 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } | 69 unsigned end() const { return m_len ? m_start + m_len - 1 : m_start; } |
| 70 unsigned len() const { return m_len; } | 70 unsigned len() const { return m_len; } |
| 71 | 71 |
| 72 void setStart(unsigned start) { m_start = start; } | 72 void setStart(unsigned start) { m_start = start; } |
| 73 void setLen(unsigned len) { m_len = len; } | 73 void setLen(unsigned len) { m_len = len; } |
| 74 | 74 |
| 75 void offsetRun(int d) { ASSERT(!isDirty()); m_start += d; } | 75 void offsetRun(int d) { ASSERT(!isDirty()); m_start += d; } |
| 76 | 76 |
| 77 unsigned short truncation() { return m_truncation; } | 77 unsigned short truncation() { return m_truncation; } |
| 78 | 78 |
| 79 virtual void markDirty(bool dirty = true) OVERRIDE; | 79 virtual void markDirty(bool dirty = true) OVERRIDE FINAL; |
| 80 | 80 |
| 81 using InlineBox::hasHyphen; | 81 using InlineBox::hasHyphen; |
| 82 using InlineBox::setHasHyphen; | 82 using InlineBox::setHasHyphen; |
| 83 using InlineBox::canHaveLeadingExpansion; | 83 using InlineBox::canHaveLeadingExpansion; |
| 84 using InlineBox::setCanHaveLeadingExpansion; | 84 using InlineBox::setCanHaveLeadingExpansion; |
| 85 | 85 |
| 86 static inline bool compareByStart(const InlineTextBox* first, const InlineTe
xtBox* second) { return first->start() < second->start(); } | 86 static inline bool compareByStart(const InlineTextBox* first, const InlineTe
xtBox* second) { return first->start() < second->start(); } |
| 87 | 87 |
| 88 virtual int baselinePosition(FontBaseline) const; | 88 virtual int baselinePosition(FontBaseline) const FINAL; |
| 89 virtual LayoutUnit lineHeight() const; | 89 virtual LayoutUnit lineHeight() const FINAL; |
| 90 | 90 |
| 91 bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const; | 91 bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const; |
| 92 | 92 |
| 93 LayoutRect logicalOverflowRect() const; | 93 LayoutRect logicalOverflowRect() const; |
| 94 void setLogicalOverflowRect(const LayoutRect&); | 94 void setLogicalOverflowRect(const LayoutRect&); |
| 95 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y
(); } | 95 LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y
(); } |
| 96 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect(
).maxY(); } | 96 LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect(
).maxY(); } |
| 97 LayoutUnit logicalLeftVisualOverflow() const { return logicalOverflowRect().
x(); } | 97 LayoutUnit logicalLeftVisualOverflow() const { return logicalOverflowRect().
x(); } |
| 98 LayoutUnit logicalRightVisualOverflow() const { return logicalOverflowRect()
.maxX(); } | 98 LayoutUnit logicalRightVisualOverflow() const { return logicalOverflowRect()
.maxX(); } |
| 99 | 99 |
| 100 #ifndef NDEBUG | 100 #ifndef NDEBUG |
| 101 virtual void showBox(int = 0) const; | 101 virtual void showBox(int = 0) const; |
| 102 virtual const char* boxName() const; | 102 virtual const char* boxName() const; |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 105 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE FINAL; |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 LayoutUnit selectionTop(); | 108 LayoutUnit selectionTop(); |
| 109 LayoutUnit selectionBottom(); | 109 LayoutUnit selectionBottom(); |
| 110 LayoutUnit selectionHeight(); | 110 LayoutUnit selectionHeight(); |
| 111 | 111 |
| 112 TextRun constructTextRun(RenderStyle*, const Font&, BufferForAppendingHyphen
* = 0) const; | 112 TextRun constructTextRun(RenderStyle*, const Font&, BufferForAppendingHyphen
* = 0) const; |
| 113 TextRun constructTextRun(RenderStyle*, const Font&, String, int maximumLengt
h, BufferForAppendingHyphen* = 0) const; | 113 TextRun constructTextRun(RenderStyle*, const Font&, String, int maximumLengt
h, BufferForAppendingHyphen* = 0) const; |
| 114 | 114 |
| 115 public: | 115 public: |
| 116 virtual FloatRect calculateBoundaries() const { return FloatRect(x(), y(), w
idth(), height()); } | 116 virtual FloatRect calculateBoundaries() const { return FloatRect(x(), y(), w
idth(), height()); } |
| 117 | 117 |
| 118 virtual LayoutRect localSelectionRect(int startPos, int endPos); | 118 virtual LayoutRect localSelectionRect(int startPos, int endPos); |
| 119 bool isSelected(int startPos, int endPos) const; | 119 bool isSelected(int startPos, int endPos) const; |
| 120 void selectionStartEnd(int& sPos, int& ePos); | 120 void selectionStartEnd(int& sPos, int& ePos); |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom); | 123 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, Layou
tUnit lineBottom); |
| 124 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; |
| 125 | 125 |
| 126 public: | 126 public: |
| 127 RenderText* textRenderer() const; | 127 RenderText* textRenderer() const; |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 virtual void deleteLine(RenderArena*); | 130 virtual void deleteLine(RenderArena*) FINAL; |
| 131 virtual void extractLine(); | 131 virtual void extractLine() FINAL; |
| 132 virtual void attachLine(); | 132 virtual void attachLine() FINAL; |
| 133 | 133 |
| 134 public: | 134 public: |
| 135 virtual RenderObject::SelectionState selectionState(); | 135 virtual RenderObject::SelectionState selectionState() FINAL; |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 virtual void clearTruncation() { m_truncation = cNoTruncation; } | 138 virtual void clearTruncation() FINAL { m_truncation = cNoTruncation; } |
| 139 virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float
visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OV
ERRIDE; | 139 virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float
visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OV
ERRIDE FINAL; |
| 140 | 140 |
| 141 public: | 141 public: |
| 142 virtual bool isLineBreak() const; | 142 virtual bool isLineBreak() const FINAL; |
| 143 | 143 |
| 144 void setExpansion(int newExpansion) | 144 void setExpansion(int newExpansion) |
| 145 { | 145 { |
| 146 m_logicalWidth -= expansion(); | 146 m_logicalWidth -= expansion(); |
| 147 InlineBox::setExpansion(newExpansion); | 147 InlineBox::setExpansion(newExpansion); |
| 148 m_logicalWidth += newExpansion; | 148 m_logicalWidth += newExpansion; |
| 149 } | 149 } |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 virtual bool isInlineTextBox() const { return true; } | 152 virtual bool isInlineTextBox() const FINAL { return true; } |
| 153 | 153 |
| 154 public: | 154 public: |
| 155 virtual int caretMinOffset() const; | 155 virtual int caretMinOffset() const FINAL; |
| 156 virtual int caretMaxOffset() const; | 156 virtual int caretMaxOffset() const FINAL; |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 float textPos() const; // returns the x position relative to the left start
of the text line. | 159 float textPos() const; // returns the x position relative to the left start
of the text line. |
| 160 | 160 |
| 161 public: | 161 public: |
| 162 virtual int offsetForPosition(float x, bool includePartialGlyphs = true) con
st; | 162 virtual int offsetForPosition(float x, bool includePartialGlyphs = true) con
st; |
| 163 virtual float positionForOffset(int offset) const; | 163 virtual float positionForOffset(int offset) const; |
| 164 | 164 |
| 165 bool containsCaretOffset(int offset) const; // false for offset after line b
reak | 165 bool containsCaretOffset(int offset) const; // false for offset after line b
reak |
| 166 | 166 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 inline RenderText* InlineTextBox::textRenderer() const | 214 inline RenderText* InlineTextBox::textRenderer() const |
| 215 { | 215 { |
| 216 return toRenderText(renderer()); | 216 return toRenderText(renderer()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void alignSelectionRectToDevicePixels(FloatRect&); | 219 void alignSelectionRectToDevicePixels(FloatRect&); |
| 220 | 220 |
| 221 } // namespace WebCore | 221 } // namespace WebCore |
| 222 | 222 |
| 223 #endif // InlineTextBox_h | 223 #endif // InlineTextBox_h |
| OLD | NEW |