/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_REPLACED_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_REPLACED_H_ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/layout/layout_box.h" namespace blink { struct IntrinsicSizingInfo; // LayoutReplaced is the base class for a replaced element as defined by CSS: // // "An element whose content is outside the scope of the CSS formatting model, // such as an image, embedded document, or applet." // http://www.w3.org/TR/CSS2/conform.html#defs // // Blink consider that replaced elements have an intrinsic sizes (e.g. the // natural size of an image or a video). The intrinsic size is stored by // m_intrinsicSize. // // The computation sometimes ask for the intrinsic ratio, defined as follow: // // intrinsicWidth // intrinsicRatio = ------------------- // intrinsicHeight // // The intrinsic ratio is used to keep the same proportion as the intrinsic // size (thus avoiding visual distortions if width / height doesn't match // the intrinsic value). class CORE_EXPORT LayoutReplaced : public LayoutBox { public: LayoutReplaced(Element*); LayoutReplaced(Element*, const LayoutSize& intrinsic_size); ~LayoutReplaced() override; LayoutUnit ComputeReplacedLogicalWidth( ShouldComputePreferred = kComputeActual) const override; LayoutUnit ComputeReplacedLogicalHeight( LayoutUnit estimated_used_width = LayoutUnit()) const override; bool HasReplacedLogicalHeight() const; // This function returns the local rect of the replaced content. virtual PhysicalRect ReplacedContentRect() const; // This is used by a few special elements, e.g.