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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) | 110 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) |
| 111 return; | 111 return; |
| 112 toLocalFrame(contentFrame()) | 112 toLocalFrame(contentFrame()) |
| 113 ->script() | 113 ->script() |
| 114 .executeScriptIfJavaScriptURL(scriptURL, this); | 114 .executeScriptIfJavaScriptURL(scriptURL, this); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { | 117 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { |
| 118 // Don't notify about updates if contentFrame() is null, for example when | 118 // Don't notify about updates if contentFrame() is null, for example when |
| 119 // the subframe hasn't been created yet. | 119 // the subframe hasn't been created yet. |
| 120 if (contentFrame()) | 120 if (contentFrame()) { |
| 121 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); | 121 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); |
| 122 if (contentFrame()->isLocalFrame()) { | |
| 123 contentDocument()->body()->setIntegralAttribute(marginwidthAttr, | |
|
bokan
2016/11/18 20:56:18
These should be done inside setMarginWidth/setMarg
| |
| 124 m_marginWidth); | |
| 125 contentDocument()->body()->setIntegralAttribute(marginheightAttr, | |
| 126 m_marginHeight); | |
| 127 toLocalFrame(contentFrame())->view()->setNeedsLayout(); | |
| 128 } | |
| 129 } | |
| 122 } | 130 } |
| 123 | 131 |
| 124 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, | 132 void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, |
| 125 const AtomicString& oldValue, | 133 const AtomicString& oldValue, |
| 126 const AtomicString& value) { | 134 const AtomicString& value) { |
| 127 if (name == srcdocAttr) { | 135 if (name == srcdocAttr) { |
| 128 if (!value.isNull()) { | 136 if (!value.isNull()) { |
| 129 setLocation(srcdocURL().getString()); | 137 setLocation(srcdocURL().getString()); |
| 130 } else { | 138 } else { |
| 131 const AtomicString& srcValue = fastGetAttribute(srcAttr); | 139 const AtomicString& srcValue = fastGetAttribute(srcAttr); |
| 132 if (!srcValue.isNull()) | 140 if (!srcValue.isNull()) |
| 133 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); | 141 setLocation(stripLeadingAndTrailingHTMLSpaces(srcValue)); |
| 134 } | 142 } |
| 135 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { | 143 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { |
| 136 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); | 144 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); |
| 137 } else if (name == idAttr) { | 145 } else if (name == idAttr) { |
| 138 // Important to call through to base for the id attribute so the hasID bit | 146 // Important to call through to base for the id attribute so the hasID bit |
| 139 // gets set. | 147 // gets set. |
| 140 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); | 148 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); |
| 141 m_frameName = value; | 149 m_frameName = value; |
| 142 } else if (name == nameAttr) { | 150 } else if (name == nameAttr) { |
| 143 m_frameName = value; | 151 m_frameName = value; |
| 144 // FIXME: If we are already attached, this doesn't actually change the | 152 // FIXME: If we are already attached, this doesn't actually change the |
| 145 // frame's name. | 153 // frame's name. |
| 146 // FIXME: If we are already attached, this doesn't check for frame name | 154 // FIXME: If we are already attached, this doesn't check for frame name |
| 147 // conflicts and generate a unique frame name. | 155 // conflicts and generate a unique frame name. |
| 148 } else if (name == marginwidthAttr) { | 156 } else if (name == marginwidthAttr) { |
| 149 setMarginWidth(value.toInt()); | 157 setMarginWidth(value.toInt()); |
| 150 // FIXME: If we are already attached, this has no effect. | |
| 151 } else if (name == marginheightAttr) { | 158 } else if (name == marginheightAttr) { |
| 152 setMarginHeight(value.toInt()); | 159 setMarginHeight(value.toInt()); |
| 153 // FIXME: If we are already attached, this has no effect. | |
| 154 } else if (name == scrollingAttr) { | 160 } else if (name == scrollingAttr) { |
| 155 // Auto and yes both simply mean "allow scrolling." No means "don't allow | 161 // Auto and yes both simply mean "allow scrolling." No means "don't allow |
| 156 // scrolling." | 162 // scrolling." |
| 157 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) | 163 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) |
| 158 setScrollingMode(ScrollbarAuto); | 164 setScrollingMode(ScrollbarAuto); |
| 159 else if (equalIgnoringCase(value, "no")) | 165 else if (equalIgnoringCase(value, "no")) |
| 160 setScrollingMode(ScrollbarAlwaysOff); | 166 setScrollingMode(ScrollbarAlwaysOff); |
| 161 // FIXME: If we are already attached, this has no effect. | |
|
bokan
2016/11/18 20:56:18
What did these FIXMEs mean?
chaopeng
2016/11/18 21:25:03
I think it means these 3 attributes doesnot suppor
bokan
2016/11/18 21:37:03
Hmm, I think it was to mean that calling this func
| |
| 162 } else if (name == onbeforeunloadAttr) { | 167 } else if (name == onbeforeunloadAttr) { |
| 163 // FIXME: should <frame> elements have beforeunload handlers? | 168 // FIXME: should <frame> elements have beforeunload handlers? |
| 164 setAttributeEventListener( | 169 setAttributeEventListener( |
| 165 EventTypeNames::beforeunload, | 170 EventTypeNames::beforeunload, |
| 166 createAttributeEventListener(this, name, value, eventParameterName())); | 171 createAttributeEventListener(this, name, value, eventParameterName())); |
| 167 } else { | 172 } else { |
| 168 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); | 173 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); |
| 169 } | 174 } |
| 170 } | 175 } |
| 171 | 176 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 // process. See http://crbug.com/339659. | 251 // process. See http://crbug.com/339659. |
| 247 void HTMLFrameElementBase::defaultEventHandler(Event* event) { | 252 void HTMLFrameElementBase::defaultEventHandler(Event* event) { |
| 248 if (contentFrame() && contentFrame()->isRemoteFrame()) { | 253 if (contentFrame() && contentFrame()->isRemoteFrame()) { |
| 249 toRemoteFrame(contentFrame())->forwardInputEvent(event); | 254 toRemoteFrame(contentFrame())->forwardInputEvent(event); |
| 250 return; | 255 return; |
| 251 } | 256 } |
| 252 HTMLFrameOwnerElement::defaultEventHandler(event); | 257 HTMLFrameOwnerElement::defaultEventHandler(event); |
| 253 } | 258 } |
| 254 | 259 |
| 255 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { | 260 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { |
| 261 if (m_scrollingMode == scrollbarMode) | |
| 262 return; | |
| 263 | |
| 256 m_scrollingMode = scrollbarMode; | 264 m_scrollingMode = scrollbarMode; |
| 257 frameOwnerPropertiesChanged(); | 265 frameOwnerPropertiesChanged(); |
| 258 } | 266 } |
| 259 | 267 |
| 260 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { | 268 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { |
| 269 if (m_marginWidth == marginWidth) | |
| 270 return; | |
| 271 | |
| 261 m_marginWidth = marginWidth; | 272 m_marginWidth = marginWidth; |
| 262 frameOwnerPropertiesChanged(); | 273 frameOwnerPropertiesChanged(); |
| 263 } | 274 } |
| 264 | 275 |
| 265 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { | 276 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { |
| 277 if (m_marginHeight == marginHeight) | |
| 278 return; | |
| 279 | |
| 266 m_marginHeight = marginHeight; | 280 m_marginHeight = marginHeight; |
| 267 frameOwnerPropertiesChanged(); | 281 frameOwnerPropertiesChanged(); |
| 268 } | 282 } |
| 269 | 283 |
| 270 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |