QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest) : isContentEditable(false) , isContentSelected(false) { if (!hitTest.innerNode()) return; pos = hitTest.point(); boundingRect = hitTest.boundingBox(); title = hitTest.title(); linkText = hitTest.textContent(); linkUrl = hitTest.absoluteLinkURL(); linkTitle = hitTest.titleDisplayString(); alternateText = hitTest.altDisplayString(); imageUrl = hitTest.absoluteImageURL(); innerNonSharedNode = hitTest.innerNonSharedNode(); WebCore::Image *img = hitTest.image(); if (img) { QPixmap *pix = img->nativeImageForCurrentFrame(); if (pix) pixmap = *pix; } WebCore::Frame *wframe = hitTest.targetFrame(); if (wframe) linkTargetFrame = QWebFramePrivate::kit(wframe); isContentEditable = hitTest.isContentEditable(); isContentSelected = hitTest.isSelected(); if (innerNonSharedNode && innerNonSharedNode->document() && innerNonSharedNode->document()->frame()) frame = QWebFramePrivate::kit(innerNonSharedNode->document()->frame()); }
FixedBackgroundImageLayerAndroid::FixedBackgroundImageLayerAndroid(PassRefPtr<RenderStyle> aStyle, int w, int h) : LayerAndroid((RenderLayer*)0) , m_width(w) , m_height(h) { RefPtr<RenderStyle> style = aStyle; FillLayer* layers = style->accessBackgroundLayers(); StyleImage* styleImage = layers->image(); CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage(); WebCore::Image* image = cachedImage->image(); setContentsImage(image->nativeImageForCurrentFrame()); setSize(image->width(), image->height()); setIntrinsicallyComposited(true); SkLength left, top; left = SkLength::convertLength(style->backgroundXPosition()); top = SkLength::convertLength(style->backgroundYPosition()); BackgroundImagePositioning* position = new BackgroundImagePositioning(this); position->setRepeatX(style->backgroundRepeatX() != WebCore::NoRepeatFill); position->setRepeatY(style->backgroundRepeatY() != WebCore::NoRepeatFill); setFixedPosition(position); position->setPosition(left, top); #ifdef DEBUG_COUNT ClassTracker::instance()->increment("FixedBackgroundImageLayerAndroid"); #endif }
/*! Returns the web site's icon for \a url. If the web site does not specify an icon \bold OR if the icon is not in the database, a null QIcon is returned. \note The returned icon's size is arbitrary. \sa setIconDatabasePath() */ QIcon QWebSettings::iconForUrl(const QUrl& url) { WebCore::Image* image = WebCore::iconDatabase()->iconForPageURL(WebCore::KURL(url).string(), WebCore::IntSize(16, 16)); if (!image) return QPixmap(); QPixmap* icon = image->nativeImageForCurrentFrame(); if (!icon) return QPixmap(); return* icon; }
/** * Query icon for given URL, returning associated cairo surface. * * @note in order to have this working, one must open icon database * with ewk_settings_icon_database_path_set(). * * @param url which url to query icon. * * @return cairo surface if any, or NULL on failure. */ cairo_surface_t* ewk_settings_icon_database_icon_surface_get(const char *url) { EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); WebCore::KURL kurl(WebCore::KURL(), WebCore::String::fromUTF8(url)); WebCore::Image *icon = WebCore::iconDatabase()->iconForPageURL(kurl.string(), WebCore::IntSize(16, 16)); if (!icon) { ERR("no icon for url %s", url); return 0; } return icon->nativeImageForCurrentFrame(); }
WebImage WebElement::imageContents() { if (isNull()) return WebImage(); WebCore::Image* image = unwrap<Element>()->imageContents(); if (!image) return WebImage(); RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); if (!bitmap) return WebImage(); return bitmap->bitmap(); }
Evas_Object* ewk_settings_icon_database_icon_object_get(const char* url, Evas* canvas) { EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url)); WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(kurl.string(), WebCore::IntSize(16, 16)); if (!icon) { ERR("no icon for url %s", url); return 0; } WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame(); return nativeImage ? ewk_util_image_from_cairo_surface_add(canvas, nativeImage->surface()) : 0; }
/** * Create Evas_Object of type image representing the given URL. * * This is an utility function that creates an Evas_Object of type * image set to have fill always match object size * (evas_object_image_filled_add()), saving some code to use it from Evas. * * @note in order to have this working, one must open icon database * with ewk_settings_icon_database_path_set(). * * @param url which url to query icon. * @param canvas evas instance where to add resulting object. * * @return newly allocated Evas_Object instance or @c NULL on * errors. Delete the object with evas_object_del(). */ Evas_Object* ewk_settings_icon_database_icon_object_add(const char* url, Evas* canvas) { EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); WebCore::KURL kurl(WebCore::KURL(), WebCore::String::fromUTF8(url)); WebCore::Image* icon = WebCore::iconDatabase()->iconForPageURL(kurl.string(), WebCore::IntSize(16, 16)); cairo_surface_t* surface; if (!icon) { ERR("no icon for url %s", url); return 0; } surface = icon->nativeImageForCurrentFrame(); return ewk_util_image_from_cairo_surface_add(canvas, surface); }
QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest) : isContentEditable(false) , isContentSelected(false) , isScrollBar(false) , webCoreFrame(0) { if (!hitTest.innerNode()) return; pos = hitTest.roundedPointInInnerNodeFrame(); WebCore::TextDirection dir; title = hitTest.title(dir); linkText = hitTest.textContent(); linkUrl = hitTest.absoluteLinkURL(); linkTitle = hitTest.titleDisplayString(); alternateText = hitTest.altDisplayString(); imageUrl = hitTest.absoluteImageURL(); innerNode = hitTest.innerNode(); innerNode->ref(); innerNonSharedNode = hitTest.innerNonSharedNode(); innerNonSharedNode->ref(); boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect() : IntRect(); WebCore::Image *img = hitTest.image(); if (img) { QPixmap* pix = img->nativeImageForCurrentFrame(); if (pix) pixmap = *pix; } WebCore::Frame *wframe = hitTest.targetFrame(); if (wframe) { linkTargetFrame = QWebFrameAdapter::kit(wframe)->handle(); webCoreFrame = wframe; webCoreFrame->ref(); } linkElement = QWebElement(hitTest.URLElement()); isContentEditable = hitTest.isContentEditable(); isContentSelected = hitTest.isSelected(); isScrollBar = hitTest.scrollbar(); WebCore::Frame *innerNodeFrame = hitTest.innerNodeFrame(); if (innerNodeFrame) frame = QWebFrameAdapter::kit(innerNodeFrame)->handle(); enclosingBlock = QWebElement(WebCore::enclosingBlock(innerNode)); }
QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest) : isContentEditable(false) , isContentSelected(false) , isScrollBar(false) { if (!hitTest.innerNode()) return; pos = hitTest.point(); boundingRect = hitTest.boundingBox(); title = hitTest.title(); linkText = hitTest.textContent(); linkUrl = hitTest.absoluteLinkURL(); linkTitle = hitTest.titleDisplayString(); alternateText = hitTest.altDisplayString(); imageUrl = hitTest.absoluteImageURL(); innerNode = hitTest.innerNode(); innerNonSharedNode = hitTest.innerNonSharedNode(); WebCore::Image *img = hitTest.image(); if (img) { QPixmap *pix = img->nativeImageForCurrentFrame(); if (pix) pixmap = *pix; } WebCore::Frame *wframe = hitTest.targetFrame(); if (wframe) linkTargetFrame = QWebFramePrivate::kit(wframe); isContentEditable = hitTest.isContentEditable(); isContentSelected = hitTest.isSelected(); isScrollBar = hitTest.scrollbar(); if (innerNonSharedNode && innerNonSharedNode->document() && innerNonSharedNode->document()->frame()) frame = QWebFramePrivate::kit(innerNonSharedNode->document()->frame()); if (Node *block = WebCore::enclosingBlock(innerNode.get())) { RenderObject *renderBlock = block->renderer(); while (renderBlock && renderBlock->isListItem()) renderBlock = renderBlock->containingBlock(); if (renderBlock) enclosingBlock = renderBlock->absoluteClippedOverflowRect(); } }