| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "core/dom/FullscreenElementStack.h" | 28 #include "core/dom/FullscreenElementStack.h" |
| 29 | 29 |
| 30 using namespace WebCore; | 30 using namespace WebCore; |
| 31 | 31 |
| 32 class RenderFullScreenPlaceholder FINAL : public RenderBlock { | 32 class RenderFullScreenPlaceholder FINAL : public RenderBlock { |
| 33 public: | 33 public: |
| 34 RenderFullScreenPlaceholder(RenderFullScreen* owner) | 34 RenderFullScreenPlaceholder(RenderFullScreen* owner) |
| 35 : RenderBlock(0) | 35 : RenderBlock(0) |
| 36 , m_owner(owner) | 36 , m_owner(owner) |
| 37 { | 37 { |
| 38 setDocumentForAnonymous(owner->document()); | 38 setDocumentForAnonymous(&owner->document()); |
| 39 } | 39 } |
| 40 private: | 40 private: |
| 41 virtual bool isRenderFullScreenPlaceholder() const { return true; } | 41 virtual bool isRenderFullScreenPlaceholder() const { return true; } |
| 42 virtual void willBeDestroyed(); | 42 virtual void willBeDestroyed(); |
| 43 RenderFullScreen* m_owner; | 43 RenderFullScreen* m_owner; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 void RenderFullScreenPlaceholder::willBeDestroyed() | 46 void RenderFullScreenPlaceholder::willBeDestroyed() |
| 47 { | 47 { |
| 48 m_owner->setPlaceholder(0); | 48 m_owner->setPlaceholder(0); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 { | 67 { |
| 68 if (m_placeholder) { | 68 if (m_placeholder) { |
| 69 remove(); | 69 remove(); |
| 70 if (!m_placeholder->beingDestroyed()) | 70 if (!m_placeholder->beingDestroyed()) |
| 71 m_placeholder->destroy(); | 71 m_placeholder->destroy(); |
| 72 ASSERT(!m_placeholder); | 72 ASSERT(!m_placeholder); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // RenderObjects are unretained, so notify the document (which holds a point
er to a RenderFullScreen) | 75 // RenderObjects are unretained, so notify the document (which holds a point
er to a RenderFullScreen) |
| 76 // if it's RenderFullScreen is destroyed. | 76 // if it's RenderFullScreen is destroyed. |
| 77 if (document()) { | 77 FullscreenElementStack* controller = FullscreenElementStack::from(&document(
)); |
| 78 FullscreenElementStack* controller = FullscreenElementStack::from(docume
nt()); | 78 if (controller->fullScreenRenderer() == this) |
| 79 if (controller->fullScreenRenderer() == this) | 79 controller->fullScreenRendererDestroyed(); |
| 80 controller->fullScreenRendererDestroyed(); | |
| 81 } | |
| 82 | 80 |
| 83 RenderFlexibleBox::willBeDestroyed(); | 81 RenderFlexibleBox::willBeDestroyed(); |
| 84 } | 82 } |
| 85 | 83 |
| 86 static PassRefPtr<RenderStyle> createFullScreenStyle() | 84 static PassRefPtr<RenderStyle> createFullScreenStyle() |
| 87 { | 85 { |
| 88 RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle(); | 86 RefPtr<RenderStyle> fullscreenStyle = RenderStyle::createDefaultStyle(); |
| 89 | 87 |
| 90 // Create a stacking context: | 88 // Create a stacking context: |
| 91 fullscreenStyle->setZIndex(INT_MAX); | 89 fullscreenStyle->setZIndex(INT_MAX); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (child->isBox()) | 153 if (child->isBox()) |
| 156 toRenderBox(child)->clearOverrideSize(); | 154 toRenderBox(child)->clearOverrideSize(); |
| 157 child->remove(); | 155 child->remove(); |
| 158 parent()->addChild(child, this); | 156 parent()->addChild(child, this); |
| 159 parent()->setNeedsLayoutAndPrefWidthsRecalc(); | 157 parent()->setNeedsLayoutAndPrefWidthsRecalc(); |
| 160 } | 158 } |
| 161 } | 159 } |
| 162 if (placeholder()) | 160 if (placeholder()) |
| 163 placeholder()->remove(); | 161 placeholder()->remove(); |
| 164 remove(); | 162 remove(); |
| 165 FullscreenElementStack::from(document())->setFullScreenRenderer(0); | 163 FullscreenElementStack::from(&document())->setFullScreenRenderer(0); |
| 166 } | 164 } |
| 167 | 165 |
| 168 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder) | 166 void RenderFullScreen::setPlaceholder(RenderBlock* placeholder) |
| 169 { | 167 { |
| 170 m_placeholder = placeholder; | 168 m_placeholder = placeholder; |
| 171 } | 169 } |
| 172 | 170 |
| 173 void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const La
youtRect& frameRect) | 171 void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const La
youtRect& frameRect) |
| 174 { | 172 { |
| 175 if (style->width().isAuto()) | 173 if (style->width().isAuto()) |
| 176 style->setWidth(Length(frameRect.width(), Fixed)); | 174 style->setWidth(Length(frameRect.width(), Fixed)); |
| 177 if (style->height().isAuto()) | 175 if (style->height().isAuto()) |
| 178 style->setHeight(Length(frameRect.height(), Fixed)); | 176 style->setHeight(Length(frameRect.height(), Fixed)); |
| 179 | 177 |
| 180 if (!m_placeholder) { | 178 if (!m_placeholder) { |
| 181 m_placeholder = new RenderFullScreenPlaceholder(this); | 179 m_placeholder = new RenderFullScreenPlaceholder(this); |
| 182 m_placeholder->setStyle(style); | 180 m_placeholder->setStyle(style); |
| 183 if (parent()) { | 181 if (parent()) { |
| 184 parent()->addChild(m_placeholder, this); | 182 parent()->addChild(m_placeholder, this); |
| 185 parent()->setNeedsLayoutAndPrefWidthsRecalc(); | 183 parent()->setNeedsLayoutAndPrefWidthsRecalc(); |
| 186 } | 184 } |
| 187 } else | 185 } else |
| 188 m_placeholder->setStyle(style); | 186 m_placeholder->setStyle(style); |
| 189 } | 187 } |
| OLD | NEW |