WebCore/ChangeLog

 12010-12-06 Yuzo Fujishima <yuzo@google.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 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 for the document.
 9 If we do, web fonts used for screen are revalidated and possiby reloaded. Then the fonts can be shown as blank on print.
 10 This patch won't save the case where screen and print use different web fonts. Nonetheless, this is an improvement.
 11
 12 No new tests because there seems to be no good way to test print images.
 13
 14 * loader/cache/CachedResourceLoader.cpp:
 15 (WebCore::CachedResourceLoader::CachedResourceLoader):
 16 (WebCore::CachedResourceLoader::checkForReload):
 17 * loader/cache/CachedResourceLoader.h:
 18 (WebCore::DocumentResourceCacheValidationSuppressor::DocumentResourceCacheValidationSuppressor):
 19 (WebCore::DocumentResourceCacheValidationSuppressor::~DocumentResourceCacheValidationSuppressor):
 20 * page/Frame.cpp:
 21 (WebCore::Frame::setPrinting):
 22
1232010-12-05 Kent Tamura <tkent@chromium.org>
224
325 Unreviewed. Run sort-Xcode-project-file.

WebCore/loader/cache/CachedResourceLoader.cpp

@@CachedResourceLoader::CachedResourceLoader(Document* document)
5757 , m_autoLoadImages(true)
5858 , m_loadInProgress(false)
5959 , m_allowStaleResources(false)
 60 , m_allowStaleResourcesWithinDocument(false)
6061{
6162 m_cache->addCachedResourceLoader(this);
6263}

@@void CachedResourceLoader::checkForReload(const KURL& fullURL)
9697 if (!existing || existing->isPreloaded())
9798 return;
9899
 100 if (m_allowStaleResourcesWithinDocument && m_documentResources.find(fullURL.string()) != m_documentResources.end())
 101 return;
 102
99103 switch (cachePolicy()) {
100104 case CachePolicyVerify:
101105 if (!existing->mustRevalidate(CachePolicyVerify))

WebCore/loader/cache/CachedResourceLoader.h

@@class KURL;
5050class CachedResourceLoader : public Noncopyable {
5151friend class MemoryCache;
5252friend class ImageLoader;
 53friend class DocumentResourceCacheValidationSuppressor;
5354
5455public:
5556 CachedResourceLoader(Document*);

@@private:
124125 };
125126 Vector<PendingPreload> m_pendingPreloads;
126127
127  //29 bits left
 128 // 28 bits left
128129 bool m_autoLoadImages : 1;
129130 bool m_loadInProgress : 1;
130  bool m_allowStaleResources : 1;
 131 bool m_allowStaleResources : 1; // Allow stale resources across documents (and also within the document).
 132 bool m_allowStaleResourcesWithinDocument : 1; // Allow stale resources within the document (but not across documents).
131133};
132134
133 }
 135class DocumentResourceCacheValidationSuppressor : public Noncopyable {
 136public:
 137 DocumentResourceCacheValidationSuppressor(CachedResourceLoader* loader) : m_loader(loader)
 138 {
 139 if (m_loader)
 140 m_loader->m_allowStaleResourcesWithinDocument = true;
 141 }
 142 ~DocumentResourceCacheValidationSuppressor()
 143 {
 144 if (m_loader)
 145 m_loader->m_allowStaleResourcesWithinDocument = false;
 146 }
 147private:
 148 CachedResourceLoader* m_loader;
 149};
 150
 151} // namespace WebCore
134152
135153#endif

WebCore/page/Frame.cpp

@@String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* e
488488
489489void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
490490{
 491 // In setting printing, we should not validate resources already cached for the document.
 492 // See https://bugs.webkit.org/show_bug.cgi?id=43704
 493 DocumentResourceCacheValidationSuppressor validationSuppressor(m_doc->cachedResourceLoader());
 494
491495 m_doc->setPrinting(printing);
492496 view()->adjustMediaTypeForPrinting(printing);
493497

WebKit/mac/ChangeLog

 12010-12-06 Yuzo Fujishima <yuzo@google.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 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:]):
 10
1112010-12-04 Dan Bernstein <mitz@apple.com>
212
313 Reviewed by Sam Weinig.

WebKit/mac/WebView/WebHTMLView.mm

7878#import <WebCore/CSSMutableStyleDeclaration.h>
7979#import <WebCore/CachedImage.h>
8080#import <WebCore/CachedResourceClient.h>
 81#import <WebCore/CachedResourceLoader.h>
8182#import <WebCore/ColorMac.h>
8283#import <WebCore/ContextMenu.h>
8384#import <WebCore/ContextMenuController.h>

@@static BOOL isInPasswordField(Frame* coreFrame)
39253926 if (FrameView* coreView = coreFrame->view())
39263927 coreView->setMediaType(_private->printing ? "print" : "screen");
39273928 if (Document* document = coreFrame->document()) {
 3929 // In setting printing, we should not validate resources already cached for the document.
 3930 // See https://bugs.webkit.org/show_bug.cgi?id=43704
 3931 DocumentResourceCacheValidationSuppressor validationSuppressor(document->cachedResourceLoader());
 3932
39283933 document->setPaginatedForScreen(_private->paginateScreenContent);
39293934 document->setPrinting(_private->printing);
39303935 document->styleSelectorChanged(RecalcStyleImmediately);