OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 #include "core/html/HTMLFrameElementBase.h" | 24 #include "core/html/HTMLFrameElementBase.h" |
25 | 25 |
26 #include "bindings/core/v8/BindingSecurity.h" | 26 #include "bindings/core/v8/BindingSecurity.h" |
27 #include "bindings/core/v8/ScriptController.h" | 27 #include "bindings/core/v8/ScriptController.h" |
28 #include "bindings/core/v8/ScriptEventListener.h" | 28 #include "bindings/core/v8/ScriptEventListener.h" |
29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
30 #include "core/dom/Attribute.h" | 30 #include "core/dom/Attribute.h" |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/StyleChangeReason.h" |
32 #include "core/frame/FrameView.h" | 33 #include "core/frame/FrameView.h" |
33 #include "core/frame/LocalFrame.h" | 34 #include "core/frame/LocalFrame.h" |
34 #include "core/frame/RemoteFrame.h" | 35 #include "core/frame/RemoteFrame.h" |
35 #include "core/frame/RemoteFrameView.h" | 36 #include "core/frame/RemoteFrameView.h" |
36 #include "core/frame/csp/ContentSecurityPolicy.h" | 37 #include "core/frame/csp/ContentSecurityPolicy.h" |
37 #include "core/html/parser/HTMLParserIdioms.h" | 38 #include "core/html/parser/HTMLParserIdioms.h" |
38 #include "core/loader/FrameLoader.h" | 39 #include "core/loader/FrameLoader.h" |
39 #include "core/loader/FrameLoaderClient.h" | 40 #include "core/loader/FrameLoaderClient.h" |
40 #include "core/page/FocusController.h" | 41 #include "core/page/FocusController.h" |
41 #include "core/page/Page.h" | 42 #include "core/page/Page.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return; | 117 return; |
117 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame()) | 118 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame()) |
118 return; | 119 return; |
119 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) | 120 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) |
120 return; | 121 return; |
121 toLocalFrame(contentFrame()) | 122 toLocalFrame(contentFrame()) |
122 ->script() | 123 ->script() |
123 .executeScriptIfJavaScriptURL(scriptURL, this); | 124 .executeScriptIfJavaScriptURL(scriptURL, this); |
124 } | 125 } |
125 | 126 |
126 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { | |
127 // Don't notify about updates if contentFrame() is null, for example when | |
128 // the subframe hasn't been created yet. | |
129 if (contentFrame()) | |
130 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); | |
131 } | |
132 | |
133 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, | 127 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, |
134 const AtomicString& oldValue, | 128 const AtomicString& oldValue, |
135 const AtomicString& value) { | 129 const AtomicString& value) { |
136 if (name == srcdocAttr) { | 130 if (name == srcdocAttr) { |
137 if (!value.isNull()) { | 131 if (!value.isNull()) { |
138 setLocation(srcdocURL().getString()); | 132 setLocation(srcdocURL().getString()); |
139 } else { | 133 } else { |
140 const AtomicString& srcValue = fastGetAttribute(srcAttr); | 134 const AtomicString& srcValue = fastGetAttribute(srcAttr); |
141 if (!srcValue.isNull()) | 135 if (!srcValue.isNull()) |
142 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); | 136 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // We should never have a content frame at the point where we got inserted | 186 // We should never have a content frame at the point where we got inserted |
193 // into a tree. | 187 // into a tree. |
194 SECURITY_CHECK(!contentFrame()); | 188 SECURITY_CHECK(!contentFrame()); |
195 | 189 |
196 setNameAndOpenURL(); | 190 setNameAndOpenURL(); |
197 } | 191 } |
198 | 192 |
199 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) { | 193 void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) { |
200 HTMLFrameOwnerElement::attachLayoutTree(context); | 194 HTMLFrameOwnerElement::attachLayoutTree(context); |
201 | 195 |
202 if (layoutPart()) { | 196 // TODO(esprehn): Why do we only call setWidget() if the frame is |
203 if (Frame* frame = contentFrame()) { | 197 // displayed? |
204 if (frame->isLocalFrame()) | 198 |
205 setWidget(toLocalFrame(frame)->view()); | 199 if (Frame* frame = contentFrame()) { |
206 else if (frame->isRemoteFrame()) | 200 if (frame->isLocalFrame()) { |
| 201 LocalFrame* localFrame = toLocalFrame(frame); |
| 202 if (layoutPart()) |
| 203 setWidget(localFrame->view()); |
| 204 if (Element* documentElement = |
| 205 localFrame->document()->documentElement()) { |
| 206 if (static_cast<bool>(layoutPart()) != |
| 207 static_cast<bool>(documentElement->layoutObject())) { |
| 208 documentElement->lazyReattachIfAttached(); |
| 209 } |
| 210 } |
| 211 } else { |
| 212 if (layoutPart()) |
207 setWidget(toRemoteFrame(frame)->view()); | 213 setWidget(toRemoteFrame(frame)->view()); |
208 } | 214 } |
209 } | 215 } |
210 } | 216 } |
211 | 217 |
212 void HTMLFrameElementBase::setLocation(const String& str) { | 218 void HTMLFrameElementBase::setLocation(const String& str) { |
213 m_URL = AtomicString(str); | 219 m_URL = AtomicString(str); |
214 | 220 |
215 if (isConnected()) | 221 if (isConnected()) |
216 openURL(false); | 222 openURL(false); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 263 } |
258 HTMLFrameOwnerElement::defaultEventHandler(event); | 264 HTMLFrameOwnerElement::defaultEventHandler(event); |
259 } | 265 } |
260 | 266 |
261 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { | 267 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { |
262 if (m_scrollingMode == scrollbarMode) | 268 if (m_scrollingMode == scrollbarMode) |
263 return; | 269 return; |
264 | 270 |
265 if (contentDocument()) { | 271 if (contentDocument()) { |
266 contentDocument()->willChangeFrameOwnerProperties( | 272 contentDocument()->willChangeFrameOwnerProperties( |
267 m_marginWidth, m_marginHeight, scrollbarMode); | 273 m_marginWidth, m_marginHeight, scrollbarMode, isDisplayNone()); |
268 } | 274 } |
269 m_scrollingMode = scrollbarMode; | 275 m_scrollingMode = scrollbarMode; |
270 frameOwnerPropertiesChanged(); | 276 frameOwnerPropertiesChanged(); |
271 } | 277 } |
272 | 278 |
273 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { | 279 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { |
274 if (m_marginWidth == marginWidth) | 280 if (m_marginWidth == marginWidth) |
275 return; | 281 return; |
276 | 282 |
277 if (contentDocument()) { | 283 if (contentDocument()) { |
278 contentDocument()->willChangeFrameOwnerProperties( | 284 contentDocument()->willChangeFrameOwnerProperties( |
279 marginWidth, m_marginHeight, m_scrollingMode); | 285 marginWidth, m_marginHeight, m_scrollingMode, isDisplayNone()); |
280 } | 286 } |
281 m_marginWidth = marginWidth; | 287 m_marginWidth = marginWidth; |
282 frameOwnerPropertiesChanged(); | 288 frameOwnerPropertiesChanged(); |
283 } | 289 } |
284 | 290 |
285 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { | 291 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { |
286 if (m_marginHeight == marginHeight) | 292 if (m_marginHeight == marginHeight) |
287 return; | 293 return; |
288 | 294 |
289 if (contentDocument()) { | 295 if (contentDocument()) { |
290 contentDocument()->willChangeFrameOwnerProperties( | 296 contentDocument()->willChangeFrameOwnerProperties( |
291 m_marginWidth, marginHeight, m_scrollingMode); | 297 m_marginWidth, marginHeight, m_scrollingMode, isDisplayNone()); |
292 } | 298 } |
293 m_marginHeight = marginHeight; | 299 m_marginHeight = marginHeight; |
294 frameOwnerPropertiesChanged(); | 300 frameOwnerPropertiesChanged(); |
295 } | 301 } |
296 | 302 |
297 } // namespace blink | 303 } // namespace blink |
OLD | NEW |