| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 OwnPtr<UserStyleSheet> userStyleSheet = adoptPtr(new UserStyleSheet(source,
url, whitelist, blacklist, injectedFrames, level)); | 295 OwnPtr<UserStyleSheet> userStyleSheet = adoptPtr(new UserStyleSheet(source,
url, whitelist, blacklist, injectedFrames, level)); |
| 296 if (!m_userStyleSheets) | 296 if (!m_userStyleSheets) |
| 297 m_userStyleSheets = adoptPtr(new UserStyleSheetMap); | 297 m_userStyleSheets = adoptPtr(new UserStyleSheetMap); |
| 298 OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(wo
rld, nullptr).iterator->value; | 298 OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(wo
rld, nullptr).iterator->value; |
| 299 if (!styleSheetsInWorld) | 299 if (!styleSheetsInWorld) |
| 300 styleSheetsInWorld = adoptPtr(new UserStyleSheetVector); | 300 styleSheetsInWorld = adoptPtr(new UserStyleSheetVector); |
| 301 styleSheetsInWorld->append(userStyleSheet.release()); | 301 styleSheetsInWorld->append(userStyleSheet.release()); |
| 302 | 302 |
| 303 if (injectionTime == InjectInExistingDocuments) | 303 if (injectionTime == InjectInExistingDocuments) |
| 304 resetUserStyleCacheInAllFrames(); | 304 invalidatedInjectedStyleSheetCacheInAllFrames(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& ur
l) | 307 void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& ur
l) |
| 308 { | 308 { |
| 309 ASSERT_ARG(world, world); | 309 ASSERT_ARG(world, world); |
| 310 | 310 |
| 311 if (!m_userScripts) | 311 if (!m_userScripts) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 UserScriptMap::iterator it = m_userScripts->find(world); | 314 UserScriptMap::iterator it = m_userScripts->find(world); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 344 sheetsChanged = true; | 344 sheetsChanged = true; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 if (!sheetsChanged) | 348 if (!sheetsChanged) |
| 349 return; | 349 return; |
| 350 | 350 |
| 351 if (stylesheets->isEmpty()) | 351 if (stylesheets->isEmpty()) |
| 352 m_userStyleSheets->remove(it); | 352 m_userStyleSheets->remove(it); |
| 353 | 353 |
| 354 resetUserStyleCacheInAllFrames(); | 354 invalidatedInjectedStyleSheetCacheInAllFrames(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world) | 357 void PageGroup::removeUserScriptsFromWorld(DOMWrapperWorld* world) |
| 358 { | 358 { |
| 359 ASSERT_ARG(world, world); | 359 ASSERT_ARG(world, world); |
| 360 | 360 |
| 361 if (!m_userScripts) | 361 if (!m_userScripts) |
| 362 return; | 362 return; |
| 363 | 363 |
| 364 UserScriptMap::iterator it = m_userScripts->find(world); | 364 UserScriptMap::iterator it = m_userScripts->find(world); |
| 365 if (it == m_userScripts->end()) | 365 if (it == m_userScripts->end()) |
| 366 return; | 366 return; |
| 367 | 367 |
| 368 m_userScripts->remove(it); | 368 m_userScripts->remove(it); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld* world) | 371 void PageGroup::removeUserStyleSheetsFromWorld(DOMWrapperWorld* world) |
| 372 { | 372 { |
| 373 ASSERT_ARG(world, world); | 373 ASSERT_ARG(world, world); |
| 374 | 374 |
| 375 if (!m_userStyleSheets) | 375 if (!m_userStyleSheets) |
| 376 return; | 376 return; |
| 377 | 377 |
| 378 UserStyleSheetMap::iterator it = m_userStyleSheets->find(world); | 378 UserStyleSheetMap::iterator it = m_userStyleSheets->find(world); |
| 379 if (it == m_userStyleSheets->end()) | 379 if (it == m_userStyleSheets->end()) |
| 380 return; | 380 return; |
| 381 | 381 |
| 382 m_userStyleSheets->remove(it); | 382 m_userStyleSheets->remove(it); |
| 383 | 383 |
| 384 resetUserStyleCacheInAllFrames(); | 384 invalidatedInjectedStyleSheetCacheInAllFrames(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void PageGroup::removeAllUserContent() | 387 void PageGroup::removeAllUserContent() |
| 388 { | 388 { |
| 389 m_userScripts.clear(); | 389 m_userScripts.clear(); |
| 390 | 390 |
| 391 if (m_userStyleSheets) { | 391 if (m_userStyleSheets) { |
| 392 m_userStyleSheets.clear(); | 392 m_userStyleSheets.clear(); |
| 393 resetUserStyleCacheInAllFrames(); | 393 invalidatedInjectedStyleSheetCacheInAllFrames(); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 void PageGroup::resetUserStyleCacheInAllFrames() | 397 void PageGroup::invalidatedInjectedStyleSheetCacheInAllFrames() |
| 398 { | 398 { |
| 399 // Clear our cached sheets and have them just reparse. | 399 // Clear our cached sheets and have them just reparse. |
| 400 HashSet<Page*>::const_iterator end = m_pages.end(); | 400 HashSet<Page*>::const_iterator end = m_pages.end(); |
| 401 for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) { | 401 for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) { |
| 402 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->tr
averseNext()) | 402 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->tr
averseNext()) |
| 403 frame->document()->styleSheetCollection()->updatePageGroupUserSheets
(); | 403 frame->document()->styleSheetCollection()->invalidateInjectedStyleSh
eetCache(); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 #if ENABLE(VIDEO_TRACK) | 407 #if ENABLE(VIDEO_TRACK) |
| 408 CaptionUserPreferences* PageGroup::captionPreferences() | 408 CaptionUserPreferences* PageGroup::captionPreferences() |
| 409 { | 409 { |
| 410 if (!m_captionPreferences) | 410 if (!m_captionPreferences) |
| 411 #if PLATFORM(MAC) | 411 #if PLATFORM(MAC) |
| 412 m_captionPreferences = CaptionUserPreferencesMac::create(this); | 412 m_captionPreferences = CaptionUserPreferencesMac::create(this); |
| 413 #else | 413 #else |
| (...skipping 26 matching lines...) Expand all Loading... |
| 440 } | 440 } |
| 441 | 441 |
| 442 float PageGroup::captionFontSizeScale() | 442 float PageGroup::captionFontSizeScale() |
| 443 { | 443 { |
| 444 return captionPreferences()->captionFontSizeScale(); | 444 return captionPreferences()->captionFontSizeScale(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 #endif | 447 #endif |
| 448 | 448 |
| 449 } // namespace WebCore | 449 } // namespace WebCore |
| OLD | NEW |