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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // LayoutObjects are unretained, so notify the document (which holds a point
er to a LayoutFullScreen) | 86 // LayoutObjects are unretained, so notify the document (which holds a point
er to a LayoutFullScreen) |
87 // if its LayoutFullScreen is destroyed. | 87 // if its LayoutFullScreen is destroyed. |
88 Fullscreen& fullscreen = Fullscreen::from(document()); | 88 Fullscreen& fullscreen = Fullscreen::from(document()); |
89 if (fullscreen.fullScreenLayoutObject() == this) | 89 if (fullscreen.fullScreenLayoutObject() == this) |
90 fullscreen.fullScreenLayoutObjectDestroyed(); | 90 fullscreen.fullScreenLayoutObjectDestroyed(); |
91 | 91 |
92 LayoutFlexibleBox::willBeDestroyed(); | 92 LayoutFlexibleBox::willBeDestroyed(); |
93 } | 93 } |
94 | 94 |
95 void LayoutFullScreen::updateStyle() | 95 void LayoutFullScreen::updateStyle(LayoutObject* parent) |
96 { | 96 { |
97 RefPtr<ComputedStyle> fullscreenStyle = ComputedStyle::create(); | 97 RefPtr<ComputedStyle> fullscreenStyle = ComputedStyle::create(); |
98 | 98 |
99 // Create a stacking context: | 99 // Create a stacking context: |
100 fullscreenStyle->setZIndex(INT_MAX); | 100 fullscreenStyle->setZIndex(INT_MAX); |
101 fullscreenStyle->setIsStackingContext(true); | 101 fullscreenStyle->setIsStackingContext(true); |
102 | 102 |
103 fullscreenStyle->setFontDescription(FontDescription()); | 103 fullscreenStyle->setFontDescription(FontDescription()); |
104 fullscreenStyle->font().update(nullptr); | 104 fullscreenStyle->font().update(nullptr); |
105 | 105 |
106 fullscreenStyle->setDisplay(FLEX); | 106 fullscreenStyle->setDisplay(FLEX); |
107 fullscreenStyle->setJustifyContentPosition(ContentPositionCenter); | 107 fullscreenStyle->setJustifyContentPosition(ContentPositionCenter); |
108 fullscreenStyle->setAlignItemsPosition(ItemPositionCenter); | 108 fullscreenStyle->setAlignItemsPosition(ItemPositionCenter); |
109 fullscreenStyle->setFlexDirection(FlowColumn); | 109 fullscreenStyle->setFlexDirection(FlowColumn); |
110 | 110 |
111 fullscreenStyle->setPosition(FixedPosition); | 111 fullscreenStyle->setPosition(FixedPosition); |
112 fullscreenStyle->setLeft(Length(0, blink::Fixed)); | 112 fullscreenStyle->setLeft(Length(0, blink::Fixed)); |
113 fullscreenStyle->setTop(Length(0, blink::Fixed)); | 113 fullscreenStyle->setTop(Length(0, blink::Fixed)); |
114 IntSize viewportSize = document().page()->frameHost().visualViewport().size(
); | 114 IntSize viewportSize = document().page()->frameHost().visualViewport().size(
); |
115 fullscreenStyle->setWidth(Length(viewportSize.width(), blink::Fixed)); | 115 fullscreenStyle->setWidth(Length(viewportSize.width(), blink::Fixed)); |
116 fullscreenStyle->setHeight(Length(viewportSize.height(), blink::Fixed)); | 116 fullscreenStyle->setHeight(Length(viewportSize.height(), blink::Fixed)); |
117 | 117 |
118 fullscreenStyle->setBackgroundColor(StyleColor(Color::black)); | 118 fullscreenStyle->setBackgroundColor(StyleColor(Color::black)); |
119 | 119 |
120 setStyleWithWritingModeOfParent(fullscreenStyle); | 120 setStyleWithWritingModeOf(fullscreenStyle, parent); |
| 121 } |
| 122 |
| 123 void LayoutFullScreen::updateStyle() |
| 124 { |
| 125 updateStyle(parent()); |
121 } | 126 } |
122 | 127 |
123 LayoutObject* LayoutFullScreen::wrapLayoutObject(LayoutObject* object, LayoutObj
ect* parent, Document* document) | 128 LayoutObject* LayoutFullScreen::wrapLayoutObject(LayoutObject* object, LayoutObj
ect* parent, Document* document) |
124 { | 129 { |
125 // FIXME: We should not modify the structure of the layout tree during | 130 // FIXME: We should not modify the structure of the layout tree during |
126 // layout. crbug.com/370459 | 131 // layout. crbug.com/370459 |
127 DeprecatedDisableModifyLayoutTreeStructureAsserts disabler; | 132 DeprecatedDisableModifyLayoutTreeStructureAsserts disabler; |
128 | 133 |
129 LayoutFullScreen* fullscreenLayoutObject = LayoutFullScreen::createAnonymous
(document); | 134 LayoutFullScreen* fullscreenLayoutObject = LayoutFullScreen::createAnonymous
(document); |
130 fullscreenLayoutObject->updateStyle(); | 135 fullscreenLayoutObject->updateStyle(parent); |
131 if (parent && !parent->isChildAllowed(fullscreenLayoutObject, fullscreenLayo
utObject->styleRef())) { | 136 if (parent && !parent->isChildAllowed(fullscreenLayoutObject, fullscreenLayo
utObject->styleRef())) { |
132 fullscreenLayoutObject->destroy(); | 137 fullscreenLayoutObject->destroy(); |
133 return nullptr; | 138 return nullptr; |
134 } | 139 } |
135 if (object) { | 140 if (object) { |
136 // |object->parent()| can be null if the object is not yet attached | 141 // |object->parent()| can be null if the object is not yet attached |
137 // to |parent|. | 142 // to |parent|. |
138 if (LayoutObject* parent = object->parent()) { | 143 if (LayoutObject* parent = object->parent()) { |
139 LayoutBlock* containingBlock = object->containingBlock(); | 144 LayoutBlock* containingBlock = object->containingBlock(); |
140 DCHECK(containingBlock); | 145 DCHECK(containingBlock); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 m_placeholder->setStyleWithWritingModeOfParent(style); | 202 m_placeholder->setStyleWithWritingModeOfParent(style); |
198 if (parent()) { | 203 if (parent()) { |
199 parent()->addChildWithWritingModeOfParent(m_placeholder, this); | 204 parent()->addChildWithWritingModeOfParent(m_placeholder, this); |
200 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); | 205 parent()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
LayoutInvalidationReason::Fullscreen); |
201 } | 206 } |
202 } else { | 207 } else { |
203 m_placeholder->setStyle(style); | 208 m_placeholder->setStyle(style); |
204 m_placeholder->setStyleWithWritingModeOfParent(style); | 209 m_placeholder->setStyleWithWritingModeOfParent(style); |
205 } | 210 } |
206 } | 211 } |
OLD | NEW |