| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void LayoutFullScreen::willBeDestroyed() { | 75 void LayoutFullScreen::willBeDestroyed() { |
| 76 if (m_placeholder) { | 76 if (m_placeholder) { |
| 77 remove(); | 77 remove(); |
| 78 if (!m_placeholder->beingDestroyed()) | 78 if (!m_placeholder->beingDestroyed()) |
| 79 m_placeholder->destroy(); | 79 m_placeholder->destroy(); |
| 80 DCHECK(!m_placeholder); | 80 DCHECK(!m_placeholder); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // LayoutObjects are unretained, so notify the document (which holds a pointer
to a LayoutFullScreen) | 83 // LayoutObjects are unretained, so notify the document (which holds a pointer |
| 84 // if its LayoutFullScreen is destroyed. | 84 // to a LayoutFullScreen) if its LayoutFullScreen is destroyed. |
| 85 Fullscreen& fullscreen = Fullscreen::from(document()); | 85 Fullscreen& fullscreen = Fullscreen::from(document()); |
| 86 if (fullscreen.fullScreenLayoutObject() == this) | 86 if (fullscreen.fullScreenLayoutObject() == this) |
| 87 fullscreen.fullScreenLayoutObjectDestroyed(); | 87 fullscreen.fullScreenLayoutObjectDestroyed(); |
| 88 | 88 |
| 89 LayoutFlexibleBox::willBeDestroyed(); | 89 LayoutFlexibleBox::willBeDestroyed(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void LayoutFullScreen::updateStyle(LayoutObject* parent) { | 92 void LayoutFullScreen::updateStyle(LayoutObject* parent) { |
| 93 RefPtr<ComputedStyle> fullscreenStyle = ComputedStyle::create(); | 93 RefPtr<ComputedStyle> fullscreenStyle = ComputedStyle::create(); |
| 94 | 94 |
| 95 // Create a stacking context: | 95 // Create a stacking context: |
| 96 fullscreenStyle->setZIndex(INT_MAX); | 96 fullscreenStyle->setZIndex(INT_MAX); |
| 97 fullscreenStyle->setIsStackingContext(true); | 97 fullscreenStyle->setIsStackingContext(true); |
| 98 | 98 |
| 99 fullscreenStyle->setFontDescription(FontDescription()); | 99 fullscreenStyle->setFontDescription(FontDescription()); |
| 100 fullscreenStyle->font().update(nullptr); | 100 fullscreenStyle->font().update(nullptr); |
| 101 | 101 |
| 102 fullscreenStyle->setDisplay(EDisplay::Flex); | 102 fullscreenStyle->setDisplay(EDisplay::Flex); |
| 103 fullscreenStyle->setJustifyContentPosition(ContentPositionCenter); | 103 fullscreenStyle->setJustifyContentPosition(ContentPositionCenter); |
| 104 // TODO (lajava): Since the FullScrenn layout object is anonymous, its Default
Alignment (align-items) value can't be used to resolve its children Self Alignm
ent 'auto' values. | 104 // TODO (lajava): Since the FullScrenn layout object is anonymous, its Default |
| 105 // Alignment (align-items) value can't be used to resolve its children Self |
| 106 // Alignment 'auto' values. |
| 105 fullscreenStyle->setAlignItemsPosition(ItemPositionCenter); | 107 fullscreenStyle->setAlignItemsPosition(ItemPositionCenter); |
| 106 fullscreenStyle->setFlexDirection(FlowColumn); | 108 fullscreenStyle->setFlexDirection(FlowColumn); |
| 107 | 109 |
| 108 fullscreenStyle->setPosition(FixedPosition); | 110 fullscreenStyle->setPosition(FixedPosition); |
| 109 fullscreenStyle->setLeft(Length(0, blink::Fixed)); | 111 fullscreenStyle->setLeft(Length(0, blink::Fixed)); |
| 110 fullscreenStyle->setTop(Length(0, blink::Fixed)); | 112 fullscreenStyle->setTop(Length(0, blink::Fixed)); |
| 111 IntSize viewportSize = document().page()->frameHost().visualViewport().size(); | 113 IntSize viewportSize = document().page()->frameHost().visualViewport().size(); |
| 112 fullscreenStyle->setWidth(Length(viewportSize.width(), blink::Fixed)); | 114 fullscreenStyle->setWidth(Length(viewportSize.width(), blink::Fixed)); |
| 113 fullscreenStyle->setHeight(Length(viewportSize.height(), blink::Fixed)); | 115 fullscreenStyle->setHeight(Length(viewportSize.height(), blink::Fixed)); |
| 114 | 116 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 136 fullscreenLayoutObject->styleRef())) { | 138 fullscreenLayoutObject->styleRef())) { |
| 137 fullscreenLayoutObject->destroy(); | 139 fullscreenLayoutObject->destroy(); |
| 138 return nullptr; | 140 return nullptr; |
| 139 } | 141 } |
| 140 if (object) { | 142 if (object) { |
| 141 // |object->parent()| can be null if the object is not yet attached | 143 // |object->parent()| can be null if the object is not yet attached |
| 142 // to |parent|. | 144 // to |parent|. |
| 143 if (LayoutObject* parent = object->parent()) { | 145 if (LayoutObject* parent = object->parent()) { |
| 144 LayoutBlock* containingBlock = object->containingBlock(); | 146 LayoutBlock* containingBlock = object->containingBlock(); |
| 145 DCHECK(containingBlock); | 147 DCHECK(containingBlock); |
| 146 // Since we are moving the |object| to a new parent |fullscreenLayoutObjec
t|, | 148 // Since we are moving the |object| to a new parent |
| 147 // the line box tree underneath our |containingBlock| is not longer valid. | 149 // |fullscreenLayoutObject|, the line box tree underneath our |
| 150 // |containingBlock| is not longer valid. |
| 148 if (containingBlock->isLayoutBlockFlow()) | 151 if (containingBlock->isLayoutBlockFlow()) |
| 149 toLayoutBlockFlow(containingBlock)->deleteLineBoxTree(); | 152 toLayoutBlockFlow(containingBlock)->deleteLineBoxTree(); |
| 150 | 153 |
| 151 parent->addChildWithWritingModeOfParent(fullscreenLayoutObject, object); | 154 parent->addChildWithWritingModeOfParent(fullscreenLayoutObject, object); |
| 152 object->remove(); | 155 object->remove(); |
| 153 | 156 |
| 154 // Always just do a full layout to ensure that line boxes get deleted prop
erly. | 157 // Always just do a full layout to ensure that line boxes get deleted |
| 155 // Because objects moved from |parent| to |fullscreenLayoutObject|, we wan
t to | 158 // properly. |
| 156 // make new line boxes instead of leaving the old ones around. | 159 // Because objects moved from |parent| to |fullscreenLayoutObject|, we |
| 160 // want to make new line boxes instead of leaving the old ones around. |
| 157 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 161 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
| 158 LayoutInvalidationReason::Fullscreen); | 162 LayoutInvalidationReason::Fullscreen); |
| 159 containingBlock | 163 containingBlock |
| 160 ->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 164 ->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
| 161 LayoutInvalidationReason::Fullscreen); | 165 LayoutInvalidationReason::Fullscreen); |
| 162 } | 166 } |
| 163 fullscreenLayoutObject->addChild(object); | 167 fullscreenLayoutObject->addChild(object); |
| 164 fullscreenLayoutObject | 168 fullscreenLayoutObject |
| 165 ->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 169 ->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
| 166 LayoutInvalidationReason::Fullscreen); | 170 LayoutInvalidationReason::Fullscreen); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (parent()) { | 212 if (parent()) { |
| 209 parent()->addChildWithWritingModeOfParent(m_placeholder, this); | 213 parent()->addChildWithWritingModeOfParent(m_placeholder, this); |
| 210 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( | 214 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( |
| 211 LayoutInvalidationReason::Fullscreen); | 215 LayoutInvalidationReason::Fullscreen); |
| 212 } | 216 } |
| 213 } else { | 217 } else { |
| 214 m_placeholder->setStyle(std::move(style)); | 218 m_placeholder->setStyle(std::move(style)); |
| 215 m_placeholder->setStyleWithWritingModeOfParent(std::move(style)); | 219 m_placeholder->setStyleWithWritingModeOfParent(std::move(style)); |
| 216 } | 220 } |
| 217 } | 221 } |
| OLD | NEW |