18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (C) 1999 Antti Koivisto (koivisto@kde.org) 40bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is free software; you can redistribute it and/or 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modify it under the terms of the GNU Library General Public 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * License as published by the Free Software Foundation; either 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * version 2 of the License, or (at your option) any later version. 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * This library is distributed in the hope that it will be useful, 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * but WITHOUT ANY WARRANTY; without even the implied warranty of 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Library General Public License for more details. 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * You should have received a copy of the GNU Library General Public License 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * along with this library; see the file COPYING.LIB. If not, write to 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Boston, MA 02110-1301, USA. 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef RenderListItem_h 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define RenderListItem_h 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "RenderBlock.h" 278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass RenderListMarker; 318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass RenderListItem : public RenderBlock { 338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic: 34a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch explicit RenderListItem(Node*); 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int value() const { if (!m_isValueUpToDate) updateValueNow(); return m_value; } 378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void updateValue(); 388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool hasExplicitValue() const { return m_hasExplicitValue; } 408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int explicitValue() const { return m_explicitValue; } 418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setExplicitValue(int value); 428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void clearExplicitValue(); 438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch void setNotInList(bool notInList) { m_notInList = notInList; } 450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch bool notInList() const { return m_notInList; } 460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 47231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const String& markerText() const; 48bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen String markerTextWithSuffix() const; 49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 50dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateListMarkerNumbers(); 51dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 520bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochprivate: 530bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch virtual const char* renderName() const { return "RenderListItem"; } 540bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch virtual bool isListItem() const { return true; } 560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 570bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch virtual void destroy(); 580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual bool isEmpty() const; 608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void paint(PaintInfo&, int tx, int ty); 618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project virtual void layout(); 63bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen virtual void computePreferredLogicalWidths(); 648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 65f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch void positionListMarker(); 668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 678f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 69e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block virtual bool requiresForcedStyleRecalcPropagation() const { return true; } 70e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 71f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch virtual void addOverflowFromChildren(); 72f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void updateMarkerLocation(); 748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project inline int calcValue() const; 758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void updateValueNow() const; 768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void explicitValueChanged(); 778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RenderListMarker* m_marker; 798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int m_explicitValue; 808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project mutable int m_value; 818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool m_hasExplicitValue : 1; 838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project mutable bool m_isValueUpToDate : 1; 848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool m_notInList : 1; 858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochinline RenderListItem* toRenderListItem(RenderObject* object) 880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 890bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(!object || object->isListItem()); 900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return static_cast<RenderListItem*>(object); 910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 930bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch// This will catch anyone doing an unnecessary cast. 940bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid toRenderListItem(const RenderListItem*); 950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore 978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // RenderListItem_h 99