Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 33 #include "core/frame/RemoteFrame.h" | 33 #include "core/frame/RemoteFrame.h" |
| 34 #include "core/frame/RemoteFrameView.h" | 34 #include "core/frame/RemoteFrameView.h" |
| 35 #include "core/frame/csp/ContentSecurityPolicy.h" | 35 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 36 #include "core/html/parser/HTMLParserIdioms.h" | 36 #include "core/html/parser/HTMLParserIdioms.h" |
| 37 #include "core/loader/FrameLoader.h" | 37 #include "core/loader/FrameLoader.h" |
| 38 #include "core/loader/FrameLoaderClient.h" | 38 #include "core/loader/FrameLoaderClient.h" |
| 39 #include "core/page/FocusController.h" | 39 #include "core/page/FocusController.h" |
| 40 #include "core/page/Page.h" | 40 #include "core/page/Page.h" |
| 41 #include "wtf/Optional.h" | |
|
bokan
2016/11/21 16:11:36
Remove.
| |
| 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, | 47 HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, |
| 47 Document& document) | 48 Document& document) |
| 48 : HTMLFrameOwnerElement(tagName, document), | 49 : HTMLFrameOwnerElement(tagName, document), |
| 49 m_scrollingMode(ScrollbarAuto), | 50 m_scrollingMode(ScrollbarAuto), |
| 50 m_marginWidth(-1), | 51 m_marginWidth(-1), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) | 111 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) |
| 111 return; | 112 return; |
| 112 toLocalFrame(contentFrame()) | 113 toLocalFrame(contentFrame()) |
| 113 ->script() | 114 ->script() |
| 114 .executeScriptIfJavaScriptURL(scriptURL, this); | 115 .executeScriptIfJavaScriptURL(scriptURL, this); |
| 115 } | 116 } |
| 116 | 117 |
| 117 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { | 118 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { |
| 118 // Don't notify about updates if contentFrame() is null, for example when | 119 // Don't notify about updates if contentFrame() is null, for example when |
| 119 // the subframe hasn't been created yet. | 120 // the subframe hasn't been created yet. |
| 120 if (contentFrame()) | 121 if (contentFrame()) { |
|
bokan
2016/11/21 16:11:36
Nit: no braces.
| |
| 121 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); | 122 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); |
| 123 } | |
| 122 } | 124 } |
| 123 | 125 |
| 124 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, | 126 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, |
| 125 const AtomicString& oldValue, | 127 const AtomicString& oldValue, |
| 126 const AtomicString& value) { | 128 const AtomicString& value) { |
| 127 if (name == srcdocAttr) { | 129 if (name == srcdocAttr) { |
| 128 if (!value.isNull()) { | 130 if (!value.isNull()) { |
| 129 setLocation(srcdocURL().getString()); | 131 setLocation(srcdocURL().getString()); |
| 130 } else { | 132 } else { |
| 131 const AtomicString& srcValue = fastGetAttribute(srcAttr); | 133 const AtomicString& srcValue = fastGetAttribute(srcAttr); |
| 132 if (!srcValue.isNull()) | 134 if (!srcValue.isNull()) |
| 133 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); | 135 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); |
| 134 } | 136 } |
| 135 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { | 137 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { |
| 136 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); | 138 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); |
| 137 } else if (name == idAttr) { | 139 } else if (name == idAttr) { |
| 138 // Important to call through to base for the id attribute so the hasID bit | 140 // Important to call through to base for the id attribute so the hasID bit |
| 139 // gets set. | 141 // gets set. |
| 140 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); | 142 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); |
| 141 m_frameName = value; | 143 m_frameName = value; |
| 142 } else if (name == nameAttr) { | 144 } else if (name == nameAttr) { |
| 143 m_frameName = value; | 145 m_frameName = value; |
| 144 // FIXME: If we are already attached, this doesn't actually change the | |
| 145 // frame's name. | |
| 146 // FIXME: If we are already attached, this doesn't check for frame name | |
| 147 // conflicts and generate a unique frame name. | |
| 148 } else if (name == marginwidthAttr) { | 146 } else if (name == marginwidthAttr) { |
| 149 setMarginWidth(value.toInt()); | 147 setMarginWidth(value.toInt()); |
| 150 // FIXME: If we are already attached, this has no effect. | |
| 151 } else if (name == marginheightAttr) { | 148 } else if (name == marginheightAttr) { |
| 152 setMarginHeight(value.toInt()); | 149 setMarginHeight(value.toInt()); |
| 153 // FIXME: If we are already attached, this has no effect. | |
| 154 } else if (name == scrollingAttr) { | 150 } else if (name == scrollingAttr) { |
| 155 // Auto and yes both simply mean "allow scrolling." No means "don't allow | 151 // Auto and yes both simply mean "allow scrolling." No means "don't allow |
| 156 // scrolling." | 152 // scrolling." |
| 157 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) | 153 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) |
| 158 setScrollingMode(ScrollbarAuto); | 154 setScrollingMode(ScrollbarAuto); |
| 159 else if (equalIgnoringCase(value, "no")) | 155 else if (equalIgnoringCase(value, "no")) |
| 160 setScrollingMode(ScrollbarAlwaysOff); | 156 setScrollingMode(ScrollbarAlwaysOff); |
| 161 // FIXME: If we are already attached, this has no effect. | |
| 162 } else if (name == onbeforeunloadAttr) { | 157 } else if (name == onbeforeunloadAttr) { |
| 163 // FIXME: should <frame> elements have beforeunload handlers? | 158 // FIXME: should <frame> elements have beforeunload handlers? |
| 164 setAttributeEventListener( | 159 setAttributeEventListener( |
| 165 EventTypeNames::beforeunload, | 160 EventTypeNames::beforeunload, |
| 166 createAttributeEventListener(this, name, value, eventParameterName())); | 161 createAttributeEventListener(this, name, value, eventParameterName())); |
| 167 } else { | 162 } else { |
| 168 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); | 163 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); |
| 169 } | 164 } |
| 170 } | 165 } |
| 171 | 166 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 // process. See http://crbug.com/339659. | 241 // process. See http://crbug.com/339659. |
| 247 void HTMLFrameElementBase::defaultEventHandler(Event* event) { | 242 void HTMLFrameElementBase::defaultEventHandler(Event* event) { |
| 248 if (contentFrame() && contentFrame()->isRemoteFrame()) { | 243 if (contentFrame() && contentFrame()->isRemoteFrame()) { |
| 249 toRemoteFrame(contentFrame())->forwardInputEvent(event); | 244 toRemoteFrame(contentFrame())->forwardInputEvent(event); |
| 250 return; | 245 return; |
| 251 } | 246 } |
| 252 HTMLFrameOwnerElement::defaultEventHandler(event); | 247 HTMLFrameOwnerElement::defaultEventHandler(event); |
| 253 } | 248 } |
| 254 | 249 |
| 255 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { | 250 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { |
| 251 if (m_scrollingMode == scrollbarMode) | |
| 252 return; | |
| 253 | |
| 254 if (contentDocument()) { | |
| 255 contentDocument()->didChangeFrameOwnerProperties( | |
| 256 m_marginWidth, m_marginHeight, scrollbarMode); | |
| 257 } | |
| 256 m_scrollingMode = scrollbarMode; | 258 m_scrollingMode = scrollbarMode; |
| 257 frameOwnerPropertiesChanged(); | 259 frameOwnerPropertiesChanged(); |
| 258 } | 260 } |
| 259 | 261 |
| 260 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { | 262 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { |
| 263 if (m_marginWidth == marginWidth) | |
| 264 return; | |
| 265 | |
| 266 if (contentDocument()) { | |
| 267 contentDocument()->didChangeFrameOwnerProperties( | |
| 268 marginWidth, m_marginHeight, m_scrollingMode); | |
| 269 } | |
| 261 m_marginWidth = marginWidth; | 270 m_marginWidth = marginWidth; |
| 262 frameOwnerPropertiesChanged(); | 271 frameOwnerPropertiesChanged(); |
| 263 } | 272 } |
| 264 | 273 |
| 265 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { | 274 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { |
| 275 if (m_marginHeight == marginHeight) | |
| 276 return; | |
| 277 | |
| 278 if (contentDocument()) { | |
| 279 contentDocument()->didChangeFrameOwnerProperties( | |
| 280 m_marginWidth, marginHeight, m_scrollingMode); | |
| 281 } | |
| 266 m_marginHeight = marginHeight; | 282 m_marginHeight = marginHeight; |
| 267 frameOwnerPropertiesChanged(); | 283 frameOwnerPropertiesChanged(); |
| 268 } | 284 } |
| 269 | 285 |
| 270 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |