diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h b/chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h index 3d6fdee393a..27579edf5cb 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h +++ b/chromium/third_party/WebKit/Source/core/rendering/InlineTextBox.h @@ -23,9 +23,10 @@ #ifndef InlineTextBox_h #define InlineTextBox_h -#include "core/platform/graphics/TextRun.h" #include "core/rendering/InlineBox.h" #include "core/rendering/RenderText.h" // so textRenderer() can be inline +#include "platform/graphics/GraphicsContext.h" +#include "platform/text/TextRun.h" #include "wtf/Forward.h" namespace WebCore { @@ -97,6 +98,8 @@ public: virtual const char* boxName() const; #endif + enum RotationDirection { Counterclockwise, Clockwise }; + static AffineTransform rotation(const FloatRect& boxRect, RotationDirection); private: LayoutUnit selectionTop(); LayoutUnit selectionBottom(); @@ -159,6 +162,9 @@ public: bool containsCaretOffset(int offset) const; // false for offset after line break + // Fills a vector with the pixel width of each character. + void characterWidths(Vector<float>&) const; + private: InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderObject InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObject @@ -175,7 +181,7 @@ protected: void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&); private: - void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowData*); + void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowList*); void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor); void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar); void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&); @@ -187,20 +193,7 @@ private: } }; -inline InlineTextBox* toInlineTextBox(InlineBox* inlineBox) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!inlineBox || inlineBox->isInlineTextBox()); - return static_cast<InlineTextBox*>(inlineBox); -} - -inline const InlineTextBox* toInlineTextBox(const InlineBox* inlineBox) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!inlineBox || inlineBox->isInlineTextBox()); - return static_cast<const InlineTextBox*>(inlineBox); -} - -// This will catch anyone doing an unnecessary cast. -void toInlineTextBox(const InlineTextBox*); +DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox); inline RenderText* InlineTextBox::textRenderer() const { @@ -209,6 +202,12 @@ inline RenderText* InlineTextBox::textRenderer() const void alignSelectionRectToDevicePixels(FloatRect&); +inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, RotationDirection rotationDirection) +{ + return rotationDirection == Clockwise ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) + : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY()); +} + } // namespace WebCore #endif // InlineTextBox_h |