1 /* 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. 5 * 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. 10 * 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. 15 * 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. 20 * 21 */ 22 23 #ifndef RenderListMarker_h 24 #define RenderListMarker_h 25 26 #include "core/rendering/RenderBox.h" 27 28 namespace WebCore { 29 30 class RenderListItem; 31 32 String listMarkerText(EListStyleType, int value); 33 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 { 37 public: 38 static RenderListMarker* createAnonymous(RenderListItem*); 39 40 virtual ~RenderListMarker(); 41 text()42 const String& text() const { return m_text; } 43 String suffix() const; 44 45 bool isInside() const; 46 47 void updateMarginsAndContent(); 48 49 private: 50 RenderListMarker(RenderListItem*); 51 renderName()52 virtual const char* renderName() const { return "RenderListMarker"; } 53 virtual void computePreferredLogicalWidths() OVERRIDE; 54 isListMarker()55 virtual bool isListMarker() const { return true; } 56 57 virtual void paint(PaintInfo&, const LayoutPoint&); 58 59 virtual void layout(); 60 61 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); 62 63 virtual InlineBox* createInlineBox(); 64 65 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 66 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 67 68 bool isImage() const; isText()69 bool isText() const { return !isImage(); } 70 71 virtual void setSelectionState(SelectionState); 72 virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) OVERRIDE; canBeSelectionLeaf()73 virtual bool canBeSelectionLeaf() const { return true; } 74 75 void updateMargins(); 76 void updateContent(); 77 78 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); 79 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 80 81 IntRect getRelativeMarkerRect(); 82 LayoutRect localSelectionRect(); 83 84 String m_text; 85 RefPtr<StyleImage> m_image; 86 RenderListItem* m_listItem; 87 }; 88 89 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderListMarker, isListMarker()); 90 91 } // namespace WebCore 92 93 #endif // RenderListMarker_h 94