diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-06-21 23:16:08 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-06-21 23:16:08 (GMT) |
commit | 511d86e88b33380116f27d5f6a2a0754e8f62fa0 (patch) | |
tree | 6fdcb11b5270984112bc2563738c24d2891595d4 /src/3rdparty/webkit/WebCore/rendering/RenderText.h | |
parent | aae3c899b10bee2dd64bb00bb2832620a47cff87 (diff) | |
parent | fbf9db1fc6b500bfe05fdfca121986687d73d5c6 (diff) | |
download | Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.zip Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.gz Qt-511d86e88b33380116f27d5f6a2a0754e8f62fa0.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/3rdparty/webkit/WebCore/rendering/RenderText.h')
-rw-r--r-- | src/3rdparty/webkit/WebCore/rendering/RenderText.h | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderText.h b/src/3rdparty/webkit/WebCore/rendering/RenderText.h index 4c62638..2e04a9e 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderText.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderText.h @@ -1,7 +1,7 @@ /* * (C) 1999 Lars Knoll (knoll@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -52,26 +52,23 @@ public: StringImpl* text() const { return m_text.get(); } - virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun = false); - virtual InlineTextBox* createInlineTextBox(); - virtual void dirtyLineBoxes(bool fullLayout, bool isRootInlineBox = false); + InlineTextBox* createInlineTextBox(); + void dirtyLineBoxes(bool fullLayout); - virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true); - virtual void addLineBoxRects(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false); + virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); + void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false); - virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true); - virtual void collectAbsoluteLineBoxQuads(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false); + virtual void absoluteQuads(Vector<FloatQuad>&); + void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false); - virtual VisiblePosition positionForCoordinates(int x, int y); + virtual VisiblePosition positionForPoint(const IntPoint&); const UChar* characters() const { return m_text->characters(); } unsigned textLength() const { return m_text->length(); } // non virtual implementation of length() - virtual void position(InlineBox*); + void positionLineBox(InlineBox*); - virtual unsigned width(unsigned from, unsigned len, const Font&, int xPos) const; - virtual unsigned width(unsigned from, unsigned len, int xPos, bool firstLine = false) const; - virtual int width() const; - virtual int height() const; + virtual unsigned width(unsigned from, unsigned len, const Font&, int xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0) const; + virtual unsigned width(unsigned from, unsigned len, int xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0) const; virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const; @@ -85,28 +82,24 @@ public: int& beginMaxW, int& endMaxW, int& minW, int& maxW, bool& stripFrontSpaces); - // returns the minimum x position of all runs relative to the parent. - // defaults to 0. - int minXPos() const; + IntRect linesBoundingBox() const; - virtual int xPos() const; - virtual int yPos() const; - - virtual int verticalPositionHint(bool firstLine) const; + IntPoint firstRunOrigin() const; + int firstRunX() const; + int firstRunY() const; void setText(PassRefPtr<StringImpl>, bool force = false); void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len, bool force = false); virtual bool canBeSelectionLeaf() const { return true; } - virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); } virtual void setSelectionState(SelectionState s); - virtual IntRect selectionRect(bool clipToVisibleContent = true); + virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); virtual int marginLeft() const { return style()->marginLeft().calcMinValue(0); } virtual int marginRight() const { return style()->marginRight().calcMinValue(0); } - virtual IntRect absoluteClippedOverflowRect(); + virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); InlineTextBox* firstTextBox() const { return m_firstTextBox; } InlineTextBox* lastTextBox() const { return m_lastTextBox; } @@ -116,6 +109,7 @@ public: virtual unsigned caretMaxRenderedOffset() const; virtual int previousOffset(int current) const; + virtual int previousOffsetForBackwardDeletion(int current) const; virtual int nextOffset(int current) const; bool containsReversedText() const { return m_containsReversedText; } @@ -126,14 +120,20 @@ public: void checkConsistency() const; + virtual void calcPrefWidths(int leadWidth); + protected: - virtual void styleDidChange(RenderStyle::Diff, const RenderStyle* oldStyle); + virtual void styleWillChange(StyleDifference, const RenderStyle*) { } + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); virtual void setTextInternal(PassRefPtr<StringImpl>); - virtual void calcPrefWidths(int leadWidth); virtual UChar previousCharacter(); + + virtual InlineTextBox* createTextBox(); // Subclassed by SVG. private: + void calcPrefWidths(int leadWidth, HashSet<const SimpleFontData*>& fallbackFonts); + // Make length() private so that callers that have a RenderText* // will use the more efficient textLength() instead, while // callers with a RenderObject* can continue to use length(). @@ -145,20 +145,20 @@ private: void deleteTextBoxes(); bool containsOnlyWhitespace(unsigned from, unsigned len) const; - int widthFromCache(const Font&, int start, int len, int xPos) const; + int widthFromCache(const Font&, int start, int len, int xPos, HashSet<const SimpleFontData*>* fallbackFonts) const; bool isAllASCII() const { return m_isAllASCII; } + int m_minWidth; // here to minimize padding in 64-bit. + RefPtr<StringImpl> m_text; InlineTextBox* m_firstTextBox; InlineTextBox* m_lastTextBox; - int m_minWidth; int m_maxWidth; int m_beginMinWidth; int m_endMinWidth; - unsigned m_selectionState : 3; // enums on Windows are signed, so this needs to be unsigned to prevent it turning negative. bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines. bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> with '\n'). bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t'). @@ -170,8 +170,24 @@ private: // or removed). bool m_containsReversedText : 1; bool m_isAllASCII : 1; + mutable bool m_knownNotToUseFallbackFonts : 1; }; +inline RenderText* toRenderText(RenderObject* o) +{ + ASSERT(!o || o->isText()); + return static_cast<RenderText*>(o); +} + +inline const RenderText* toRenderText(const RenderObject* o) +{ + ASSERT(!o || o->isText()); + return static_cast<const RenderText*>(o); +} + +// This will catch anyone doing an unnecessary cast. +void toRenderText(const RenderText*); + #ifdef NDEBUG inline void RenderText::checkConsistency() const { |