| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 ASSERT(styleSheet->ownerDocument()); | 269 ASSERT(styleSheet->ownerDocument()); |
| 270 Document& document = *styleSheet->ownerDocument(); | 270 Document& document = *styleSheet->ownerDocument(); |
| 271 // Some rules have resources associated with them that we need to retrie
ve. | 271 // Some rules have resources associated with them that we need to retrie
ve. |
| 272 if (rule->type() == CSSRule::IMPORT_RULE) { | 272 if (rule->type() == CSSRule::IMPORT_RULE) { |
| 273 CSSImportRule* importRule = toCSSImportRule(rule); | 273 CSSImportRule* importRule = toCSSImportRule(rule); |
| 274 KURL importURL = document.completeURL(importRule->href()); | 274 KURL importURL = document.completeURL(importRule->href()); |
| 275 if (m_resourceURLs.contains(importURL)) | 275 if (m_resourceURLs.contains(importURL)) |
| 276 continue; | 276 continue; |
| 277 serializeCSSStyleSheet(importRule->styleSheet(), importURL); | 277 serializeCSSStyleSheet(importRule->styleSheet(), importURL); |
| 278 } else if (rule->type() == CSSRule::FONT_FACE_RULE) { | 278 } else if (rule->type() == CSSRule::FONT_FACE_RULE) { |
| 279 retrieveResourcesForProperties(toCSSFontFaceRule(rule)->styleRule()-
>properties(), document); | 279 retrieveResourcesForProperties(&toCSSFontFaceRule(rule)->styleRule()
->properties(), document); |
| 280 } else if (rule->type() == CSSRule::STYLE_RULE) { | 280 } else if (rule->type() == CSSRule::STYLE_RULE) { |
| 281 retrieveResourcesForProperties(toCSSStyleRule(rule)->styleRule()->pr
operties(), document); | 281 retrieveResourcesForProperties(&toCSSStyleRule(rule)->styleRule()->p
roperties(), document); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 if (url.isValid() && !m_resourceURLs.contains(url)) { | 285 if (url.isValid() && !m_resourceURLs.contains(url)) { |
| 286 // FIXME: We should check whether a charset has been specified and if no
ne was found add one. | 286 // FIXME: We should check whether a charset has been specified and if no
ne was found add one. |
| 287 WTF::TextEncoding textEncoding(styleSheet->contents()->charset()); | 287 WTF::TextEncoding textEncoding(styleSheet->contents()->charset()); |
| 288 ASSERT(textEncoding.isValid()); | 288 ASSERT(textEncoding.isValid()); |
| 289 String textString = cssText.toString(); | 289 String textString = cssText.toString(); |
| 290 CString text = textEncoding.normalizeAndEncode(textString, WTF::Entities
ForUnencodables); | 290 CString text = textEncoding.normalizeAndEncode(textString, WTF::Entities
ForUnencodables); |
| 291 m_resources->append(SerializedResource(url, String("text/css"), SharedBu
ffer::create(text.data(), text.length()))); | 291 m_resources->append(SerializedResource(url, String("text/css"), SharedBu
ffer::create(text.data(), text.length()))); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (iter != m_blankFrameURLs.end()) | 380 if (iter != m_blankFrameURLs.end()) |
| 381 return iter->value; | 381 return iter->value; |
| 382 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); | 382 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); |
| 383 KURL fakeURL(ParsedURLString, url); | 383 KURL fakeURL(ParsedURLString, url); |
| 384 m_blankFrameURLs.add(frame, fakeURL); | 384 m_blankFrameURLs.add(frame, fakeURL); |
| 385 | 385 |
| 386 return fakeURL; | 386 return fakeURL; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } | 389 } |
| OLD | NEW |