#include "core/rendering/InlineBox.h"
#include "core/rendering/RenderText.h" // so textRenderer() can be inline
-#include "platform/graphics/GraphicsContext.h"
+#include "platform/fonts/TextBlob.h"
#include "platform/text/TextRun.h"
#include "wtf/Forward.h"
-namespace WebCore {
+namespace blink {
struct CompositionUnderline;
class DocumentMarker;
+class GraphicsContext;
const unsigned short cNoTruncation = USHRT_MAX;
const unsigned short cFullTruncation = USHRT_MAX - 1;
-// Helper functions shared by InlineTextBox / SVGRootInlineBox
-void updateGraphicsContext(GraphicsContext*, const Color& fillColor, const Color& strokeColor, float strokeThickness, ColorSpace);
-Color correctedTextColor(Color textColor, Color backgroundColor);
-
class InlineTextBox : public InlineBox {
public:
InlineTextBox(RenderObject& obj)
{
}
+ RenderText& renderer() const { return toRenderText(InlineBox::renderer()); }
+
virtual void destroy() OVERRIDE FINAL;
InlineTextBox* prevTextBox() const { return m_prevTextBox; }
void setLogicalOverflowRect(const LayoutRect&);
LayoutUnit logicalTopVisualOverflow() const { return logicalOverflowRect().y(); }
LayoutUnit logicalBottomVisualOverflow() const { return logicalOverflowRect().maxY(); }
- LayoutUnit logicalLeftVisualOverflow() const { return logicalOverflowRect().x(); }
- LayoutUnit logicalRightVisualOverflow() const { return logicalOverflowRect().maxX(); }
#ifndef NDEBUG
virtual void showBox(int = 0) const OVERRIDE;
virtual LayoutRect localSelectionRect(int startPos, int endPos);
bool isSelected(int startPos, int endPos) const;
- void selectionStartEnd(int& sPos, int& ePos);
+ void selectionStartEnd(int& sPos, int& ePos) const;
protected:
virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE;
-public:
- RenderText& textRenderer() const;
-
private:
virtual void deleteLine() OVERRIDE FINAL;
virtual void extractLine() OVERRIDE FINAL;
virtual void attachLine() OVERRIDE FINAL;
public:
- virtual RenderObject::SelectionState selectionState() OVERRIDE FINAL;
+ virtual RenderObject::SelectionState selectionState() const OVERRIDE FINAL;
private:
virtual void clearTruncation() OVERRIDE FINAL { m_truncation = cNoTruncation; }
unsigned short m_truncation; // Where to truncate when text overflow is applied. We use special constants to
// denote no truncation (the whole run paints) and full truncation (nothing paints at all).
+ unsigned underlinePaintStart(const CompositionUnderline&);
+ unsigned underlinePaintEnd(const CompositionUnderline&);
+
protected:
- void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, int startPos, int endPos);
+ void paintSingleCompositionBackgroundRun(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color backgroundColor, int startPos, int endPos);
+ void paintCompositionBackgrounds(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, bool useCustomUnderlines);
void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, bool background);
void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&);
virtual void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&);
private:
- void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDecoration, const ShadowList*);
+ void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDecoration);
void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor);
TextRun::ExpansionBehavior expansionBehavior() const
DEFINE_INLINE_BOX_TYPE_CASTS(InlineTextBox);
-inline RenderText& InlineTextBox::textRenderer() const
-{
- return toRenderText(renderer());
-}
-
void alignSelectionRectToDevicePixels(FloatRect&);
inline AffineTransform InlineTextBox::rotation(const FloatRect& boxRect, RotationDirection rotationDirection)
: AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY());
}
-} // namespace WebCore
+} // namespace blink
#endif // InlineTextBox_h