| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/layout/LayoutBlockFlow.h" | 31 #include "core/layout/LayoutBlockFlow.h" |
| 32 #include "core/page/Page.h" | 32 #include "core/page/Page.h" |
| 33 | 33 |
| 34 #include "public/platform/WebScreenInfo.h" | 34 #include "public/platform/WebScreenInfo.h" |
| 35 | 35 |
| 36 using namespace blink; | 36 using namespace blink; |
| 37 | 37 |
| 38 class LayoutFullScreenPlaceholder final : public LayoutBlockFlow { | 38 class LayoutFullScreenPlaceholder final : public LayoutBlockFlow { |
| 39 public: | 39 public: |
| 40 LayoutFullScreenPlaceholder(LayoutFullScreen* owner) | 40 LayoutFullScreenPlaceholder(LayoutFullScreen* owner) |
| 41 : LayoutBlockFlow(0) | 41 : LayoutBlockFlow(nullptr) |
| 42 , m_owner(owner) | 42 , m_owner(owner) |
| 43 { | 43 { |
| 44 setDocumentForAnonymous(&owner->document()); | 44 setDocumentForAnonymous(&owner->document()); |
| 45 } | 45 } |
| 46 private: | 46 private: |
| 47 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectLayoutFullScreenPlaceholder || LayoutBlockFlow::isOfType(type); } | 47 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectLayoutFullScreenPlaceholder || LayoutBlockFlow::isOfType(type); } |
| 48 virtual void willBeDestroyed() override; | 48 virtual void willBeDestroyed() override; |
| 49 LayoutFullScreen* m_owner; | 49 LayoutFullScreen* m_owner; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 void LayoutFullScreenPlaceholder::willBeDestroyed() | 52 void LayoutFullScreenPlaceholder::willBeDestroyed() |
| 53 { | 53 { |
| 54 m_owner->setPlaceholder(0); | 54 m_owner->setPlaceholder(nullptr); |
| 55 LayoutBlockFlow::willBeDestroyed(); | 55 LayoutBlockFlow::willBeDestroyed(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 LayoutFullScreen::LayoutFullScreen() | 58 LayoutFullScreen::LayoutFullScreen() |
| 59 : LayoutFlexibleBox(0) | 59 : LayoutFlexibleBox(nullptr) |
| 60 , m_placeholder(nullptr) | 60 , m_placeholder(nullptr) |
| 61 { | 61 { |
| 62 setReplaced(false); | 62 setReplaced(false); |
| 63 } | 63 } |
| 64 | 64 |
| 65 LayoutFullScreen* LayoutFullScreen::createAnonymous(Document* document) | 65 LayoutFullScreen* LayoutFullScreen::createAnonymous(Document* document) |
| 66 { | 66 { |
| 67 LayoutFullScreen* layoutObject = new LayoutFullScreen(); | 67 LayoutFullScreen* layoutObject = new LayoutFullScreen(); |
| 68 layoutObject->setDocumentForAnonymous(document); | 68 layoutObject->setDocumentForAnonymous(document); |
| 69 return layoutObject; | 69 return layoutObject; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 LayoutObject* LayoutFullScreen::wrapLayoutObject(LayoutObject* object, LayoutObj
ect* parent, Document* document) | 117 LayoutObject* LayoutFullScreen::wrapLayoutObject(LayoutObject* object, LayoutObj
ect* parent, Document* document) |
| 118 { | 118 { |
| 119 // FIXME: We should not modify the structure of the layout tree during | 119 // FIXME: We should not modify the structure of the layout tree during |
| 120 // layout. crbug.com/370459 | 120 // layout. crbug.com/370459 |
| 121 DeprecatedDisableModifyLayoutTreeStructureAsserts disabler; | 121 DeprecatedDisableModifyLayoutTreeStructureAsserts disabler; |
| 122 | 122 |
| 123 LayoutFullScreen* fullscreenLayoutObject = LayoutFullScreen::createAnonymous
(document); | 123 LayoutFullScreen* fullscreenLayoutObject = LayoutFullScreen::createAnonymous
(document); |
| 124 fullscreenLayoutObject->updateStyle(); | 124 fullscreenLayoutObject->updateStyle(); |
| 125 if (parent && !parent->isChildAllowed(fullscreenLayoutObject, fullscreenLayo
utObject->styleRef())) { | 125 if (parent && !parent->isChildAllowed(fullscreenLayoutObject, fullscreenLayo
utObject->styleRef())) { |
| 126 fullscreenLayoutObject->destroy(); | 126 fullscreenLayoutObject->destroy(); |
| 127 return 0; | 127 return nullptr; |
| 128 } | 128 } |
| 129 if (object) { | 129 if (object) { |
| 130 // |object->parent()| can be null if the object is not yet attached | 130 // |object->parent()| can be null if the object is not yet attached |
| 131 // to |parent|. | 131 // to |parent|. |
| 132 if (LayoutObject* parent = object->parent()) { | 132 if (LayoutObject* parent = object->parent()) { |
| 133 LayoutBlock* containingBlock = object->containingBlock(); | 133 LayoutBlock* containingBlock = object->containingBlock(); |
| 134 ASSERT(containingBlock); | 134 ASSERT(containingBlock); |
| 135 // Since we are moving the |object| to a new parent |fullscreenLayou
tObject|, | 135 // Since we are moving the |object| to a new parent |fullscreenLayou
tObject|, |
| 136 // the line box tree underneath our |containingBlock| is not longer
valid. | 136 // the line box tree underneath our |containingBlock| is not longer
valid. |
| 137 containingBlock->deleteLineBoxTree(); | 137 containingBlock->deleteLineBoxTree(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 m_placeholder = new LayoutFullScreenPlaceholder(this); | 194 m_placeholder = new LayoutFullScreenPlaceholder(this); |
| 195 m_placeholder->setStyle(style); | 195 m_placeholder->setStyle(style); |
| 196 if (parent()) { | 196 if (parent()) { |
| 197 parent()->addChild(m_placeholder, this); | 197 parent()->addChild(m_placeholder, this); |
| 198 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); | 198 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); |
| 199 } | 199 } |
| 200 } else { | 200 } else { |
| 201 m_placeholder->setStyle(style); | 201 m_placeholder->setStyle(style); |
| 202 } | 202 } |
| 203 } | 203 } |
| OLD | NEW |