| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace WebCore { | 27 namespace WebCore { |
| 28 | 28 |
| 29 class HitTestRequest; | 29 class HitTestRequest; |
| 30 class HitTestResult; | 30 class HitTestResult; |
| 31 class RootInlineBox; | 31 class RootInlineBox; |
| 32 | 32 |
| 33 // InlineBox represents a rectangle that occurs on a line. It corresponds to | 33 // InlineBox represents a rectangle that occurs on a line. It corresponds to |
| 34 // some RenderObject (i.e., it represents a portion of that RenderObject). | 34 // some RenderObject (i.e., it represents a portion of that RenderObject). |
| 35 class InlineBox { | 35 class InlineBox { |
| 36 public: | 36 public: |
| 37 InlineBox(RenderObject* obj) | 37 InlineBox(RenderObject& obj) |
| 38 : m_next(0) | 38 : m_next(0) |
| 39 , m_prev(0) | 39 , m_prev(0) |
| 40 , m_parent(0) | 40 , m_parent(0) |
| 41 , m_logicalWidth(0) |
| 41 , m_renderer(obj) | 42 , m_renderer(obj) |
| 42 , m_logicalWidth(0) | |
| 43 #ifndef NDEBUG | 43 #ifndef NDEBUG |
| 44 , m_hasBadParent(false) | 44 , m_hasBadParent(false) |
| 45 #endif | 45 #endif |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 InlineBox(RenderObject* obj, FloatPoint topLeft, float logicalWidth, bool fi
rstLine, bool constructed, | 49 InlineBox(RenderObject& obj, FloatPoint topLeft, float logicalWidth, bool fi
rstLine, bool constructed, |
| 50 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, In
lineBox* prev, InlineFlowBox* parent) | 50 bool dirty, bool extracted, bool isHorizontal, InlineBox* next, In
lineBox* prev, InlineFlowBox* parent) |
| 51 : m_next(next) | 51 : m_next(next) |
| 52 , m_prev(prev) | 52 , m_prev(prev) |
| 53 , m_parent(parent) | 53 , m_parent(parent) |
| 54 , m_renderer(obj) | |
| 55 , m_topLeft(topLeft) | 54 , m_topLeft(topLeft) |
| 56 , m_logicalWidth(logicalWidth) | 55 , m_logicalWidth(logicalWidth) |
| 56 , m_renderer(obj) |
| 57 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) | 57 , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) |
| 58 #ifndef NDEBUG | 58 #ifndef NDEBUG |
| 59 , m_hasBadParent(false) | 59 , m_hasBadParent(false) |
| 60 #endif | 60 #endif |
| 61 { | 61 { |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual ~InlineBox(); | 64 virtual ~InlineBox(); |
| 65 | 65 |
| 66 virtual void destroy() { delete this; } | 66 virtual void destroy() { delete this; } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 InlineBox* nextLeafChild() const; | 167 InlineBox* nextLeafChild() const; |
| 168 InlineBox* prevLeafChild() const; | 168 InlineBox* prevLeafChild() const; |
| 169 | 169 |
| 170 // Helper functions for editing and hit-testing code. | 170 // Helper functions for editing and hit-testing code. |
| 171 // FIXME: These two functions should be moved to RenderedPosition once the c
ode to convert between | 171 // FIXME: These two functions should be moved to RenderedPosition once the c
ode to convert between |
| 172 // Position and inline box, offset pair is moved to RenderedPosition. | 172 // Position and inline box, offset pair is moved to RenderedPosition. |
| 173 InlineBox* nextLeafChildIgnoringLineBreak() const; | 173 InlineBox* nextLeafChildIgnoringLineBreak() const; |
| 174 InlineBox* prevLeafChildIgnoringLineBreak() const; | 174 InlineBox* prevLeafChildIgnoringLineBreak() const; |
| 175 | 175 |
| 176 RenderObject* renderer() const { return m_renderer; } | 176 RenderObject& renderer() const { return m_renderer; } |
| 177 | 177 |
| 178 InlineFlowBox* parent() const | 178 InlineFlowBox* parent() const |
| 179 { | 179 { |
| 180 ASSERT(!m_hasBadParent); | 180 ASSERT(!m_hasBadParent); |
| 181 return m_parent; | 181 return m_parent; |
| 182 } | 182 } |
| 183 void setParent(InlineFlowBox* par) { m_parent = par; } | 183 void setParent(InlineFlowBox* par) { m_parent = par; } |
| 184 | 184 |
| 185 const RootInlineBox* root() const; | 185 const RootInlineBox* root() const; |
| 186 RootInlineBox* root(); | 186 RootInlineBox* root(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const; | 263 virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWid
th) const; |
| 264 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. | 264 // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. |
| 265 virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibl
eRightEdge, float ellipsisWidth, float &truncatedWidth, bool&); | 265 virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibl
eRightEdge, float ellipsisWidth, float &truncatedWidth, bool&); |
| 266 | 266 |
| 267 #ifndef NDEBUG | 267 #ifndef NDEBUG |
| 268 void setHasBadParent(); | 268 void setHasBadParent(); |
| 269 #endif | 269 #endif |
| 270 | 270 |
| 271 int expansion() const { return m_bitfields.expansion(); } | 271 int expansion() const { return m_bitfields.expansion(); } |
| 272 | 272 |
| 273 bool visibleToHitTestRequest(const HitTestRequest& request) const { return r
enderer()->visibleToHitTestRequest(request); } | 273 bool visibleToHitTestRequest(const HitTestRequest& request) const { return r
enderer().visibleToHitTestRequest(request); } |
| 274 | 274 |
| 275 EVerticalAlign verticalAlign() const { return renderer()->style(m_bitfields.
firstLine())->verticalAlign(); } | 275 EVerticalAlign verticalAlign() const { return renderer().style(m_bitfields.f
irstLine())->verticalAlign(); } |
| 276 | 276 |
| 277 // Use with caution! The type is not checked! | 277 // Use with caution! The type is not checked! |
| 278 RenderBoxModelObject* boxModelObject() const | 278 RenderBoxModelObject* boxModelObject() const |
| 279 { | 279 { |
| 280 if (!m_renderer->isText()) | 280 if (!renderer().isText()) |
| 281 return toRenderBoxModelObject(m_renderer); | 281 return toRenderBoxModelObject(&renderer()); |
| 282 return 0; | 282 return 0; |
| 283 } | 283 } |
| 284 | 284 |
| 285 FloatPoint locationIncludingFlipping(); | 285 FloatPoint locationIncludingFlipping(); |
| 286 void flipForWritingMode(FloatRect&); | 286 void flipForWritingMode(FloatRect&); |
| 287 FloatPoint flipForWritingMode(const FloatPoint&); | 287 FloatPoint flipForWritingMode(const FloatPoint&); |
| 288 void flipForWritingMode(LayoutRect&); | 288 void flipForWritingMode(LayoutRect&); |
| 289 LayoutPoint flipForWritingMode(const LayoutPoint&); | 289 LayoutPoint flipForWritingMode(const LayoutPoint&); |
| 290 | 290 |
| 291 bool knownToHaveNoOverflow() const { return m_bitfields.knownToHaveNoOverflo
w(); } | 291 bool knownToHaveNoOverflow() const { return m_bitfields.knownToHaveNoOverflo
w(); } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } | 391 bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } |
| 392 void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(ha
sHyphen); } | 392 void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(ha
sHyphen); } |
| 393 bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildre
nOrCanHaveLeadingExpansion(); } | 393 bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildre
nOrCanHaveLeadingExpansion(); } |
| 394 void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.
setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); } | 394 void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.
setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); } |
| 395 signed expansion() { return m_bitfields.expansion(); } | 395 signed expansion() { return m_bitfields.expansion(); } |
| 396 void setExpansion(signed expansion) { m_bitfields.setExpansion(expansion); } | 396 void setExpansion(signed expansion) { m_bitfields.setExpansion(expansion); } |
| 397 | 397 |
| 398 // For InlineFlowBox and InlineTextBox | 398 // For InlineFlowBox and InlineTextBox |
| 399 bool extracted() const { return m_bitfields.extracted(); } | 399 bool extracted() const { return m_bitfields.extracted(); } |
| 400 | 400 |
| 401 RenderObject* m_renderer; | |
| 402 | |
| 403 FloatPoint m_topLeft; | 401 FloatPoint m_topLeft; |
| 404 float m_logicalWidth; | 402 float m_logicalWidth; |
| 405 | 403 |
| 406 private: | 404 private: |
| 405 RenderObject& m_renderer; |
| 406 |
| 407 InlineBoxBitfields m_bitfields; | 407 InlineBoxBitfields m_bitfields; |
| 408 | 408 |
| 409 #ifndef NDEBUG | 409 #ifndef NDEBUG |
| 410 bool m_hasBadParent; | 410 bool m_hasBadParent; |
| 411 #endif | 411 #endif |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 #ifdef NDEBUG | 414 #ifdef NDEBUG |
| 415 inline InlineBox::~InlineBox() | 415 inline InlineBox::~InlineBox() |
| 416 { | 416 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 429 | 429 |
| 430 } // namespace WebCore | 430 } // namespace WebCore |
| 431 | 431 |
| 432 #ifndef NDEBUG | 432 #ifndef NDEBUG |
| 433 // Outside the WebCore namespace for ease of invocation from gdb. | 433 // Outside the WebCore namespace for ease of invocation from gdb. |
| 434 void showTree(const WebCore::InlineBox*); | 434 void showTree(const WebCore::InlineBox*); |
| 435 void showLineTree(const WebCore::InlineBox*); | 435 void showLineTree(const WebCore::InlineBox*); |
| 436 #endif | 436 #endif |
| 437 | 437 |
| 438 #endif // InlineBox_h | 438 #endif // InlineBox_h |
| OLD | NEW |