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

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

Issue 7169001: Merge 88601 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 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
« no previous file with comments | « Source/WebCore/html/HTMLBodyElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } else if (attr->name() == bgcolorAttr) { 109 } else if (attr->name() == bgcolorAttr) {
110 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); 110 addCSSColor(attr, CSSPropertyBackgroundColor, attr->value());
111 } else if (attr->name() == textAttr) { 111 } else if (attr->name() == textAttr) {
112 addCSSColor(attr, CSSPropertyColor, attr->value()); 112 addCSSColor(attr, CSSPropertyColor, attr->value());
113 } else if (attr->name() == bgpropertiesAttr) { 113 } else if (attr->name() == bgpropertiesAttr) {
114 if (equalIgnoringCase(attr->value(), "fixed")) 114 if (equalIgnoringCase(attr->value(), "fixed"))
115 addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed) ; 115 addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed) ;
116 } else if (attr->name() == vlinkAttr || 116 } else if (attr->name() == vlinkAttr ||
117 attr->name() == alinkAttr || 117 attr->name() == alinkAttr ||
118 attr->name() == linkAttr) { 118 attr->name() == linkAttr) {
119 // This tells us that we are removed from document. If our document is l ater destroyed
120 // (not deleted since we hold a guardRef), our stylesheet list will be n ull causing a crash
121 // later in document()->styleSelector(). So, we bail out early because w e shouldn't be
122 // modifying anything in that document. See webkit bug 62230.
123 if (m_linkDecl && !m_linkDecl->parent())
124 return;
125
119 if (attr->isNull()) { 126 if (attr->isNull()) {
120 if (attr->name() == linkAttr) 127 if (attr->name() == linkAttr)
121 document()->resetLinkColor(); 128 document()->resetLinkColor();
122 else if (attr->name() == vlinkAttr) 129 else if (attr->name() == vlinkAttr)
123 document()->resetVisitedLinkColor(); 130 document()->resetVisitedLinkColor();
124 else 131 else
125 document()->resetActiveLinkColor(); 132 document()->resetActiveLinkColor();
126 } else { 133 } else {
127 if (!m_linkDecl) 134 if (!m_linkDecl)
128 createLinkDecl(); 135 createLinkDecl();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 setAttribute(marginheightAttr, String::number(marginHeight)); 202 setAttribute(marginheightAttr, String::number(marginHeight));
196 } 203 }
197 204
198 // FIXME: This call to scheduleRelayout should not be needed here. 205 // FIXME: This call to scheduleRelayout should not be needed here.
199 // But without it we hang during WebKit tests; need to fix that and remove t his. 206 // But without it we hang during WebKit tests; need to fix that and remove t his.
200 if (FrameView* view = document()->view()) 207 if (FrameView* view = document()->view())
201 view->scheduleRelayout(); 208 view->scheduleRelayout();
202 209
203 if (document() && document()->page()) 210 if (document() && document()->page())
204 document()->page()->updateViewportArguments(); 211 document()->page()->updateViewportArguments();
212
213 if (m_linkDecl)
214 m_linkDecl->setParent(document()->elementSheet());
215 }
216
217 void HTMLBodyElement::removedFromDocument()
218 {
219 if (m_linkDecl)
220 m_linkDecl->setParent(0);
221
222 HTMLElement::removedFromDocument();
223 }
224
225 void HTMLBodyElement::didMoveToNewOwnerDocument()
226 {
227 if (m_linkDecl)
228 m_linkDecl->setParent(document()->elementSheet());
229
230 HTMLElement::didMoveToNewOwnerDocument();
205 } 231 }
206 232
207 bool HTMLBodyElement::isURLAttribute(Attribute *attr) const 233 bool HTMLBodyElement::isURLAttribute(Attribute *attr) const
208 { 234 {
209 return attr->name() == backgroundAttr; 235 return attr->name() == backgroundAttr;
210 } 236 }
211 237
212 bool HTMLBodyElement::supportsFocus() const 238 bool HTMLBodyElement::supportsFocus() const
213 { 239 {
214 return rendererIsEditable() || HTMLElement::supportsFocus(); 240 return rendererIsEditable() || HTMLElement::supportsFocus();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return view ? adjustForZoom(view->contentsWidth(), document) : 0; 364 return view ? adjustForZoom(view->contentsWidth(), document) : 0;
339 } 365 }
340 366
341 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 367 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
342 { 368 {
343 HTMLElement::addSubresourceAttributeURLs(urls); 369 HTMLElement::addSubresourceAttributeURLs(urls);
344 370
345 addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr) )); 371 addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr) ));
346 } 372 }
347 373
348 void HTMLBodyElement::didMoveToNewOwnerDocument()
349 {
350 // When moving body elements between documents, we should have to reset the parent sheet for any
351 // link style declarations. If we don't we might crash later.
352 // In practice I can't reproduce this theoretical problem.
353 // webarchive/adopt-attribute-styled-body-webarchive.html tries to make sure this crash won't surface.
354 if (m_linkDecl)
355 m_linkDecl->setParent(document()->elementSheet());
356
357 HTMLElement::didMoveToNewOwnerDocument();
358 }
359
360 } // namespace WebCore 374 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLBodyElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698