diff options
author | Jean-François Rameau <jframeau@cvs.gnome.org> | 2005-09-27 03:22:19 +0800 |
---|---|---|
committer | Jean-François Rameau <jframeau@src.gnome.org> | 2005-09-27 03:22:19 +0800 |
commit | d4adb2139ba3c98379911d36534084a0e7462e8f (patch) | |
tree | 565b6ad91864a27bfe271e55667b6be3da279de9 /embed/mozilla/EventContext.cpp | |
parent | 90e9c33223a8a56dbd97e8b45cb313bfa27a0100 (diff) | |
download | gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar.gz gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar.bz2 gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar.lz gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar.xz gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.tar.zst gsoc2013-epiphany-d4adb2139ba3c98379911d36534084a0e7462e8f.zip |
Unify background image and image code (contex menu, conext event). Fix bug
2005-09-26 Jean-François Rameau <jframeau@cvs.gnome.org>
* src/ephy-lockdown.c: (update_window):
* src/ephy-window.c: (update_popups_tooltips), (show_embed_popup):
* src/popup-commands.c:
* src/popup-commands.h:
* embed/mozilla/EventContext.cpp: (GetEventContext):
* data/ui/epiphany-ui.xml:
Unify background image and image code (contex menu, conext event).
Fix bug 154887.
Diffstat (limited to 'embed/mozilla/EventContext.cpp')
-rw-r--r-- | embed/mozilla/EventContext.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 855cd06a5..cb202d7b8 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -266,7 +266,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, rv = node->GetNodeType(&type); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - PRBool has_background = PR_FALSE; + PRBool has_image = PR_FALSE; nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(node); if ((nsIDOMNode::ELEMENT_NODE == type) && element) @@ -280,8 +280,6 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (g_ascii_strcasecmp (tag.get(), "img") == 0) { - info->context |= EPHY_EMBED_CONTEXT_IMAGE; - nsEmbedString img; nsCOMPtr <nsIDOMHTMLImageElement> image = do_QueryInterface(node, &rv); @@ -289,7 +287,10 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, rv = image->GetSrc (img); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; + SetStringProperty ("image", img); + info->context |= EPHY_EMBED_CONTEXT_IMAGE; + has_image = PR_TRUE; } else if (g_ascii_strcasecmp (tag.get(), "area") == 0) { @@ -343,9 +344,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, rv = img->GetSrc (imgSrc); if (NS_FAILED(rv)) continue; - info->context |= EPHY_EMBED_CONTEXT_IMAGE; - SetStringProperty ("image", imgSrc); + info->context |= EPHY_EMBED_CONTEXT_IMAGE; + has_image = PR_TRUE; break; } @@ -374,8 +375,6 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, // MIME types are always lower case if (g_str_has_prefix (cValue.get(), "image/")) { - info->context |= EPHY_EMBED_CONTEXT_IMAGE; - nsEmbedString img; rv = object->GetData (img); @@ -386,6 +385,8 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_FAILED (rv)) return NS_ERROR_FAILURE; SetStringProperty ("image", cImg.get()); + info->context |= EPHY_EMBED_CONTEXT_IMAGE; + has_image = PR_TRUE; } else { @@ -415,10 +416,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - SetStringProperty ("background_image", - bgimg.get()); - - has_background = PR_TRUE; + SetStringProperty ("image", bgimg.get()); + info->context |= EPHY_EMBED_CONTEXT_IMAGE; + has_image = PR_TRUE; } } } @@ -587,7 +587,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, info->context |= EPHY_EMBED_CONTEXT_INPUT; } - if (!has_background) + if (!has_image) { nsEmbedString cssurl; rv = GetCSSBackground (node, cssurl); @@ -598,10 +598,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, rv = ResolveBaseURL (cssurl, bgimg); if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - SetStringProperty ("background_image", - bgimg.get()); - - has_background = PR_TRUE; + SetStringProperty ("image", bgimg.get()); + info->context |= EPHY_EMBED_CONTEXT_IMAGE; + has_image = PR_TRUE; } } } |