diff options
author | mstensho@opera.com <mstensho@opera.com> | 2015-02-13 13:52:18 +0000 |
---|---|---|
committer | mstensho@opera.com <mstensho@opera.com> | 2015-02-13 13:52:18 +0000 |
commit | ba1aed132a7f23207dba4f52f9d4bb9e2402c2b7 (patch) | |
tree | 573977615fb0293f3273250126b665f4d4134b3e /third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp | |
parent | b5c4c11cb69f1f2e3dbb318e9f4f88713fd268ab (diff) | |
download | chromium_src-ba1aed132a7f23207dba4f52f9d4bb9e2402c2b7.zip chromium_src-ba1aed132a7f23207dba4f52f9d4bb9e2402c2b7.tar.gz chromium_src-ba1aed132a7f23207dba4f52f9d4bb9e2402c2b7.tar.bz2 |
Move rendering/RenderImage* to layout/LayoutImage*
BUG=450612
TBR=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/923953002
git-svn-id: svn://svn.chromium.org/blink/trunk@190144 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp')
-rw-r--r-- | third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp new file mode 100644 index 0000000..7527b3e --- /dev/null +++ b/third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 1999 Lars Knoll <knoll@kde.org> + * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org> + * Copyright (C) 2000 Dirk Mueller <mueller@kde.org> + * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com> + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> + * + * 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. + * + */ + +#include "config.h" +#include "core/layout/LayoutImageResourceStyleImage.h" + +#include "core/fetch/ImageResource.h" +#include "core/layout/LayoutObject.h" +#include "core/layout/style/StyleFetchedImage.h" + +namespace blink { + +LayoutImageResourceStyleImage::LayoutImageResourceStyleImage(StyleImage* styleImage) + : m_styleImage(styleImage) +{ + ASSERT(m_styleImage); +} + +LayoutImageResourceStyleImage::~LayoutImageResourceStyleImage() +{ +} + +void LayoutImageResourceStyleImage::initialize(LayoutObject* renderer) +{ + LayoutImageResource::initialize(renderer); + + if (m_styleImage->isImageResource()) + m_cachedImage = toStyleFetchedImage(m_styleImage)->cachedImage(); + + m_styleImage->addClient(m_renderer); +} + +void LayoutImageResourceStyleImage::shutdown() +{ + ASSERT(m_renderer); + m_styleImage->removeClient(m_renderer); + m_cachedImage = 0; +} + +PassRefPtr<Image> LayoutImageResourceStyleImage::image(int width, int height) const +{ + // Generated content may trigger calls to image() while we're still pending, don't assert but gracefully exit. + if (m_styleImage->isPendingImage()) + return nullptr; + return m_styleImage->image(m_renderer, IntSize(width, height)); +} + +void LayoutImageResourceStyleImage::setContainerSizeForRenderer(const IntSize& size) +{ + ASSERT(m_renderer); + m_styleImage->setContainerSizeForRenderer(m_renderer, size, m_renderer->style()->effectiveZoom()); +} + +} // namespace blink |