| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 void HTMLFrameOwnerElement::disposeWidgetSoon(FrameViewBase* frameViewBase) { | 218 void HTMLFrameOwnerElement::disposeWidgetSoon(FrameViewBase* frameViewBase) { |
| 219 if (s_updateSuspendCount) { | 219 if (s_updateSuspendCount) { |
| 220 widgetsPendingDispose().insert(frameViewBase); | 220 widgetsPendingDispose().insert(frameViewBase); |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 frameViewBase->dispose(); | 223 frameViewBase->dispose(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void HTMLFrameOwnerElement::frameOwnerPropertiesChanged() { |
| 227 // Don't notify about updates if contentFrame() is null, for example when |
| 228 // the subframe hasn't been created yet. |
| 229 if (contentFrame()) |
| 230 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); |
| 231 } |
| 232 |
| 226 void HTMLFrameOwnerElement::dispatchLoad() { | 233 void HTMLFrameOwnerElement::dispatchLoad() { |
| 227 dispatchScopedEvent(Event::create(EventTypeNames::load)); | 234 dispatchScopedEvent(Event::create(EventTypeNames::load)); |
| 228 } | 235 } |
| 229 | 236 |
| 230 const WebVector<WebFeaturePolicyFeature>& | 237 const WebVector<WebFeaturePolicyFeature>& |
| 231 HTMLFrameOwnerElement::allowedFeatures() const { | 238 HTMLFrameOwnerElement::allowedFeatures() const { |
| 232 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ()); | 239 DEFINE_STATIC_LOCAL(WebVector<WebFeaturePolicyFeature>, features, ()); |
| 233 return features; | 240 return features; |
| 234 } | 241 } |
| 235 | 242 |
| 236 Document* HTMLFrameOwnerElement::getSVGDocument( | 243 Document* HTMLFrameOwnerElement::getSVGDocument( |
| 237 ExceptionState& exceptionState) const { | 244 ExceptionState& exceptionState) const { |
| 238 Document* doc = contentDocument(); | 245 Document* doc = contentDocument(); |
| 239 if (doc && doc->isSVGDocument()) | 246 if (doc && doc->isSVGDocument()) |
| 240 return doc; | 247 return doc; |
| 241 return nullptr; | 248 return nullptr; |
| 242 } | 249 } |
| 243 | 250 |
| 244 void HTMLFrameOwnerElement::setWidget(FrameViewBase* frameViewBase) { | 251 void HTMLFrameOwnerElement::setWidget(FrameViewBase* frameViewBase) { |
| 245 if (frameViewBase == m_widget) | 252 if (frameViewBase == m_widget) |
| 246 return; | 253 return; |
| 247 | 254 |
| 255 Document* doc = contentDocument(); |
| 256 if (doc && doc->frame()) { |
| 257 bool willBeDisplayNone = !frameViewBase; |
| 258 if (isDisplayNone() != willBeDisplayNone) { |
| 259 doc->willChangeFrameOwnerProperties(marginWidth(), marginHeight(), |
| 260 scrollingMode(), willBeDisplayNone); |
| 261 } |
| 262 } |
| 263 |
| 248 if (m_widget) { | 264 if (m_widget) { |
| 249 if (m_widget->parent()) | 265 if (m_widget->parent()) |
| 250 moveWidgetToParentSoon(m_widget.get(), 0); | 266 moveWidgetToParentSoon(m_widget.get(), 0); |
| 251 m_widget = nullptr; | 267 m_widget = nullptr; |
| 252 } | 268 } |
| 253 | 269 |
| 254 m_widget = frameViewBase; | 270 m_widget = frameViewBase; |
| 271 frameOwnerPropertiesChanged(); |
| 255 | 272 |
| 256 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 273 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 257 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); | 274 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); |
| 258 if (layoutPartItem.isNull()) | 275 if (layoutPartItem.isNull()) |
| 259 return; | 276 return; |
| 260 | 277 |
| 261 if (m_widget) { | 278 if (m_widget) { |
| 262 layoutPartItem.updateOnWidgetChange(); | 279 layoutPartItem.updateOnWidgetChange(); |
| 263 | 280 |
| 264 DCHECK_EQ(document().view(), layoutPartItem.frameView()); | 281 DCHECK_EQ(document().view(), layoutPartItem.frameView()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 340 } |
| 324 | 341 |
| 325 DEFINE_TRACE(HTMLFrameOwnerElement) { | 342 DEFINE_TRACE(HTMLFrameOwnerElement) { |
| 326 visitor->trace(m_contentFrame); | 343 visitor->trace(m_contentFrame); |
| 327 visitor->trace(m_widget); | 344 visitor->trace(m_widget); |
| 328 HTMLElement::trace(visitor); | 345 HTMLElement::trace(visitor); |
| 329 FrameOwner::trace(visitor); | 346 FrameOwner::trace(visitor); |
| 330 } | 347 } |
| 331 | 348 |
| 332 } // namespace blink | 349 } // namespace blink |
| OLD | NEW |