| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 * | 18 * |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef InlineBox_h | 21 #ifndef InlineBox_h |
| 22 #define InlineBox_h | 22 #define InlineBox_h |
| 23 | 23 |
| 24 #include "core/layout/LayoutBoxModelObject.h" | 24 #include "core/layout/LayoutBoxModelObject.h" |
| 25 #include "core/layout/LayoutObject.h" | 25 #include "core/layout/LayoutObject.h" |
| 26 #include "core/layout/line/FloatToLayoutUnit.h" | |
| 27 #include "platform/graphics/paint/DisplayItemClient.h" | 26 #include "platform/graphics/paint/DisplayItemClient.h" |
| 28 #include "platform/text/TextDirection.h" | 27 #include "platform/text/TextDirection.h" |
| 29 | 28 |
| 30 namespace blink { | 29 namespace blink { |
| 31 | 30 |
| 32 class HitTestRequest; | 31 class HitTestRequest; |
| 33 class HitTestResult; | 32 class HitTestResult; |
| 34 class RootInlineBox; | 33 class RootInlineBox; |
| 35 | 34 |
| 36 enum MarkLineBoxes { MarkLineBoxesDirty, DontMarkLineBoxes }; | 35 enum MarkLineBoxes { MarkLineBoxesDirty, DontMarkLineBoxes }; |
| 37 | 36 |
| 38 // InlineBox represents a rectangle that occurs on a line. It corresponds to | 37 // InlineBox represents a rectangle that occurs on a line. It corresponds to |
| 39 // some LayoutObject (i.e., it represents a portion of that LayoutObject). | 38 // some LayoutObject (i.e., it represents a portion of that LayoutObject). |
| 40 class InlineBox { | 39 class InlineBox { |
| 41 WTF_MAKE_NONCOPYABLE(InlineBox); | 40 WTF_MAKE_NONCOPYABLE(InlineBox); |
| 42 public: | 41 public: |
| 43 InlineBox(LayoutObject& obj) | 42 InlineBox(LayoutObject& obj) |
| 44 : m_next(0) | 43 : m_next(0) |
| 45 , m_prev(0) | 44 , m_prev(0) |
| 46 , m_parent(0) | 45 , m_parent(0) |
| 47 , m_layoutObject(obj) | 46 , m_layoutObject(obj) |
| 48 , m_logicalWidth() | 47 , m_logicalWidth() |
| 49 #if ENABLE(ASSERT) | 48 #if ENABLE(ASSERT) |
| 50 , m_hasBadParent(false) | 49 , m_hasBadParent(false) |
| 51 #endif | 50 #endif |
| 52 { | 51 { |
| 53 } | 52 } |
| 54 | 53 |
| 55 InlineBox(LayoutObject& obj, FloatPointWillBeLayoutPoint topLeft, FloatWillB
eLayoutUnit logicalWidth, bool firstLine, bool constructed, | 54 InlineBox(LayoutObject& obj, LayoutPoint topLeft, LayoutUnit logicalWidth, b
ool firstLine, bool constructed, |
| 56 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBo
x* prev, InlineFlowBox* parent) | 55 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBo
x* prev, InlineFlowBox* parent) |
| 57 : m_next(next) | 56 : m_next(next) |
| 58 , m_prev(prev) | 57 , m_prev(prev) |
| 59 , m_parent(parent) | 58 , m_parent(parent) |
| 60 , m_layoutObject(obj) | 59 , m_layoutObject(obj) |
| 61 , m_topLeft(topLeft) | 60 , m_topLeft(topLeft) |
| 62 , m_logicalWidth(logicalWidth) | 61 , m_logicalWidth(logicalWidth) |
| 63 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) | 62 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) |
| 64 #if ENABLE(ASSERT) | 63 #if ENABLE(ASSERT) |
| 65 , m_hasBadParent(false) | 64 , m_hasBadParent(false) |
| 66 #endif | 65 #endif |
| 67 { | 66 { |
| 68 } | 67 } |
| 69 | 68 |
| 70 virtual ~InlineBox(); | 69 virtual ~InlineBox(); |
| 71 | 70 |
| 72 virtual void destroy(); | 71 virtual void destroy(); |
| 73 | 72 |
| 74 virtual void deleteLine(); | 73 virtual void deleteLine(); |
| 75 virtual void extractLine(); | 74 virtual void extractLine(); |
| 76 virtual void attachLine(); | 75 virtual void attachLine(); |
| 77 | 76 |
| 78 virtual bool isLineBreak() const { return false; } | 77 virtual bool isLineBreak() const { return false; } |
| 79 | 78 |
| 80 virtual void adjustPosition(FloatWillBeLayoutUnit dx, FloatWillBeLayoutUnit
dy); | 79 virtual void adjustPosition(LayoutUnit dx, LayoutUnit dy); |
| 81 void adjustLogicalPosition(FloatWillBeLayoutUnit deltaLogicalLeft, FloatWill
BeLayoutUnit deltaLogicalTop) | 80 void adjustLogicalPosition(LayoutUnit deltaLogicalLeft, LayoutUnit deltaLogi
calTop) |
| 82 { | 81 { |
| 83 if (isHorizontal()) | 82 if (isHorizontal()) |
| 84 adjustPosition(deltaLogicalLeft, deltaLogicalTop); | 83 adjustPosition(deltaLogicalLeft, deltaLogicalTop); |
| 85 else | 84 else |
| 86 adjustPosition(deltaLogicalTop, deltaLogicalLeft); | 85 adjustPosition(deltaLogicalTop, deltaLogicalLeft); |
| 87 } | 86 } |
| 88 void adjustLineDirectionPosition(FloatWillBeLayoutUnit delta) | 87 void adjustLineDirectionPosition(LayoutUnit delta) |
| 89 { | 88 { |
| 90 if (isHorizontal()) | 89 if (isHorizontal()) |
| 91 adjustPosition(delta, 0); | 90 adjustPosition(delta, 0); |
| 92 else | 91 else |
| 93 adjustPosition(0, delta); | 92 adjustPosition(0, delta); |
| 94 } | 93 } |
| 95 void adjustBlockDirectionPosition(FloatWillBeLayoutUnit delta) | 94 void adjustBlockDirectionPosition(LayoutUnit delta) |
| 96 { | 95 { |
| 97 if (isHorizontal()) | 96 if (isHorizontal()) |
| 98 adjustPosition(0, delta); | 97 adjustPosition(0, delta); |
| 99 else | 98 else |
| 100 adjustPosition(delta, 0); | 99 adjustPosition(delta, 0); |
| 101 } | 100 } |
| 102 | 101 |
| 103 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom); | 102 virtual void paint(const PaintInfo&, const LayoutPoint&, LayoutUnit lineTop,
LayoutUnit lineBottom); |
| 104 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li
neBottom); | 103 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit li
neBottom); |
| 105 | 104 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 124 virtual bool isInlineFlowBox() const { return false; } | 123 virtual bool isInlineFlowBox() const { return false; } |
| 125 virtual bool isInlineTextBox() const { return false; } | 124 virtual bool isInlineTextBox() const { return false; } |
| 126 virtual bool isRootInlineBox() const { return false; } | 125 virtual bool isRootInlineBox() const { return false; } |
| 127 | 126 |
| 128 virtual bool isSVGInlineTextBox() const { return false; } | 127 virtual bool isSVGInlineTextBox() const { return false; } |
| 129 virtual bool isSVGInlineFlowBox() const { return false; } | 128 virtual bool isSVGInlineFlowBox() const { return false; } |
| 130 virtual bool isSVGRootInlineBox() const { return false; } | 129 virtual bool isSVGRootInlineBox() const { return false; } |
| 131 | 130 |
| 132 bool hasVirtualLogicalHeight() const { return m_bitfields.hasVirtualLogicalH
eight(); } | 131 bool hasVirtualLogicalHeight() const { return m_bitfields.hasVirtualLogicalH
eight(); } |
| 133 void setHasVirtualLogicalHeight() { m_bitfields.setHasVirtualLogicalHeight(t
rue); } | 132 void setHasVirtualLogicalHeight() { m_bitfields.setHasVirtualLogicalHeight(t
rue); } |
| 134 virtual FloatWillBeLayoutUnit virtualLogicalHeight() const | 133 virtual LayoutUnit virtualLogicalHeight() const |
| 135 { | 134 { |
| 136 ASSERT_NOT_REACHED(); | 135 ASSERT_NOT_REACHED(); |
| 137 return FloatWillBeLayoutUnit(); | 136 return LayoutUnit(); |
| 138 } | 137 } |
| 139 | 138 |
| 140 bool isHorizontal() const { return m_bitfields.isHorizontal(); } | 139 bool isHorizontal() const { return m_bitfields.isHorizontal(); } |
| 141 void setIsHorizontal(bool isHorizontal) { m_bitfields.setIsHorizontal(isHori
zontal); } | 140 void setIsHorizontal(bool isHorizontal) { m_bitfields.setIsHorizontal(isHori
zontal); } |
| 142 | 141 |
| 143 virtual FloatRectWillBeLayoutRect calculateBoundaries() const | 142 virtual LayoutRect calculateBoundaries() const |
| 144 { | 143 { |
| 145 ASSERT_NOT_REACHED(); | 144 ASSERT_NOT_REACHED(); |
| 146 return FloatRectWillBeLayoutRect(); | 145 return LayoutRect(); |
| 147 } | 146 } |
| 148 | 147 |
| 149 bool isConstructed() { return m_bitfields.constructed(); } | 148 bool isConstructed() { return m_bitfields.constructed(); } |
| 150 virtual void setConstructed() { m_bitfields.setConstructed(true); } | 149 virtual void setConstructed() { m_bitfields.setConstructed(true); } |
| 151 | 150 |
| 152 void setExtracted(bool extracted = true) { m_bitfields.setExtracted(extracte
d); } | 151 void setExtracted(bool extracted = true) { m_bitfields.setExtracted(extracte
d); } |
| 153 | 152 |
| 154 void setFirstLineStyleBit(bool firstLine) { m_bitfields.setFirstLine(firstLi
ne); } | 153 void setFirstLineStyleBit(bool firstLine) { m_bitfields.setFirstLine(firstLi
ne); } |
| 155 bool isFirstLineStyle() const { return m_bitfields.firstLine(); } | 154 bool isFirstLineStyle() const { return m_bitfields.firstLine(); } |
| 156 | 155 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 187 { | 186 { |
| 188 ASSERT(!m_hasBadParent); | 187 ASSERT(!m_hasBadParent); |
| 189 return m_parent; | 188 return m_parent; |
| 190 } | 189 } |
| 191 void setParent(InlineFlowBox* par) { m_parent = par; } | 190 void setParent(InlineFlowBox* par) { m_parent = par; } |
| 192 | 191 |
| 193 const RootInlineBox& root() const; | 192 const RootInlineBox& root() const; |
| 194 RootInlineBox& root(); | 193 RootInlineBox& root(); |
| 195 | 194 |
| 196 // x() is the left side of the box in the containing block's coordinate syst
em. | 195 // x() is the left side of the box in the containing block's coordinate syst
em. |
| 197 void setX(FloatWillBeLayoutUnit x) { m_topLeft.setX(x); } | 196 void setX(LayoutUnit x) { m_topLeft.setX(x); } |
| 198 FloatWillBeLayoutUnit x() const { return m_topLeft.x(); } | 197 LayoutUnit x() const { return m_topLeft.x(); } |
| 199 FloatWillBeLayoutUnit left() const { return m_topLeft.x(); } | 198 LayoutUnit left() const { return m_topLeft.x(); } |
| 200 | 199 |
| 201 // y() is the top side of the box in the containing block's coordinate syste
m. | 200 // y() is the top side of the box in the containing block's coordinate syste
m. |
| 202 void setY(FloatWillBeLayoutUnit y) { m_topLeft.setY(y); } | 201 void setY(LayoutUnit y) { m_topLeft.setY(y); } |
| 203 FloatWillBeLayoutUnit y() const { return m_topLeft.y(); } | 202 LayoutUnit y() const { return m_topLeft.y(); } |
| 204 FloatWillBeLayoutUnit top() const { return m_topLeft.y(); } | 203 LayoutUnit top() const { return m_topLeft.y(); } |
| 205 | 204 |
| 206 const FloatPointWillBeLayoutPoint& topLeft() const { return m_topLeft; } | 205 const LayoutPoint& topLeft() const { return m_topLeft; } |
| 207 | 206 |
| 208 FloatWillBeLayoutUnit width() const { return isHorizontal() ? logicalWidth()
: hasVirtualLogicalHeight() ? virtualLogicalHeight() : logicalHeight(); } | 207 LayoutUnit width() const { return isHorizontal() ? logicalWidth() : hasVirtu
alLogicalHeight() ? virtualLogicalHeight() : logicalHeight(); } |
| 209 FloatWillBeLayoutUnit height() const { return isHorizontal() ? hasVirtualLog
icalHeight() ? virtualLogicalHeight() : logicalHeight() : logicalWidth(); } | 208 LayoutUnit height() const { return isHorizontal() ? hasVirtualLogicalHeight(
) ? virtualLogicalHeight() : logicalHeight() : logicalWidth(); } |
| 210 FloatSizeWillBeLayoutSize size() const { return FloatSizeWillBeLayoutSize(wi
dth(), height()); } | 209 LayoutSize size() const { return LayoutSize(width(), height()); } |
| 211 FloatWillBeLayoutUnit right() const { return left() + width(); } | 210 LayoutUnit right() const { return left() + width(); } |
| 212 FloatWillBeLayoutUnit bottom() const { return top() + height(); } | 211 LayoutUnit bottom() const { return top() + height(); } |
| 213 | 212 |
| 214 // The logicalLeft position is the left edge of the line box in a horizontal
line and the top edge in a vertical line. | 213 // The logicalLeft position is the left edge of the line box in a horizontal
line and the top edge in a vertical line. |
| 215 FloatWillBeLayoutUnit logicalLeft() const { return isHorizontal() ? m_topLef
t.x() : m_topLeft.y(); } | 214 LayoutUnit logicalLeft() const { return isHorizontal() ? m_topLeft.x() : m_t
opLeft.y(); } |
| 216 FloatWillBeLayoutUnit logicalRight() const { return logicalLeft() + logicalW
idth(); } | 215 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); } |
| 217 void setLogicalLeft(FloatWillBeLayoutUnit left) | 216 void setLogicalLeft(LayoutUnit left) |
| 218 { | 217 { |
| 219 if (isHorizontal()) | 218 if (isHorizontal()) |
| 220 setX(left); | 219 setX(left); |
| 221 else | 220 else |
| 222 setY(left); | 221 setY(left); |
| 223 } | 222 } |
| 224 int pixelSnappedLogicalLeft() const { return logicalLeft(); } | 223 int pixelSnappedLogicalLeft() const { return logicalLeft(); } |
| 225 int pixelSnappedLogicalRight() const { return ceilf(logicalRight()); } | 224 int pixelSnappedLogicalRight() const { return logicalRight().ceil(); } |
| 226 int pixelSnappedLogicalTop() const { return logicalTop(); } | 225 int pixelSnappedLogicalTop() const { return logicalTop(); } |
| 227 int pixelSnappedLogicalBottom() const { return ceilf(logicalBottom()); } | 226 int pixelSnappedLogicalBottom() const { return logicalBottom().ceil(); } |
| 228 | 227 |
| 229 // The logicalTop[ position is the top edge of the line box in a horizontal
line and the left edge in a vertical line. | 228 // The logicalTop[ position is the top edge of the line box in a horizontal
line and the left edge in a vertical line. |
| 230 FloatWillBeLayoutUnit logicalTop() const { return isHorizontal() ? m_topLeft
.y() : m_topLeft.x(); } | 229 LayoutUnit logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_to
pLeft.x(); } |
| 231 FloatWillBeLayoutUnit logicalBottom() const { return logicalTop() + logicalH
eight(); } | 230 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); } |
| 232 void setLogicalTop(FloatWillBeLayoutUnit top) | 231 void setLogicalTop(LayoutUnit top) |
| 233 { | 232 { |
| 234 if (isHorizontal()) | 233 if (isHorizontal()) |
| 235 setY(top); | 234 setY(top); |
| 236 else | 235 else |
| 237 setX(top); | 236 setX(top); |
| 238 } | 237 } |
| 239 | 238 |
| 240 // The logical width is our extent in the line's overall inline direction, i
.e., width for horizontal text and height for vertical text. | 239 // The logical width is our extent in the line's overall inline direction, i
.e., width for horizontal text and height for vertical text. |
| 241 void setLogicalWidth(FloatWillBeLayoutUnit w) { m_logicalWidth = w; } | 240 void setLogicalWidth(LayoutUnit w) { m_logicalWidth = w; } |
| 242 FloatWillBeLayoutUnit logicalWidth() const { return m_logicalWidth; } | 241 LayoutUnit logicalWidth() const { return m_logicalWidth; } |
| 243 | 242 |
| 244 // The logical height is our extent in the block flow direction, i.e., heigh
t for horizontal text and width for vertical text. | 243 // The logical height is our extent in the block flow direction, i.e., heigh
t for horizontal text and width for vertical text. |
| 245 FloatWillBeLayoutUnit logicalHeight() const; | 244 LayoutUnit logicalHeight() const; |
| 246 | 245 |
| 247 FloatRectWillBeLayoutRect logicalFrameRect() const { return isHorizontal() ?
FloatRectWillBeLayoutRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logical
Height()) : FloatRectWillBeLayoutRect(m_topLeft.y(), m_topLeft.x(), m_logicalWid
th, logicalHeight()); } | 246 LayoutRect logicalFrameRect() const { return isHorizontal() ? LayoutRect(m_t
opLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : LayoutRect(m_topLe
ft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); } |
| 248 | 247 |
| 249 virtual int baselinePosition(FontBaseline baselineType) const; | 248 virtual int baselinePosition(FontBaseline baselineType) const; |
| 250 virtual LayoutUnit lineHeight() const; | 249 virtual LayoutUnit lineHeight() const; |
| 251 | 250 |
| 252 virtual int caretMinOffset() const; | 251 virtual int caretMinOffset() const; |
| 253 virtual int caretMaxOffset() const; | 252 virtual int caretMaxOffset() const; |
| 254 | 253 |
| 255 unsigned char bidiLevel() const { return m_bitfields.bidiEmbeddingLevel(); } | 254 unsigned char bidiLevel() const { return m_bitfields.bidiEmbeddingLevel(); } |
| 256 void setBidiLevel(unsigned char level) { m_bitfields.setBidiEmbeddingLevel(l
evel); } | 255 void setBidiLevel(unsigned char level) { m_bitfields.setBidiEmbeddingLevel(l
evel); } |
| 257 TextDirection direction() const { return bidiLevel() % 2 ? RTL : LTR; } | 256 TextDirection direction() const { return bidiLevel() % 2 ? RTL : LTR; } |
| 258 bool isLeftToRightDirection() const { return direction() == LTR; } | 257 bool isLeftToRightDirection() const { return direction() == LTR; } |
| 259 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin
Offset() : caretMaxOffset(); } | 258 int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMin
Offset() : caretMaxOffset(); } |
| 260 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa
xOffset() : caretMinOffset(); } | 259 int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMa
xOffset() : caretMinOffset(); } |
| 261 | 260 |
| 262 virtual void clearTruncation() { } | 261 virtual void clearTruncation() { } |
| 263 | 262 |
| 264 bool isDirty() const { return m_bitfields.dirty(); } | 263 bool isDirty() const { return m_bitfields.dirty(); } |
| 265 virtual void markDirty() { m_bitfields.setDirty(true); } | 264 virtual void markDirty() { m_bitfields.setDirty(true); } |
| 266 | 265 |
| 267 virtual void dirtyLineBoxes(); | 266 virtual void dirtyLineBoxes(); |
| 268 | 267 |
| 269 virtual LayoutObject::SelectionState selectionState() const; | 268 virtual LayoutObject::SelectionState selectionState() const; |
| 270 | 269 |
| 271 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const; | 270 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const; |
| 272 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. | 271 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. |
| 273 virtual FloatWillBeLayoutUnit placeEllipsisBox(bool ltr, FloatWillBeLayoutUn
it visibleLeftEdge, FloatWillBeLayoutUnit visibleRightEdge, FloatWillBeLayoutUni
t ellipsisWidth, FloatWillBeLayoutUnit &truncatedWidth, bool&); | 272 virtual LayoutUnit placeEllipsisBox(bool ltr, LayoutUnit visibleLeftEdge, La
youtUnit visibleRightEdge, LayoutUnit ellipsisWidth, LayoutUnit &truncatedWidth,
bool&); |
| 274 | 273 |
| 275 #if ENABLE(ASSERT) | 274 #if ENABLE(ASSERT) |
| 276 void setHasBadParent(); | 275 void setHasBadParent(); |
| 277 #endif | 276 #endif |
| 278 | 277 |
| 279 int expansion() const { return m_bitfields.expansion(); } | 278 int expansion() const { return m_bitfields.expansion(); } |
| 280 | 279 |
| 281 bool visibleToHitTestRequest(const HitTestRequest& request) const { return l
ayoutObject().visibleToHitTestRequest(request); } | 280 bool visibleToHitTestRequest(const HitTestRequest& request) const { return l
ayoutObject().visibleToHitTestRequest(request); } |
| 282 | 281 |
| 283 EVerticalAlign verticalAlign() const { return layoutObject().style(m_bitfiel
ds.firstLine())->verticalAlign(); } | 282 EVerticalAlign verticalAlign() const { return layoutObject().style(m_bitfiel
ds.firstLine())->verticalAlign(); } |
| 284 | 283 |
| 285 // Use with caution! The type is not checked! | 284 // Use with caution! The type is not checked! |
| 286 LayoutBoxModelObject* boxModelObject() const | 285 LayoutBoxModelObject* boxModelObject() const |
| 287 { | 286 { |
| 288 if (!layoutObject().isText()) | 287 if (!layoutObject().isText()) |
| 289 return toLayoutBoxModelObject(&layoutObject()); | 288 return toLayoutBoxModelObject(&layoutObject()); |
| 290 return 0; | 289 return 0; |
| 291 } | 290 } |
| 292 | 291 |
| 293 FloatPointWillBeLayoutPoint locationIncludingFlipping(); | 292 LayoutPoint locationIncludingFlipping(); |
| 294 | 293 |
| 295 // Converts from a rect in the logical space of the InlineBox to one in the
physical space | 294 // Converts from a rect in the logical space of the InlineBox to one in the
physical space |
| 296 // of the containing block. The logical space of an InlineBox may be transpo
sed for vertical text and | 295 // of the containing block. The logical space of an InlineBox may be transpo
sed for vertical text and |
| 297 // flipped for right-to-left text. | 296 // flipped for right-to-left text. |
| 298 LayoutRect logicalRectToPhysicalRect(const LayoutRect&); | 297 LayoutRect logicalRectToPhysicalRect(const LayoutRect&); |
| 299 | 298 |
| 300 void flipForWritingMode(FloatRect&); | 299 void flipForWritingMode(FloatRect&); |
| 301 FloatPoint flipForWritingMode(const FloatPoint&); | 300 FloatPoint flipForWritingMode(const FloatPoint&); |
| 302 void flipForWritingMode(LayoutRect&); | 301 void flipForWritingMode(LayoutRect&); |
| 303 LayoutPoint flipForWritingMode(const LayoutPoint&); | 302 LayoutPoint flipForWritingMode(const LayoutPoint&); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 383 |
| 385 public: | 384 public: |
| 386 signed expansion() const { return m_expansion; } | 385 signed expansion() const { return m_expansion; } |
| 387 void setExpansion(signed expansion) { m_expansion = expansion; } | 386 void setExpansion(signed expansion) { m_expansion = expansion; } |
| 388 }; | 387 }; |
| 389 #undef ADD_BOOLEAN_BITFIELD | 388 #undef ADD_BOOLEAN_BITFIELD |
| 390 | 389 |
| 391 private: | 390 private: |
| 392 // Converts the given (top-left) position from the logical space of the Inli
neBox to the physical space of the | 391 // Converts the given (top-left) position from the logical space of the Inli
neBox to the physical space of the |
| 393 // containing block. The size indicates the size of the box whose point is b
eing flipped. | 392 // containing block. The size indicates the size of the box whose point is b
eing flipped. |
| 394 FloatPointWillBeLayoutPoint logicalPositionToPhysicalPoint(const FloatPoint&
, const FloatSize&); | 393 LayoutPoint logicalPositionToPhysicalPoint(const LayoutPoint&, const LayoutS
ize&); |
| 395 | 394 |
| 396 InlineBox* m_next; // The next element on the same line as us. | 395 InlineBox* m_next; // The next element on the same line as us. |
| 397 InlineBox* m_prev; // The previous element on the same line as us. | 396 InlineBox* m_prev; // The previous element on the same line as us. |
| 398 | 397 |
| 399 InlineFlowBox* m_parent; // The box that contains us. | 398 InlineFlowBox* m_parent; // The box that contains us. |
| 400 LayoutObject& m_layoutObject; | 399 LayoutObject& m_layoutObject; |
| 401 | 400 |
| 402 protected: | 401 protected: |
| 403 // For RootInlineBox | 402 // For RootInlineBox |
| 404 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); } | 403 bool endsWithBreak() const { return m_bitfields.endsWithBreak(); } |
| 405 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end
sWithBreak); } | 404 void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(end
sWithBreak); } |
| 406 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } | 405 bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } |
| 407 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC
anHaveLeadingExpansion(); } | 406 bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrC
anHaveLeadingExpansion(); } |
| 408 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe
lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); } | 407 void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSe
lectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); } |
| 409 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO
rHyphen(hasEllipsisBox); } | 408 void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxO
rHyphen(hasEllipsisBox); } |
| 410 | 409 |
| 411 // For InlineTextBox | 410 // For InlineTextBox |
| 412 bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } | 411 bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } |
| 413 void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(ha
sHyphen); } | 412 void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(ha
sHyphen); } |
| 414 bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildre
nOrCanHaveLeadingExpansion(); } | 413 bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildre
nOrCanHaveLeadingExpansion(); } |
| 415 void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.
setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); } | 414 void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.
setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); } |
| 416 signed expansion() { return m_bitfields.expansion(); } | 415 signed expansion() { return m_bitfields.expansion(); } |
| 417 void setExpansion(signed expansion) { m_bitfields.setExpansion(expansion); } | 416 void setExpansion(signed expansion) { m_bitfields.setExpansion(expansion); } |
| 418 | 417 |
| 419 // For InlineFlowBox and InlineTextBox | 418 // For InlineFlowBox and InlineTextBox |
| 420 bool extracted() const { return m_bitfields.extracted(); } | 419 bool extracted() const { return m_bitfields.extracted(); } |
| 421 | 420 |
| 422 FloatPointWillBeLayoutPoint m_topLeft; | 421 LayoutPoint m_topLeft; |
| 423 FloatWillBeLayoutUnit m_logicalWidth; | 422 LayoutUnit m_logicalWidth; |
| 424 | 423 |
| 425 private: | 424 private: |
| 426 InlineBoxBitfields m_bitfields; | 425 InlineBoxBitfields m_bitfields; |
| 427 | 426 |
| 428 #if ENABLE(ASSERT) | 427 #if ENABLE(ASSERT) |
| 429 bool m_hasBadParent; | 428 bool m_hasBadParent; |
| 430 #endif | 429 #endif |
| 431 }; | 430 }; |
| 432 | 431 |
| 433 #if !ENABLE(ASSERT) | 432 #if !ENABLE(ASSERT) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 451 | 450 |
| 452 } // namespace blink | 451 } // namespace blink |
| 453 | 452 |
| 454 #ifndef NDEBUG | 453 #ifndef NDEBUG |
| 455 // Outside the WebCore namespace for ease of invocation from gdb. | 454 // Outside the WebCore namespace for ease of invocation from gdb. |
| 456 void showTree(const blink::InlineBox*); | 455 void showTree(const blink::InlineBox*); |
| 457 void showLineTree(const blink::InlineBox*); | 456 void showLineTree(const blink::InlineBox*); |
| 458 #endif | 457 #endif |
| 459 | 458 |
| 460 #endif // InlineBox_h | 459 #endif // InlineBox_h |
| OLD | NEW |