| 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) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) | 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) |
| 7 * Copyright (C) 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 if (m_cachedSheet) | 224 if (m_cachedSheet) |
| 225 m_cachedSheet->addClient(this); | 225 m_cachedSheet->addClient(this); |
| 226 else { | 226 else { |
| 227 // The request may have been denied if (for example) the stylesheet
is local and the document is remote. | 227 // The request may have been denied if (for example) the stylesheet
is local and the document is remote. |
| 228 m_loading = false; | 228 m_loading = false; |
| 229 removePendingSheet(); | 229 removePendingSheet(); |
| 230 } | 230 } |
| 231 } else if (m_sheet) { | 231 } else if (m_sheet) { |
| 232 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang
ed | 232 // we no longer contain a stylesheet, e.g. perhaps rel or type was chang
ed |
| 233 m_sheet = 0; | 233 clearSheet(); |
| 234 document()->styleSelectorChanged(DeferRecalcStyle); | 234 document()->styleSelectorChanged(DeferRecalcStyle); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void HTMLLinkElement::clearSheet() |
| 239 { |
| 240 ASSERT(m_sheet); |
| 241 ASSERT(m_sheet->ownerNode() == this); |
| 242 m_sheet->clearOwnerNode(); |
| 243 m_sheet = 0; |
| 244 } |
| 245 |
| 238 void HTMLLinkElement::insertedIntoDocument() | 246 void HTMLLinkElement::insertedIntoDocument() |
| 239 { | 247 { |
| 240 HTMLElement::insertedIntoDocument(); | 248 HTMLElement::insertedIntoDocument(); |
| 241 | 249 |
| 242 m_isInShadowTree = isInShadowTree(); | 250 m_isInShadowTree = isInShadowTree(); |
| 243 if (m_isInShadowTree) | 251 if (m_isInShadowTree) |
| 244 return; | 252 return; |
| 245 | 253 |
| 246 document()->addStyleSheetCandidateNode(this, m_createdByParser); | 254 document()->addStyleSheetCandidateNode(this, m_createdByParser); |
| 247 | 255 |
| 248 process(); | 256 process(); |
| 249 } | 257 } |
| 250 | 258 |
| 251 void HTMLLinkElement::removedFromDocument() | 259 void HTMLLinkElement::removedFromDocument() |
| 252 { | 260 { |
| 253 HTMLElement::removedFromDocument(); | 261 HTMLElement::removedFromDocument(); |
| 254 | 262 |
| 255 if (m_isInShadowTree) { | 263 if (m_isInShadowTree) { |
| 256 ASSERT(!m_sheet); | 264 ASSERT(!m_sheet); |
| 257 return; | 265 return; |
| 258 } | 266 } |
| 259 document()->removeStyleSheetCandidateNode(this); | 267 document()->removeStyleSheetCandidateNode(this); |
| 260 | 268 |
| 261 if (m_sheet) { | 269 if (m_sheet) |
| 262 ASSERT(m_sheet->ownerNode() == this); | 270 clearSheet(); |
| 263 m_sheet->clearOwnerNode(); | |
| 264 m_sheet = 0; | |
| 265 } | |
| 266 | 271 |
| 267 if (styleSheetIsLoading()) | 272 if (styleSheetIsLoading()) |
| 268 removePendingSheet(); | 273 removePendingSheet(); |
| 269 | 274 |
| 270 if (document()->renderer()) | 275 if (document()->renderer()) |
| 271 document()->styleSelectorChanged(DeferRecalcStyle); | 276 document()->styleSelectorChanged(DeferRecalcStyle); |
| 272 } | 277 } |
| 273 | 278 |
| 274 void HTMLLinkElement::finishParsingChildren() | 279 void HTMLLinkElement::finishParsingChildren() |
| 275 { | 280 { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 return getURLAttribute(hrefAttr); | 492 return getURLAttribute(hrefAttr); |
| 488 } | 493 } |
| 489 | 494 |
| 490 void HTMLLinkElement::setItemValueText(const String& value, ExceptionCode&) | 495 void HTMLLinkElement::setItemValueText(const String& value, ExceptionCode&) |
| 491 { | 496 { |
| 492 setAttribute(hrefAttr, value); | 497 setAttribute(hrefAttr, value); |
| 493 } | 498 } |
| 494 #endif | 499 #endif |
| 495 | 500 |
| 496 } // namespace WebCore | 501 } // namespace WebCore |
| OLD | NEW |