1 /* 2 * Copyright (C) 1999 Lars Knoll (knoll (at) kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 */ 21 22 #ifndef RenderReplaced_h 23 #define RenderReplaced_h 24 25 #include "RenderBox.h" 26 27 namespace WebCore { 28 29 class RenderReplaced : public RenderBox { 30 public: 31 RenderReplaced(Node*); 32 RenderReplaced(Node*, const IntSize& intrinsicSize); 33 virtual ~RenderReplaced(); 34 35 protected: 36 virtual void layout(); 37 38 virtual IntSize intrinsicSize() const; 39 40 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 41 virtual int computeReplacedLogicalHeight() const; 42 virtual int minimumReplacedHeight() const { return 0; } 43 44 virtual void setSelectionState(SelectionState); 45 46 bool isSelected() const; 47 48 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 49 50 void setIntrinsicSize(const IntSize&); 51 virtual void intrinsicSizeChanged(); 52 void setHasIntrinsicSize() { m_hasIntrinsicSize = true; } 53 54 virtual void paint(PaintInfo&, int tx, int ty); 55 bool shouldPaint(PaintInfo&, int& tx, int& ty); 56 IntRect localSelectionRect(bool checkWhetherSelected = true) const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left). 57 58 private: 59 virtual const char* renderName() const { return "RenderReplaced"; } 60 61 virtual bool canHaveChildren() const { return false; } 62 63 virtual void computePreferredLogicalWidths(); 64 65 int calcAspectRatioLogicalWidth() const; 66 int calcAspectRatioLogicalHeight() const; 67 68 virtual void paintReplaced(PaintInfo&, int /*tx*/, int /*ty*/) { } 69 70 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); 71 72 virtual unsigned caretMaxRenderedOffset() const; 73 virtual VisiblePosition positionForPoint(const IntPoint&); 74 75 virtual bool canBeSelectionLeaf() const { return true; } 76 77 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); 78 79 IntSize m_intrinsicSize; 80 bool m_hasIntrinsicSize; 81 }; 82 83 } 84 85 #endif 86