Changeset 86601 in webkit
- Timestamp:
- May 16, 2011 1:24:42 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86599 r86601 1 2011-05-16 Yuzo Fujishima <yuzo@google.com> 2 3 Reviewed by Antti Koivisto. 4 5 Fix for Bug 43704 - Web font is printed as blank if it is not cached 6 https://bugs.webkit.org/show_bug.cgi?id=43704 7 8 In setting printing, we should not validate resources already cached 9 for the document. If we do, web fonts used for screen are revalidated 10 and possiby reloaded. Then the fonts can be shown as blank on print. 11 This patch won't save the case where screen and print use different web 12 fonts. Nonetheless, this is an improvement. 13 14 No new tests because there seems to be no good way to test print images. 15 16 * editing/Editor.cpp: 17 (WebCore::Editor::paste): Use ResourceCacheValidationSuppressor instead of explicitly allowing/disallowing stale resources. 18 * loader/cache/CachedResourceLoader.h: 19 (WebCore::ResourceCacheValidationSuppressor::ResourceCacheValidationSuppressor): RAII class for allowing/disallowing stale resources. 20 (WebCore::ResourceCacheValidationSuppressor::~ResourceCacheValidationSuppressor): 21 * page/DragController.cpp: 22 (WebCore::DragController::concludeEditDrag): Use ResourceCacheValidationSuppressor instead of explicitly allowing/disallowing stale resources. 23 * page/Frame.cpp: 24 (WebCore::Frame::setPrinting): Use ResourceCacheValidationSuppressor to allow stale resources in printing. 25 1 26 2011-05-16 Dan Bernstein <mitz@apple.com> 2 27 -
trunk/Source/WebCore/editing/Editor.cpp
r86520 r86601 1217 1217 updateMarkersForWordsAffectedByEditing(false); 1218 1218 CachedResourceLoader* loader = m_frame->document()->cachedResourceLoader(); 1219 loader->setAllowStaleResources(true);1219 ResourceCacheValidationSuppressor validationSuppressor(loader); 1220 1220 if (m_frame->selection()->isContentRichlyEditable()) 1221 1221 pasteWithPasteboard(Pasteboard::generalPasteboard(), true); 1222 1222 else 1223 1223 pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard()); 1224 loader->setAllowStaleResources(false);1225 1224 } 1226 1225 -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.h
r84681 r86601 55 55 WTF_MAKE_NONCOPYABLE(CachedResourceLoader); WTF_MAKE_FAST_ALLOCATED; 56 56 friend class ImageLoader; 57 friend class ResourceCacheValidationSuppressor; 57 58 58 59 public: … … 97 98 void cancelRequests(); 98 99 99 void setAllowStaleResources(bool allowStaleResources) { m_allowStaleResources = allowStaleResources; }100 101 100 void incrementRequestCount(const CachedResource*); 102 101 void decrementRequestCount(const CachedResource*); … … 150 149 }; 151 150 152 } 151 class ResourceCacheValidationSuppressor { 152 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); 153 WTF_MAKE_FAST_ALLOCATED; 154 public: 155 ResourceCacheValidationSuppressor(CachedResourceLoader* loader) 156 : m_loader(loader) 157 , m_previousState(false) 158 { 159 if (m_loader) { 160 m_previousState = m_loader->m_allowStaleResources; 161 m_loader->m_allowStaleResources = true; 162 } 163 } 164 ~ResourceCacheValidationSuppressor() 165 { 166 if (m_loader) 167 m_loader->m_allowStaleResources = m_previousState; 168 } 169 private: 170 CachedResourceLoader* m_loader; 171 bool m_previousState; 172 }; 173 174 } // namespace WebCore 153 175 154 176 #endif -
trunk/Source/WebCore/page/DragController.cpp
r86472 r86601 448 448 return false; 449 449 CachedResourceLoader* cachedResourceLoader = range->ownerDocument()->cachedResourceLoader(); 450 cachedResourceLoader->setAllowStaleResources(true);450 ResourceCacheValidationSuppressor validationSuppressor(cachedResourceLoader); 451 451 if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) { 452 452 bool chosePlainText = false; 453 453 RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, innerFrame, range, true, chosePlainText); 454 454 if (!fragment || !innerFrame->editor()->shouldInsertFragment(fragment, range, EditorInsertActionDropped)) { 455 cachedResourceLoader->setAllowStaleResources(false);456 455 return false; 457 456 } … … 477 476 String text = dragData->asPlainText(innerFrame); 478 477 if (text.isEmpty() || !innerFrame->editor()->shouldInsertText(text, range.get(), EditorInsertActionDropped)) { 479 cachedResourceLoader->setAllowStaleResources(false);480 478 return false; 481 479 } … … 485 483 applyCommand(ReplaceSelectionCommand::create(m_documentUnderMouse.get(), createFragmentFromText(range.get(), text), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting)); 486 484 } 487 cachedResourceLoader->setAllowStaleResources(false);488 485 489 486 return true; -
trunk/Source/WebCore/page/Frame.cpp
r86584 r86601 548 548 void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize) 549 549 { 550 // In setting printing, we should not validate resources already cached for the document. 551 // See https://bugs.webkit.org/show_bug.cgi?id=43704 552 ResourceCacheValidationSuppressor validationSuppressor(m_doc->cachedResourceLoader()); 553 550 554 m_doc->setPrinting(printing); 551 555 view()->adjustMediaTypeForPrinting(printing); -
trunk/Source/WebKit/mac/ChangeLog
r86598 r86601 1 2011-05-16 Yuzo Fujishima <yuzo@google.com> 2 3 Reviewed by Antti Koivisto. 4 5 Fix for Bug 43704 - Web font is printed as blank if it is not cached 6 https://bugs.webkit.org/show_bug.cgi?id=43704 7 8 * WebView/WebHTMLView.mm: 9 (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:paginateScreenContent:]): Use ResourceCacheValidationSuppressor to allow stale resources in printing. 10 1 11 2011-05-16 David Kilzer <ddkilzer@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r86451 r86601 77 77 #import <WebCore/CachedImage.h> 78 78 #import <WebCore/CachedResourceClient.h> 79 #import <WebCore/CachedResourceLoader.h> 79 80 #import <WebCore/Chrome.h> 80 81 #import <WebCore/ColorMac.h> … … 3835 3836 coreView->setMediaType(_private->printing ? "print" : "screen"); 3836 3837 if (Document* document = coreFrame->document()) { 3838 // In setting printing, we should not validate resources already cached for the document. 3839 // See https://bugs.webkit.org/show_bug.cgi?id=43704 3840 ResourceCacheValidationSuppressor validationSuppressor(document->cachedResourceLoader()); 3841 3837 3842 document->setPaginatedForScreen(_private->paginateScreenContent); 3838 3843 document->setPrinting(_private->printing);
Note: See TracChangeset
for help on using the changeset viewer.