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 18 matching lines...) Expand all Loading... |
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/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
33 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
34 #include "core/frame/RemoteFrame.h" | 34 #include "core/frame/RemoteFrame.h" |
35 #include "core/frame/RemoteFrameView.h" | 35 #include "core/frame/RemoteFrameView.h" |
36 #include "core/html/parser/HTMLParserIdioms.h" | 36 #include "core/html/parser/HTMLParserIdioms.h" |
37 #include "core/layout/LayoutPart.h" | 37 #include "core/layout/LayoutPart.h" |
38 #include "core/loader/FrameLoader.h" | 38 #include "core/loader/FrameLoader.h" |
| 39 #include "core/loader/FrameLoaderClient.h" |
39 #include "core/page/FocusController.h" | 40 #include "core/page/FocusController.h" |
40 #include "core/page/Page.h" | 41 #include "core/page/Page.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 using namespace HTMLNames; | 45 using namespace HTMLNames; |
45 | 46 |
46 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen
t& document) | 47 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen
t& document) |
47 : HTMLFrameOwnerElement(tagName, document) | 48 : HTMLFrameOwnerElement(tagName, document) |
48 , m_scrolling(ScrollbarAuto) | 49 , m_scrollingMode(ScrollbarAuto) |
49 , m_marginWidth(-1) | 50 , m_marginWidth(-1) |
50 , m_marginHeight(-1) | 51 , m_marginHeight(-1) |
51 { | 52 { |
52 } | 53 } |
53 | 54 |
54 bool HTMLFrameElementBase::isURLAllowed() const | 55 bool HTMLFrameElementBase::isURLAllowed() const |
55 { | 56 { |
56 if (m_URL.isEmpty()) | 57 if (m_URL.isEmpty()) |
57 return true; | 58 return true; |
58 | 59 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 url = blankURL(); | 92 url = blankURL(); |
92 } | 93 } |
93 | 94 |
94 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem)) | 95 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem)) |
95 return; | 96 return; |
96 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame(
)) | 97 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame(
)) |
97 return; | 98 return; |
98 toLocalFrame(contentFrame())->script().executeScriptIfJavaScriptURL(scriptUR
L); | 99 toLocalFrame(contentFrame())->script().executeScriptIfJavaScriptURL(scriptUR
L); |
99 } | 100 } |
100 | 101 |
| 102 void HTMLFrameElementBase::frameOwnerPropertiesChanged() |
| 103 { |
| 104 // Don't notify about updates if contentFrame() is null, for example when |
| 105 // the subframe hasn't been created yet. |
| 106 if (contentFrame()) |
| 107 document().frame()->loader().client()->didChangeFrameOwnerProperties(thi
s); |
| 108 } |
| 109 |
101 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const Atomi
cString& value) | 110 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const Atomi
cString& value) |
102 { | 111 { |
103 if (name == srcdocAttr) { | 112 if (name == srcdocAttr) { |
104 if (!value.isNull()) { | 113 if (!value.isNull()) { |
105 setLocation("about:srcdoc"); | 114 setLocation("about:srcdoc"); |
106 } else { | 115 } else { |
107 const AtomicString& srcValue = fastGetAttribute(srcAttr); | 116 const AtomicString& srcValue = fastGetAttribute(srcAttr); |
108 if (!srcValue.isNull()) | 117 if (!srcValue.isNull()) |
109 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); | 118 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); |
110 } | 119 } |
111 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { | 120 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { |
112 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); | 121 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); |
113 } else if (name == idAttr) { | 122 } else if (name == idAttr) { |
114 // Important to call through to base for the id attribute so the hasID b
it gets set. | 123 // Important to call through to base for the id attribute so the hasID b
it gets set. |
115 HTMLFrameOwnerElement::parseAttribute(name, value); | 124 HTMLFrameOwnerElement::parseAttribute(name, value); |
116 m_frameName = value; | 125 m_frameName = value; |
117 } else if (name == nameAttr) { | 126 } else if (name == nameAttr) { |
118 m_frameName = value; | 127 m_frameName = value; |
119 // FIXME: If we are already attached, this doesn't actually change the f
rame's name. | 128 // FIXME: If we are already attached, this doesn't actually change the f
rame's name. |
120 // FIXME: If we are already attached, this doesn't check for frame name | 129 // FIXME: If we are already attached, this doesn't check for frame name |
121 // conflicts and generate a unique frame name. | 130 // conflicts and generate a unique frame name. |
122 } else if (name == marginwidthAttr) { | 131 } else if (name == marginwidthAttr) { |
123 m_marginWidth = value.toInt(); | 132 setMarginWidth(value.toInt()); |
124 // FIXME: If we are already attached, this has no effect. | 133 // FIXME: If we are already attached, this has no effect. |
125 } else if (name == marginheightAttr) { | 134 } else if (name == marginheightAttr) { |
126 m_marginHeight = value.toInt(); | 135 setMarginHeight(value.toInt()); |
127 // FIXME: If we are already attached, this has no effect. | 136 // FIXME: If we are already attached, this has no effect. |
128 } else if (name == scrollingAttr) { | 137 } else if (name == scrollingAttr) { |
129 // Auto and yes both simply mean "allow scrolling." No means "don't allo
w scrolling." | 138 // Auto and yes both simply mean "allow scrolling." No means "don't allo
w scrolling." |
130 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) | 139 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) |
131 m_scrolling = ScrollbarAuto; | 140 setScrollingMode(ScrollbarAuto); |
132 else if (equalIgnoringCase(value, "no")) | 141 else if (equalIgnoringCase(value, "no")) |
133 m_scrolling = ScrollbarAlwaysOff; | 142 setScrollingMode(ScrollbarAlwaysOff); |
134 // FIXME: If we are already attached, this has no effect. | 143 // FIXME: If we are already attached, this has no effect. |
135 } else if (name == onbeforeunloadAttr) { | 144 } else if (name == onbeforeunloadAttr) { |
136 // FIXME: should <frame> elements have beforeunload handlers? | 145 // FIXME: should <frame> elements have beforeunload handlers? |
137 setAttributeEventListener(EventTypeNames::beforeunload, createAttributeE
ventListener(this, name, value, eventParameterName())); | 146 setAttributeEventListener(EventTypeNames::beforeunload, createAttributeE
ventListener(this, name, value, eventParameterName())); |
138 } else { | 147 } else { |
139 HTMLFrameOwnerElement::parseAttribute(name, value); | 148 HTMLFrameOwnerElement::parseAttribute(name, value); |
140 } | 149 } |
141 } | 150 } |
142 | 151 |
143 void HTMLFrameElementBase::setNameAndOpenURL() | 152 void HTMLFrameElementBase::setNameAndOpenURL() |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // process. See http://crbug.com/339659. | 230 // process. See http://crbug.com/339659. |
222 void HTMLFrameElementBase::defaultEventHandler(Event* event) | 231 void HTMLFrameElementBase::defaultEventHandler(Event* event) |
223 { | 232 { |
224 if (contentFrame() && contentFrame()->isRemoteFrame()) { | 233 if (contentFrame() && contentFrame()->isRemoteFrame()) { |
225 toRemoteFrame(contentFrame())->forwardInputEvent(event); | 234 toRemoteFrame(contentFrame())->forwardInputEvent(event); |
226 return; | 235 return; |
227 } | 236 } |
228 HTMLFrameOwnerElement::defaultEventHandler(event); | 237 HTMLFrameOwnerElement::defaultEventHandler(event); |
229 } | 238 } |
230 | 239 |
| 240 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) |
| 241 { |
| 242 m_scrollingMode = scrollbarMode; |
| 243 frameOwnerPropertiesChanged(); |
| 244 } |
| 245 |
| 246 void HTMLFrameElementBase::setMarginWidth(int marginWidth) |
| 247 { |
| 248 m_marginWidth = marginWidth; |
| 249 frameOwnerPropertiesChanged(); |
| 250 } |
| 251 |
| 252 void HTMLFrameElementBase::setMarginHeight(int marginHeight) |
| 253 { |
| 254 m_marginHeight = marginHeight; |
| 255 frameOwnerPropertiesChanged(); |
| 256 } |
| 257 |
231 } // namespace blink | 258 } // namespace blink |
OLD | NEW |