本文整理汇总了C++中CachedImage::isLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ CachedImage::isLoaded方法的具体用法?C++ CachedImage::isLoaded怎么用?C++ CachedImage::isLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CachedImage
的用法示例。
在下文中一共展示了CachedImage::isLoaded方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeImageToDataObject
static void writeImageToDataObject(IDataObject* dataObject, Element* element, const KURL& url)
{
// Shove image data into a DataObject for use as a file
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
SharedBuffer* imageBuffer = cachedImage->image()->data();
if (!imageBuffer || !imageBuffer->size())
return;
HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element->getAttribute(altAttr), cachedImage);
if (!imageFileDescriptor)
return;
HGLOBAL imageFileContent = createGlobalImageFileContent(imageBuffer);
if (!imageFileContent) {
GlobalFree(imageFileDescriptor);
return;
}
String fileName = cachedImage->response().suggestedFilename();
HGLOBAL hDropContent = createGlobalHDropContent(url, fileName, imageBuffer);
if (!hDropContent) {
GlobalFree(hDropContent);
return;
}
writeFileToDataObject(dataObject, imageFileDescriptor, imageFileContent, hDropContent);
}
示例2: writeImageToDataObject
static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element,
const KURL& url)
{
// Shove image data into a DataObject for use as a file
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
SharedBuffer* imageBuffer = cachedImage->image()->data();
if (!imageBuffer || !imageBuffer->size())
return;
dataObject->fileContent = imageBuffer;
// Determine the filename for the file contents of the image. We try to
// use the alt tag if one exists, otherwise we fall back on the suggested
// filename in the http header, and finally we resort to using the filename
// in the URL.
String extension(".");
extension += MIMETypeRegistry::getPreferredExtensionForMIMEType(
cachedImage->response().mimeType());
String title = element->getAttribute(altAttr);
if (title.isEmpty()) {
title = cachedImage->response().suggestedFilename();
// FIXME: If title is empty, get the filename from the URL.
}
dataObject->fileContentFilename = title + extension;
}
示例3: declareAndWriteDragImage
void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
{
ASSERT(frame);
// WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
if (!m_writableData)
m_writableData = new QMimeData;
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->imageForRenderer(element->renderer()) || !cachedImage->isLoaded())
return;
QPixmap* pixmap = cachedImage->imageForRenderer(element->renderer())->nativeImageForCurrentFrame();
if (pixmap)
m_writableData->setImageData(*pixmap);
QList<QUrl> urls;
urls.append(url);
m_writableData->setText(title);
m_writableData->setUrls(urls);
m_writableData->setHtml(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
#ifndef QT_NO_CLIPBOARD
if (isForCopyAndPaste())
QApplication::clipboard()->setMimeData(m_writableData);
#endif
}
示例4: declareAndWriteDragImage
void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
{
ASSERT(frame);
// WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
if (!m_writableData)
m_writableData = new QMimeData;
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
QPixmap* pixmap = cachedImage->image()->nativeImageForCurrentFrame();
if (pixmap)
m_writableData->setImageData(*pixmap);
AtomicString imageURL = element->getAttribute(HTMLNames::srcAttr);
if (imageURL.isEmpty())
return;
KURL fullURL = frame->document()->completeURL(deprecatedParseURL(imageURL));
if (fullURL.isEmpty())
return;
QList<QUrl> urls;
urls.append(url);
urls.append(fullURL);
m_writableData->setText(title);
m_writableData->setUrls(urls);
#ifndef QT_NO_CLIPBOARD
if (!isForDragging())
QApplication::clipboard()->setMimeData(m_writableData);
#endif
}
示例5: writeImageToDataObject
static void writeImageToDataObject(
DataObjectJava* dataObject,
Element* element,
const KURL& url)
{
// Shove image data into a DataObject for use as a file
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
SharedBuffer* imageBuffer = cachedImage->image()->data();
if (!imageBuffer || !imageBuffer->size())
return;
dataObject->fileContent = imageBuffer;
// Determine the filename for the file contents of the image. We try to
// use the alt tag if one exists, otherwise we fall back on the suggested
// filename in the http header, and finally we resort to using the filename
// in the URL.
//String title = element->getAttribute(altAttr);
//if (title.isEmpty())
// title = cachedImage->response().suggestedFilename();
//TODO: do we need it?
dataObject->fileContentFilename = cachedImage->response().suggestedFilename();
}
示例6: writeImageToDataObject
static void writeImageToDataObject(DataObject* dataObject, Element* element,
const KURL& url)
{
// Shove image data into a DataObject for use as a file
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
return;
SharedBuffer* imageBuffer = cachedImage->image()->data();
if (!imageBuffer || !imageBuffer->size())
return;
dataObject->fileContent = imageBuffer;
// Determine the filename for the file contents of the image. We try to
// use the alt tag if one exists, otherwise we fall back on the suggested
// filename in the http header, and finally we resort to using the filename
// in the URL.
/*String extension = MIMETypeRegistry::getPreferredExtensionForMIMEType(
cachedImage->response().mimeType());*/
String extension = "png";
dataObject->fileExtension = extension.isEmpty() ? "" : "." + extension;
String title = element->getAttribute(altAttr);
if (title.isEmpty())
title = cachedImage->response().suggestedFilename();
//title = ClipboardBal::validateFileName(title, dataObject);
dataObject->fileContentFilename = title + dataObject->fileExtension;
}
示例7: declareAndWriteDragImage
void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame* frame)
{
m_dataObject->setURL(url, label);
m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
CachedImage* image = getCachedImage(element);
if (!image || !image->isLoaded())
return;
GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->imageForRenderer(element->renderer())->getGdkPixbuf());
if (!pixbuf)
return;
m_dataObject->setImage(pixbuf.get());
}
示例8: declareAndWriteDragImage
void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*)
{
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->isLoaded())
return;
GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf();
if (!pixbuf)
return;
GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage"));
gtk_clipboard_clear(imageClipboard);
gtk_clipboard_set_image(imageClipboard, pixbuf);
g_object_unref(pixbuf);
writeURL(url, label, 0);
}
示例9: writeImageToDataObject
static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element,
const KURL& url)
{
// Shove image data into a DataObject for use as a file
CachedImage* cachedImage = getCachedImage(element);
if (!cachedImage || !cachedImage->imageForRenderer(element->renderer()) || !cachedImage->isLoaded())
return;
SharedBuffer* imageBuffer = cachedImage->imageForRenderer(element->renderer())->data();
if (!imageBuffer || !imageBuffer->size())
return;
dataObject->setFileContent(imageBuffer);
// Determine the filename for the file contents of the image.
String filename = cachedImage->response().suggestedFilename();
if (filename.isEmpty())
filename = url.lastPathComponent();
if (filename.isEmpty())
filename = element->getAttribute(altAttr);
else {
// Strip any existing extension. Assume that alt text is usually not a filename.
int extensionIndex = filename.reverseFind('.');
if (extensionIndex != -1)
filename.truncate(extensionIndex);
}
String extension = MIMETypeRegistry::getPreferredExtensionForMIMEType(
cachedImage->response().mimeType());
extension = extension.isEmpty() ? emptyString() : "." + extension;
ClipboardChromium::validateFilename(filename, extension);
dataObject->setFileContentFilename(filename + extension);
dataObject->setFileExtension(extension);
}