OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if (m_isInlineStylesheet) | 267 if (m_isInlineStylesheet) |
268 return true; | 268 return true; |
269 KURL baseURL = m_contents->baseURL(); | 269 KURL baseURL = m_contents->baseURL(); |
270 if (baseURL.isEmpty()) | 270 if (baseURL.isEmpty()) |
271 return true; | 271 return true; |
272 Document* document = ownerDocument(); | 272 Document* document = ownerDocument(); |
273 if (!document) | 273 if (!document) |
274 return true; | 274 return true; |
275 if (document->securityOrigin()->canRequest(baseURL)) | 275 if (document->securityOrigin()->canRequest(baseURL)) |
276 return true; | 276 return true; |
| 277 if (m_allowRuleAccessFromOrigin && document->securityOrigin()->canAccess(m_a
llowRuleAccessFromOrigin.get())) |
| 278 return true; |
277 return false; | 279 return false; |
278 } | 280 } |
279 | 281 |
280 PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::rules() | 282 PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::rules() |
281 { | 283 { |
282 return cssRules(); | 284 return cssRules(); |
283 } | 285 } |
284 | 286 |
285 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) | 287 unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc
eptionState& exceptionState) |
286 { | 288 { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 400 } |
399 | 401 |
400 Document* CSSStyleSheet::ownerDocument() const | 402 Document* CSSStyleSheet::ownerDocument() const |
401 { | 403 { |
402 const CSSStyleSheet* root = this; | 404 const CSSStyleSheet* root = this; |
403 while (root->parentStyleSheet()) | 405 while (root->parentStyleSheet()) |
404 root = root->parentStyleSheet(); | 406 root = root->parentStyleSheet(); |
405 return root->ownerNode() ? &root->ownerNode()->document() : 0; | 407 return root->ownerNode() ? &root->ownerNode()->document() : 0; |
406 } | 408 } |
407 | 409 |
| 410 void CSSStyleSheet::setAllowRuleAccessFromOrigin(PassRefPtr<SecurityOrigin> allo
wedOrigin) |
| 411 { |
| 412 m_allowRuleAccessFromOrigin = allowedOrigin; |
| 413 } |
| 414 |
408 void CSSStyleSheet::clearChildRuleCSSOMWrappers() | 415 void CSSStyleSheet::clearChildRuleCSSOMWrappers() |
409 { | 416 { |
410 m_childRuleCSSOMWrappers.clear(); | 417 m_childRuleCSSOMWrappers.clear(); |
411 } | 418 } |
412 | 419 |
413 bool CSSStyleSheet::sheetLoaded() | 420 bool CSSStyleSheet::sheetLoaded() |
414 { | 421 { |
415 ASSERT(m_ownerNode); | 422 ASSERT(m_ownerNode); |
416 setLoadCompleted(m_ownerNode->sheetLoaded()); | 423 setLoadCompleted(m_ownerNode->sheetLoaded()); |
417 return m_loadCompleted; | 424 return m_loadCompleted; |
(...skipping 24 matching lines...) Expand all Loading... |
442 visitor->trace(m_mediaQueries); | 449 visitor->trace(m_mediaQueries); |
443 visitor->trace(m_ownerNode); | 450 visitor->trace(m_ownerNode); |
444 visitor->trace(m_ownerRule); | 451 visitor->trace(m_ownerRule); |
445 visitor->trace(m_mediaCSSOMWrapper); | 452 visitor->trace(m_mediaCSSOMWrapper); |
446 visitor->trace(m_childRuleCSSOMWrappers); | 453 visitor->trace(m_childRuleCSSOMWrappers); |
447 visitor->trace(m_ruleListCSSOMWrapper); | 454 visitor->trace(m_ruleListCSSOMWrapper); |
448 StyleSheet::trace(visitor); | 455 StyleSheet::trace(visitor); |
449 } | 456 } |
450 | 457 |
451 } // namespace blink | 458 } // namespace blink |
OLD | NEW |