| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef RenderMedia_h | 26 #ifndef RenderMedia_h |
| 27 #define RenderMedia_h | 27 #define RenderMedia_h |
| 28 | 28 |
| 29 #include "core/rendering/RenderImage.h" | 29 #include "core/layout/LayoutImage.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 class HTMLMediaElement; | 33 class HTMLMediaElement; |
| 34 | 34 |
| 35 class RenderMedia : public RenderImage { | 35 class RenderMedia : public LayoutImage { |
| 36 public: | 36 public: |
| 37 explicit RenderMedia(HTMLMediaElement*); | 37 explicit RenderMedia(HTMLMediaElement*); |
| 38 virtual ~RenderMedia(); | 38 virtual ~RenderMedia(); |
| 39 | 39 |
| 40 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | 40 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
| 41 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | 41 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
| 42 | 42 |
| 43 // If you have a RenderMedia, use firstChild or lastChild instead. | 43 // If you have a RenderMedia, use firstChild or lastChild instead. |
| 44 void slowFirstChild() const = delete; | 44 void slowFirstChild() const = delete; |
| 45 void slowLastChild() const = delete; | 45 void slowLastChild() const = delete; |
| 46 | 46 |
| 47 const LayoutObjectChildList* children() const { return &m_children; } | 47 const LayoutObjectChildList* children() const { return &m_children; } |
| 48 LayoutObjectChildList* children() { return &m_children; } | 48 LayoutObjectChildList* children() { return &m_children; } |
| 49 | 49 |
| 50 HTMLMediaElement* mediaElement() const; | 50 HTMLMediaElement* mediaElement() const; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 virtual void layout() override; | 53 virtual void layout() override; |
| 54 | 54 |
| 55 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectMedia || RenderImage::isOfType(type); } | 55 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectMedia || LayoutImage::isOfType(type); } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 virtual LayoutObjectChildList* virtualChildren() override final { return chi
ldren(); } | 58 virtual LayoutObjectChildList* virtualChildren() override final { return chi
ldren(); } |
| 59 virtual const LayoutObjectChildList* virtualChildren() const override final
{ return children(); } | 59 virtual const LayoutObjectChildList* virtualChildren() const override final
{ return children(); } |
| 60 | 60 |
| 61 virtual LayerType layerTypeRequired() const override { return NormalLayer; } | 61 virtual LayerType layerTypeRequired() const override { return NormalLayer; } |
| 62 | 62 |
| 63 // FIXME: RenderMedia::layout makes assumptions about what children are allo
wed | 63 // FIXME: RenderMedia::layout makes assumptions about what children are allo
wed |
| 64 // so we can't support generated content. | 64 // so we can't support generated content. |
| 65 virtual bool canHaveGeneratedChildren() const override final { return false;
} | 65 virtual bool canHaveGeneratedChildren() const override final { return false;
} |
| 66 virtual bool canHaveChildren() const override final { return true; } | 66 virtual bool canHaveChildren() const override final { return true; } |
| 67 virtual bool isChildAllowed(LayoutObject*, const LayoutStyle&) const overrid
e final; | 67 virtual bool isChildAllowed(LayoutObject*, const LayoutStyle&) const overrid
e final; |
| 68 | 68 |
| 69 virtual const char* renderName() const override { return "RenderMedia"; } | 69 virtual const char* renderName() const override { return "RenderMedia"; } |
| 70 virtual bool isImage() const override final { return false; } | 70 virtual bool isImage() const override final { return false; } |
| 71 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override; | 71 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override; |
| 72 | 72 |
| 73 virtual bool backgroundShouldAlwaysBeClipped() const override final { return
false; } | 73 virtual bool backgroundShouldAlwaysBeClipped() const override final { return
false; } |
| 74 | 74 |
| 75 LayoutObjectChildList m_children; | 75 LayoutObjectChildList m_children; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderMedia, isMedia()); | 78 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderMedia, isMedia()); |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| 81 | 81 |
| 82 #endif // RenderMedia_h | 82 #endif // RenderMedia_h |
| OLD | NEW |