| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 | 215 |
| 216 void HTMLFrameOwnerElement::disposeWidgetSoon(Widget* widget) { | 216 void HTMLFrameOwnerElement::disposeWidgetSoon(Widget* widget) { |
| 217 if (s_updateSuspendCount) { | 217 if (s_updateSuspendCount) { |
| 218 widgetsPendingDispose().insert(widget); | 218 widgetsPendingDispose().insert(widget); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 widget->dispose(); | 221 widget->dispose(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void HTMLFrameOwnerElement::frameOwnerPropertiesChanged() { | |
| 225 // Don't notify about updates if contentFrame() is null, for example when | |
| 226 // the subframe hasn't been created yet. | |
| 227 if (contentFrame()) | |
| 228 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); | |
| 229 } | |
| 230 | |
| 231 void HTMLFrameOwnerElement::dispatchLoad() { | 224 void HTMLFrameOwnerElement::dispatchLoad() { |
| 232 dispatchScopedEvent(Event::create(EventTypeNames::load)); | 225 dispatchScopedEvent(Event::create(EventTypeNames::load)); |
| 233 } | 226 } |
| 234 | 227 |
| 235 const WebVector<mojom::blink::PermissionName>& | 228 const WebVector<mojom::blink::PermissionName>& |
| 236 HTMLFrameOwnerElement::delegatedPermissions() const { | 229 HTMLFrameOwnerElement::delegatedPermissions() const { |
| 237 DEFINE_STATIC_LOCAL(WebVector<mojom::blink::PermissionName>, permissions, ()); | 230 DEFINE_STATIC_LOCAL(WebVector<mojom::blink::PermissionName>, permissions, ()); |
| 238 return permissions; | 231 return permissions; |
| 239 } | 232 } |
| 240 | 233 |
| 241 Document* HTMLFrameOwnerElement::getSVGDocument( | 234 Document* HTMLFrameOwnerElement::getSVGDocument( |
| 242 ExceptionState& exceptionState) const { | 235 ExceptionState& exceptionState) const { |
| 243 Document* doc = contentDocument(); | 236 Document* doc = contentDocument(); |
| 244 if (doc && doc->isSVGDocument()) | 237 if (doc && doc->isSVGDocument()) |
| 245 return doc; | 238 return doc; |
| 246 return nullptr; | 239 return nullptr; |
| 247 } | 240 } |
| 248 | 241 |
| 249 void HTMLFrameOwnerElement::setWidget(Widget* widget) { | 242 void HTMLFrameOwnerElement::setWidget(Widget* widget) { |
| 250 if (widget == m_widget) | 243 if (widget == m_widget) |
| 251 return; | 244 return; |
| 252 | 245 |
| 253 Document* doc = contentDocument(); | |
| 254 if (doc && doc->frame()) { | |
| 255 bool willBeDisplayNone = !widget; | |
| 256 if (isDisplayNone() != willBeDisplayNone) { | |
| 257 doc->willChangeFrameOwnerProperties(marginWidth(), marginHeight(), | |
| 258 scrollingMode(), willBeDisplayNone); | |
| 259 } | |
| 260 } | |
| 261 | |
| 262 if (m_widget) { | 246 if (m_widget) { |
| 263 if (m_widget->parent()) | 247 if (m_widget->parent()) |
| 264 moveWidgetToParentSoon(m_widget.get(), 0); | 248 moveWidgetToParentSoon(m_widget.get(), 0); |
| 265 m_widget = nullptr; | 249 m_widget = nullptr; |
| 266 } | 250 } |
| 267 | 251 |
| 268 m_widget = widget; | 252 m_widget = widget; |
| 269 frameOwnerPropertiesChanged(); | |
| 270 | 253 |
| 271 LayoutPart* layoutPart = toLayoutPart(layoutObject()); | 254 LayoutPart* layoutPart = toLayoutPart(layoutObject()); |
| 272 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); | 255 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); |
| 273 if (layoutPartItem.isNull()) | 256 if (layoutPartItem.isNull()) |
| 274 return; | 257 return; |
| 275 | 258 |
| 276 if (m_widget) { | 259 if (m_widget) { |
| 277 layoutPartItem.updateOnWidgetChange(); | 260 layoutPartItem.updateOnWidgetChange(); |
| 278 | 261 |
| 279 DCHECK_EQ(document().view(), layoutPartItem.frameView()); | 262 DCHECK_EQ(document().view(), layoutPartItem.frameView()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 322 } |
| 340 | 323 |
| 341 DEFINE_TRACE(HTMLFrameOwnerElement) { | 324 DEFINE_TRACE(HTMLFrameOwnerElement) { |
| 342 visitor->trace(m_contentFrame); | 325 visitor->trace(m_contentFrame); |
| 343 visitor->trace(m_widget); | 326 visitor->trace(m_widget); |
| 344 HTMLElement::trace(visitor); | 327 HTMLElement::trace(visitor); |
| 345 FrameOwner::trace(visitor); | 328 FrameOwner::trace(visitor); |
| 346 } | 329 } |
| 347 | 330 |
| 348 } // namespace blink | 331 } // namespace blink |
| OLD | NEW |