diff options
Diffstat (limited to 'WebCore/rendering/InlineFlowBox.h')
| -rw-r--r-- | WebCore/rendering/InlineFlowBox.h | 67 |
1 files changed, 56 insertions, 11 deletions
diff --git a/WebCore/rendering/InlineFlowBox.h b/WebCore/rendering/InlineFlowBox.h index 809fd54..23b5cc9 100644 --- a/WebCore/rendering/InlineFlowBox.h +++ b/WebCore/rendering/InlineFlowBox.h @@ -22,6 +22,7 @@ #define InlineFlowBox_h #include "InlineRunBox.h" +#include "RenderOverflow.h" namespace WebCore { @@ -35,10 +36,8 @@ public: : InlineRunBox(obj) , m_firstChild(0) , m_lastChild(0) - , m_maxHorizontalVisualOverflow(0) , m_includeLeftEdge(false) , m_includeRightEdge(false) - , m_hasTextChildren(true) #ifndef NDEBUG , m_hasBadChildList(false) #endif @@ -121,18 +120,13 @@ public: void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject); int getFlowSpacingWidth(); bool onEndChain(RenderObject* endObject); - virtual int placeBoxesHorizontally(int x, int& leftPosition, int& rightPosition, bool& needsWordSpacing); - virtual int verticallyAlignBoxes(int heightOfBlock); + virtual int placeBoxesHorizontally(int x, bool& needsWordSpacing); void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom, int& maxAscent, int& maxDescent, bool strictMode); void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPositionTop, int maxPositionBottom); - void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, - int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom); - - virtual void setVerticalOverflowPositions(int /*top*/, int /*bottom*/) { } - virtual void setVerticalSelectionPositions(int /*top*/, int /*bottom*/) { } - short maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; } + void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom); + void computeVerticalOverflow(int lineTop, int lineBottom, bool strictMode); void removeChild(InlineBox* child); @@ -146,12 +140,35 @@ public: void checkConsistency() const; void setHasBadChildList(); + int topVisibleOverflow() const { return std::min(topLayoutOverflow(), topVisualOverflow()); } + int bottomVisibleOverflow() const { return std::max(bottomLayoutOverflow(), bottomVisualOverflow()); } + int leftVisibleOverflow() const { return std::min(leftLayoutOverflow(), leftVisualOverflow()); } + int rightVisibleOverflow() const { return std::max(rightLayoutOverflow(), rightVisualOverflow()); } + IntRect visibleOverflowRect() const { return m_overflow ? m_overflow->visibleOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + + int topLayoutOverflow() const { return m_overflow ? m_overflow->topLayoutOverflow() : m_y; } + int bottomLayoutOverflow() const { return m_overflow ? m_overflow->bottomLayoutOverflow() : m_y + height(); } + int leftLayoutOverflow() const { return m_overflow ? m_overflow->leftLayoutOverflow() : m_x; } + int rightLayoutOverflow() const { return m_overflow ? m_overflow->rightLayoutOverflow() : m_x + m_width; } + IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + + int topVisualOverflow() const { return m_overflow ? m_overflow->topVisualOverflow() : m_y; } + int bottomVisualOverflow() const { return m_overflow ? m_overflow->bottomVisualOverflow() : m_y + height(); } + int leftVisualOverflow() const { return m_overflow ? m_overflow->leftVisualOverflow() : m_x; } + int rightVisualOverflow() const { return m_overflow ? m_overflow->rightVisualOverflow() : m_x + m_width; } + IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : IntRect(m_x, m_y, m_width, height()); } + + void setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow); + void setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight); + +protected: + OwnPtr<RenderOverflow> m_overflow; + private: virtual bool isInlineFlowBox() const { return true; } InlineBox* m_firstChild; InlineBox* m_lastChild; - short m_maxHorizontalVisualOverflow; bool m_includeLeftEdge : 1; bool m_includeRightEdge : 1; @@ -162,6 +179,34 @@ private: #endif }; +inline void InlineFlowBox::setHorizontalOverflowPositions(int leftLayoutOverflow, int rightLayoutOverflow, int leftVisualOverflow, int rightVisualOverflow) +{ + if (!m_overflow) { + if (leftLayoutOverflow == m_x && rightLayoutOverflow == m_x + m_width && leftVisualOverflow == m_x && rightVisualOverflow == m_x + m_width) + return; + m_overflow.set(new RenderOverflow(IntRect(m_x, m_y, m_width, m_renderer->style(m_firstLine)->font().height()))); + } + + m_overflow->setLeftLayoutOverflow(leftLayoutOverflow); + m_overflow->setRightLayoutOverflow(rightLayoutOverflow); + m_overflow->setLeftVisualOverflow(leftVisualOverflow); + m_overflow->setRightVisualOverflow(rightVisualOverflow); +} + +inline void InlineFlowBox::setVerticalOverflowPositions(int topLayoutOverflow, int bottomLayoutOverflow, int topVisualOverflow, int bottomVisualOverflow, int boxHeight) +{ + if (!m_overflow) { + if (topLayoutOverflow == m_y && bottomLayoutOverflow == m_y + boxHeight && topVisualOverflow == m_y && bottomVisualOverflow == m_y + boxHeight) + return; + m_overflow.set(new RenderOverflow(IntRect(m_x, m_y, m_width, boxHeight))); + } + + m_overflow->setTopLayoutOverflow(topLayoutOverflow); + m_overflow->setBottomLayoutOverflow(bottomLayoutOverflow); + m_overflow->setTopVisualOverflow(topVisualOverflow); + m_overflow->setBottomVisualOverflow(bottomVisualOverflow); +} + #ifdef NDEBUG inline void InlineFlowBox::checkConsistency() const { |
