Changeset 160193 in webkit
- Timestamp:
- Dec 5, 2013 2:30:40 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160191 r160193 1 2013-12-05 Anders Carlsson <andersca@apple.com> 2 3 "Use Selection for Find" doesn't work in PDF viewed in Safari 4 https://bugs.webkit.org/show_bug.cgi?id=125319 5 <rdar://problem/15486983> 6 7 Reviewed by Tim Horton. 8 9 * WebProcess/Plugins/PDF/PDFPlugin.h: 10 * WebProcess/Plugins/PDF/PDFPlugin.mm: 11 (-[WKPDFLayerControllerDelegate writeItemsToPasteboard:withTypes:]): 12 Pass NSGeneralPboard to writeItemsToPasteboard. 13 14 (WebKit::PDFPlugin::handleEditingCommand): 15 Handle takeFindStringFromSelection by getting the current selection string and writing it to the find pasteboard. 16 17 (WebKit::PDFPlugin::isEditingCommandEnabled): 18 Handle takeFindStringFromSelection. 19 20 (WebKit::PDFPlugin::writeItemsToPasteboard): 21 Update this to take a pasteboard name. 22 1 23 2013-12-05 Anders Carlsson <andersca@apple.com> 2 24 -
trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h
r157253 r160193 89 89 void saveToPDF(); 90 90 void openWithNativeApplication(); 91 void writeItemsToPasteboard(NS Array *items, NSArray *types);91 void writeItemsToPasteboard(NSString *pasteboardName, NSArray *items, NSArray *types); 92 92 void showDefinitionForAttributedString(NSAttributedString *, CGPoint); 93 93 void performWebSearch(NSString *); -
trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
r160028 r160193 336 336 - (void)writeItemsToPasteboard:(NSArray *)items withTypes:(NSArray *)types 337 337 { 338 _pdfPlugin->writeItemsToPasteboard( items, types);338 _pdfPlugin->writeItemsToPasteboard(NSGeneralPboard, items, types); 339 339 } 340 340 … … 1481 1481 { 1482 1482 if (commandName == "copy") 1483 [m_pdfLayerController .get()copySelection];1483 [m_pdfLayerController copySelection]; 1484 1484 else if (commandName == "selectAll") 1485 [m_pdfLayerController.get() selectAll]; 1486 1485 [m_pdfLayerController selectAll]; 1486 else if (commandName == "takeFindStringFromSelection") { 1487 NSString *string = [m_pdfLayerController currentSelection].string; 1488 if (string.length) 1489 writeItemsToPasteboard(NSFindPboard, @[ [string dataUsingEncoding:NSUTF8StringEncoding] ], @[ NSPasteboardTypeString ]); 1490 } 1491 1487 1492 return true; 1488 1493 } … … 1490 1495 bool PDFPlugin::isEditingCommandEnabled(const String& commandName) 1491 1496 { 1492 if (commandName == "copy" )1493 return [m_pdfLayerController .get()currentSelection];1497 if (commandName == "copy" || commandName == "takeFindStringFromSelection") 1498 return [m_pdfLayerController currentSelection]; 1494 1499 1495 1500 if (commandName == "selectAll") … … 1631 1636 } 1632 1637 1633 void PDFPlugin::writeItemsToPasteboard(NS Array *items, NSArray *types)1638 void PDFPlugin::writeItemsToPasteboard(NSString *pasteboardName, NSArray *items, NSArray *types) 1634 1639 { 1635 1640 Vector<String> pasteboardTypes; … … 1639 1644 1640 1645 uint64_t newChangeCount; 1641 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardTypes( NSGeneralPboard, pasteboardTypes),1646 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardTypes(pasteboardName, pasteboardTypes), 1642 1647 Messages::WebContext::SetPasteboardTypes::Reply(newChangeCount), 0); 1643 1648 … … 1654 1659 if ([type isEqualToString:NSStringPboardType] || [type isEqualToString:NSPasteboardTypeString]) { 1655 1660 RetainPtr<NSString> plainTextString = adoptNS([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); 1656 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardStringForType( NSGeneralPboard, type, plainTextString.get()),1661 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardStringForType(pasteboardName, type, plainTextString.get()), 1657 1662 Messages::WebContext::SetPasteboardStringForType::Reply(newChangeCount), 0); 1658 1663 } else { … … 1666 1671 memcpy(sharedMemory->data(), buffer->data(), buffer->size()); 1667 1672 sharedMemory->createHandle(handle, SharedMemory::ReadOnly); 1668 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardBufferForType( NSGeneralPboard, type, handle, buffer->size()),1673 WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebContext::SetPasteboardBufferForType(pasteboardName, type, handle, buffer->size()), 1669 1674 Messages::WebContext::SetPasteboardBufferForType::Reply(newChangeCount), 0); 1670 1675 }
Note: See TracChangeset
for help on using the changeset viewer.