Commit 858f93a1 authored by sullivan's avatar sullivan

Reviewed by Dave Harrison

        
        - fixed <rdar://problem/4769772> Problem with Find on certain PDF page

        * WebView/WebPDFView.mm:
        (-[WebPDFView _scaledAttributedString:]):
        We were hitting an exception trying to set the font attribute to nil, which was happening because
        the result of -[PDFSelection attributedString] had no attributes. That PDFSelection bug is now
        filed separately, but this works around the exception.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9378b0e4
2007-03-26 John Sullivan <sullivan@apple.com>
Reviewed by Dave Harrison
- fixed <rdar://problem/4769772> Problem with Find on certain PDF page
* WebView/WebPDFView.mm:
(-[WebPDFView _scaledAttributedString:]):
We were hitting an exception trying to set the font attribute to nil, which was happening because
the result of -[PDFSelection attributedString] had no attributes. That PDFSelection bug is now
filed separately, but this works around the exception.
2007-03-24 David Hyatt <hyatt@apple.com>
Amend the statistics reporting for the WebCore cache to include XSL and to report live/decoded sizes.
......
......@@ -1104,7 +1104,6 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
- (NSAttributedString *)_scaledAttributedString:(NSAttributedString *)unscaledAttributedString
{
NSLog(@"unscaledAttributedString is %@", unscaledAttributedString);
if (!unscaledAttributedString)
return nil;
......@@ -1119,6 +1118,15 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
[result beginEditing];
while (NSMaxRange(effectiveRange) < length) {
NSFont *unscaledFont = [result attribute:NSFontAttributeName atIndex:NSMaxRange(effectiveRange) effectiveRange:&effectiveRange];
if (!unscaledFont) {
// FIXME: We can't scale the font if we don't know what it is. We should always know what it is,
// but sometimes don't due to PDFKit issue 5089411. When that's addressed, we can remove this
// early continue.
LOG_ERROR("no font attribute found in range %@ for attributed string \"%@\" on page %@ (see radar 5089411)", NSStringFromRange(effectiveRange), result, [[dataSource request] URL]);
continue;
}
NSFont *scaledFont = [NSFont fontWithName:[unscaledFont fontName] size:[unscaledFont pointSize]*scaleFactor];
[result addAttribute:NSFontAttributeName value:scaledFont range:effectiveRange];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment