2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef RenderListMarker_h
24 #define RenderListMarker_h
26 #include "core/rendering/RenderBox.h"
32 String listMarkerText(EListStyleType, int value);
34 // Used to render the list item's marker.
35 // The RenderListMarker always has to be a child of a RenderListItem.
36 class RenderListMarker FINAL : public RenderBox {
38 static RenderListMarker* createAnonymous(RenderListItem*);
40 virtual ~RenderListMarker();
41 virtual void trace(Visitor*) OVERRIDE;
43 const String& text() const { return m_text; }
44 String suffix() const;
46 bool isInside() const;
48 void updateMarginsAndContent();
51 RenderListMarker(RenderListItem*);
53 virtual const char* renderName() const OVERRIDE { return "RenderListMarker"; }
54 virtual void computePreferredLogicalWidths() OVERRIDE;
56 virtual bool isListMarker() const OVERRIDE { return true; }
58 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
60 virtual void layout() OVERRIDE;
62 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
64 virtual InlineBox* createInlineBox() OVERRIDE;
66 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE;
67 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE;
69 virtual bool isImage() const OVERRIDE;
70 bool isText() const { return !isImage(); }
72 virtual void setSelectionState(SelectionState) OVERRIDE;
73 virtual LayoutRect selectionRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, bool clipToVisibleContent = true) OVERRIDE;
74 virtual bool canBeSelectionLeaf() const OVERRIDE { return true; }
79 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) OVERRIDE;
80 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
82 IntRect getRelativeMarkerRect();
83 LayoutRect localSelectionRect();
86 RefPtr<StyleImage> m_image;
87 RawPtrWillBeMember<RenderListItem> m_listItem;
90 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListMarker, isListMarker());
94 #endif // RenderListMarker_h