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

Side by Side Diff: Source/core/html/HTMLBodyElement.cpp

Issue 1319863006: (blink) Propagate scrolling/marginwidth/marginheight property values to child frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments + static_cast for enum conversion Created 5 years, 3 months 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 | Annotate | Revision Log
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, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 152 {
153 HTMLElement::insertedInto(insertionPoint); 153 HTMLElement::insertedInto(insertionPoint);
154 return InsertionShouldCallDidNotifySubtreeInsertions; 154 return InsertionShouldCallDidNotifySubtreeInsertions;
155 } 155 }
156 156
157 void HTMLBodyElement::didNotifySubtreeInsertionsToDocument() 157 void HTMLBodyElement::didNotifySubtreeInsertionsToDocument()
158 { 158 {
159 // FIXME: It's surprising this is web compatible since it means a 159 // FIXME: It's surprising this is web compatible since it means a
160 // marginwidth and marginheight attribute can magically appear on the <body> 160 // marginwidth and marginheight attribute can magically appear on the <body>
161 // of all documents embedded through <iframe> or <frame>. 161 // of all documents embedded through <iframe> or <frame>.
162 int marginWidth = -1;
163 int marginHeight = -1;
164
162 HTMLFrameOwnerElement* ownerElement = document().ownerElement(); 165 HTMLFrameOwnerElement* ownerElement = document().ownerElement();
163 if (!isHTMLFrameElementBase(ownerElement)) 166 if (isHTMLFrameElementBase(ownerElement)) {
164 return; 167 HTMLFrameElementBase& ownerFrameElement = toHTMLFrameElementBase(*ownerE lement);
165 HTMLFrameElementBase& ownerFrameElement = toHTMLFrameElementBase(*ownerEleme nt); 168 marginWidth = ownerFrameElement.marginWidth();
166 int marginWidth = ownerFrameElement.marginWidth(); 169 marginHeight = ownerFrameElement.marginHeight();
167 int marginHeight = ownerFrameElement.marginHeight(); 170 } else if (!ownerElement && document().frame()->owner()) {
alexmos 2015/09/02 21:37:05 Same here, is it possible to use document().frame(
lazyboy 2015/09/15 01:40:32 Done.
171 // Our owner is a RemoteBridgeFrameOwner, not a FrameOwnerElement.
172 marginWidth = document().frame()->owner()->marginWidth();
173 marginHeight = document().frame()->owner()->marginHeight();
174 }
175
168 if (marginWidth != -1) 176 if (marginWidth != -1)
169 setIntegralAttribute(marginwidthAttr, marginWidth); 177 setIntegralAttribute(marginwidthAttr, marginWidth);
170 if (marginHeight != -1) 178 if (marginHeight != -1)
171 setIntegralAttribute(marginheightAttr, marginHeight); 179 setIntegralAttribute(marginheightAttr, marginHeight);
172 } 180 }
173 181
174 bool HTMLBodyElement::isURLAttribute(const Attribute& attribute) const 182 bool HTMLBodyElement::isURLAttribute(const Attribute& attribute) const
175 { 183 {
176 return attribute.name() == backgroundAttr || HTMLElement::isURLAttribute(att ribute); 184 return attribute.name() == backgroundAttr || HTMLElement::isURLAttribute(att ribute);
177 } 185 }
178 186
179 bool HTMLBodyElement::hasLegalLinkAttribute(const QualifiedName& name) const 187 bool HTMLBodyElement::hasLegalLinkAttribute(const QualifiedName& name) const
180 { 188 {
181 return name == backgroundAttr || HTMLElement::hasLegalLinkAttribute(name); 189 return name == backgroundAttr || HTMLElement::hasLegalLinkAttribute(name);
182 } 190 }
183 191
184 const QualifiedName& HTMLBodyElement::subResourceAttributeName() const 192 const QualifiedName& HTMLBodyElement::subResourceAttributeName() const
185 { 193 {
186 return backgroundAttr; 194 return backgroundAttr;
187 } 195 }
188 196
189 bool HTMLBodyElement::supportsFocus() const 197 bool HTMLBodyElement::supportsFocus() const
190 { 198 {
191 // This override is needed because the inherited method bails if the parent is editable. 199 // This override is needed because the inherited method bails if the parent is editable.
192 // The <body> should be focusable even if <html> is editable. 200 // The <body> should be focusable even if <html> is editable.
193 return hasEditableStyle() || HTMLElement::supportsFocus(); 201 return hasEditableStyle() || HTMLElement::supportsFocus();
194 } 202 }
195 203
196 } // namespace blink 204 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698