2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
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.
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.
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.
22 #ifndef RenderReplaced_h
23 #define RenderReplaced_h
25 #include "RenderBox.h"
29 class RenderReplaced : public RenderBox {
31 RenderReplaced(Node*);
32 RenderReplaced(Node*, const IntSize& intrinsicSize);
33 virtual ~RenderReplaced();
35 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
36 virtual LayoutUnit computeReplacedLogicalHeight() const;
38 bool hasReplacedLogicalWidth() const;
39 bool hasReplacedLogicalHeight() const;
42 virtual void willBeDestroyed();
44 virtual void layout();
46 virtual IntSize intrinsicSize() const { return m_intrinsicSize; }
47 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const;
49 virtual int minimumReplacedHeight() const { return 0; }
51 virtual void setSelectionState(SelectionState);
53 bool isSelected() const;
55 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
57 void setIntrinsicSize(const IntSize& intrinsicSize) { m_intrinsicSize = intrinsicSize; }
58 virtual void intrinsicSizeChanged();
60 virtual void paint(PaintInfo&, const LayoutPoint&);
61 bool shouldPaint(PaintInfo&, const LayoutPoint&);
62 LayoutRect 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).
65 virtual RenderBox* embeddedContentBox() const { return 0; }
66 virtual const char* renderName() const { return "RenderReplaced"; }
68 virtual bool canHaveChildren() const { return false; }
70 virtual void computePreferredLogicalWidths();
71 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) { }
73 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
75 virtual VisiblePosition positionForPoint(const LayoutPoint&);
77 virtual bool canBeSelectionLeaf() const { return true; }
79 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
80 void computeAspectRatioInformationForRenderBox(RenderBox*, FloatSize& constrainedSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const;
82 mutable IntSize m_intrinsicSize;