Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2507023002: Support script modify iframe scrolling, marginWidth and marginHeight attr (Closed)
Patch Set: remove using namespace Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) { 135 } else if (name == srcAttr && !fastHasAttribute(srcdocAttr)) {
136 setLocation(stripLeadingAndTrailingHTMLSpaces(value)); 136 setLocation(stripLeadingAndTrailingHTMLSpaces(value));
137 } else if (name == idAttr) { 137 } else if (name == idAttr) {
138 // Important to call through to base for the id attribute so the hasID bit 138 // Important to call through to base for the id attribute so the hasID bit
139 // gets set. 139 // gets set.
140 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); 140 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value);
141 m_frameName = value; 141 m_frameName = value;
142 } else if (name == nameAttr) { 142 } else if (name == nameAttr) {
143 m_frameName = value; 143 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) { 144 } else if (name == marginwidthAttr) {
149 setMarginWidth(value.toInt()); 145 setMarginWidth(value.toInt());
150 // FIXME: If we are already attached, this has no effect.
151 } else if (name == marginheightAttr) { 146 } else if (name == marginheightAttr) {
152 setMarginHeight(value.toInt()); 147 setMarginHeight(value.toInt());
153 // FIXME: If we are already attached, this has no effect.
154 } else if (name == scrollingAttr) { 148 } else if (name == scrollingAttr) {
155 // Auto and yes both simply mean "allow scrolling." No means "don't allow 149 // Auto and yes both simply mean "allow scrolling." No means "don't allow
156 // scrolling." 150 // scrolling."
157 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes")) 151 if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes"))
158 setScrollingMode(ScrollbarAuto); 152 setScrollingMode(ScrollbarAuto);
159 else if (equalIgnoringCase(value, "no")) 153 else if (equalIgnoringCase(value, "no"))
160 setScrollingMode(ScrollbarAlwaysOff); 154 setScrollingMode(ScrollbarAlwaysOff);
161 // FIXME: If we are already attached, this has no effect.
162 } else if (name == onbeforeunloadAttr) { 155 } else if (name == onbeforeunloadAttr) {
163 // FIXME: should <frame> elements have beforeunload handlers? 156 // FIXME: should <frame> elements have beforeunload handlers?
164 setAttributeEventListener( 157 setAttributeEventListener(
165 EventTypeNames::beforeunload, 158 EventTypeNames::beforeunload,
166 createAttributeEventListener(this, name, value, eventParameterName())); 159 createAttributeEventListener(this, name, value, eventParameterName()));
167 } else { 160 } else {
168 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value); 161 HTMLFrameOwnerElement::parseAttribute(name, oldValue, value);
169 } 162 }
170 } 163 }
171 164
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // process. See http://crbug.com/339659. 239 // process. See http://crbug.com/339659.
247 void HTMLFrameElementBase::defaultEventHandler(Event* event) { 240 void HTMLFrameElementBase::defaultEventHandler(Event* event) {
248 if (contentFrame() && contentFrame()->isRemoteFrame()) { 241 if (contentFrame() && contentFrame()->isRemoteFrame()) {
249 toRemoteFrame(contentFrame())->forwardInputEvent(event); 242 toRemoteFrame(contentFrame())->forwardInputEvent(event);
250 return; 243 return;
251 } 244 }
252 HTMLFrameOwnerElement::defaultEventHandler(event); 245 HTMLFrameOwnerElement::defaultEventHandler(event);
253 } 246 }
254 247
255 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) { 248 void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) {
249 if (m_scrollingMode == scrollbarMode)
250 return;
251
252 if (contentDocument()) {
253 contentDocument()->willChangeFrameOwnerProperties(
254 m_marginWidth, m_marginHeight, scrollbarMode);
255 }
256 m_scrollingMode = scrollbarMode; 256 m_scrollingMode = scrollbarMode;
257 frameOwnerPropertiesChanged(); 257 frameOwnerPropertiesChanged();
258 } 258 }
259 259
260 void HTMLFrameElementBase::setMarginWidth(int marginWidth) { 260 void HTMLFrameElementBase::setMarginWidth(int marginWidth) {
261 if (m_marginWidth == marginWidth)
262 return;
263
264 if (contentDocument()) {
265 contentDocument()->willChangeFrameOwnerProperties(
266 marginWidth, m_marginHeight, m_scrollingMode);
267 }
261 m_marginWidth = marginWidth; 268 m_marginWidth = marginWidth;
262 frameOwnerPropertiesChanged(); 269 frameOwnerPropertiesChanged();
263 } 270 }
264 271
265 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { 272 void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
273 if (m_marginHeight == marginHeight)
274 return;
275
276 if (contentDocument()) {
277 contentDocument()->willChangeFrameOwnerProperties(
278 m_marginWidth, marginHeight, m_scrollingMode);
279 }
266 m_marginHeight = marginHeight; 280 m_marginHeight = marginHeight;
267 frameOwnerPropertiesChanged(); 281 frameOwnerPropertiesChanged();
268 } 282 }
269 283
270 } // namespace blink 284 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/web/WebFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698