RenderAttachment.cpp [plain text]
#include "config.h"
#include "RenderAttachment.h"
#if ENABLE(ATTACHMENT_ELEMENT)
#include "FloatRect.h"
#include "FloatRoundedRect.h"
#include "FrameSelection.h"
#include "HTMLAttachmentElement.h"
#include "RenderTheme.h"
#include "URL.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
using namespace HTMLNames;
WTF_MAKE_ISO_ALLOCATED_IMPL(RenderAttachment);
RenderAttachment::RenderAttachment(HTMLAttachmentElement& element, RenderStyle&& style)
: RenderReplaced(element, WTFMove(style), LayoutSize())
{
}
HTMLAttachmentElement& RenderAttachment::attachmentElement() const
{
return downcast<HTMLAttachmentElement>(nodeForNonAnonymous());
}
void RenderAttachment::layout()
{
LayoutSize newIntrinsicSize = theme().attachmentIntrinsicSize(*this);
m_minimumIntrinsicWidth = std::max(m_minimumIntrinsicWidth, newIntrinsicSize.width());
newIntrinsicSize.setWidth(m_minimumIntrinsicWidth);
setIntrinsicSize(newIntrinsicSize);
RenderReplaced::layout();
}
void RenderAttachment::invalidate()
{
setNeedsLayout();
repaint();
}
int RenderAttachment::baselinePosition(FontBaseline, bool, LineDirectionMode, LinePositionMode) const
{
return theme().attachmentBaseline(*this);
}
bool RenderAttachment::shouldDrawBorder() const
{
if (style().appearance() == BorderlessAttachmentPart)
return false;
return m_shouldDrawBorder;
}
}
#endif