aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-07-04 18:56:23 +0800
committerChristian Persch <chpe@src.gnome.org>2004-07-04 18:56:23 +0800
commit3d5210a4ca588096cd847bff8a5e89b2d9f8c28b (patch)
tree6d62b71e76b07bbfe58a31e2a26c0ab987033f12
parent19c653c5affa0717a1fe627833b667bd0fb226a6 (diff)
downloadgsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar.gz
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar.bz2
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar.lz
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar.xz
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.tar.zst
gsoc2013-epiphany-3d5210a4ca588096cd847bff8a5e89b2d9f8c28b.zip
Normal context menus for check/radio/submit buttons. Fixes bug #143942.
2004-07-04 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EventContext.cpp: * embed/mozilla/EventContext.h: Normal context menus for check/radio/submit buttons. Fixes bug #143942.
-rw-r--r--ChangeLog8
-rw-r--r--embed/mozilla/EventContext.cpp87
-rw-r--r--embed/mozilla/EventContext.h1
3 files changed, 59 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index b0866618a..afe2b6f5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2004-07-04 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EventContext.cpp:
+ * embed/mozilla/EventContext.h:
+
+ Normal context menus for check/radio/submit buttons.
+ Fixes bug #143942.
+
+2004-07-04 Christian Persch <chpe@cvs.gnome.org>
+
* embed/downloader-view.c: (downloader_view_add_download):
Use regular return for valid error conditions, not
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 656def8c8..f3fac4740 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -245,41 +245,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
}
else if (g_ascii_strcasecmp (tag.get(), "input") == 0)
{
- nsCOMPtr<nsIDOMElement> element;
- element = do_QueryInterface (node);
- if (!element) return NS_ERROR_FAILURE;
-
- nsEmbedString uValue;
- element->GetAttribute (nsEmbedString(typeLiteral), uValue);
-
- nsEmbedCString value;
- NS_UTF16ToCString (uValue, NS_CSTRING_ENCODING_UTF8, value);
-
- if (g_ascii_strcasecmp (value.get(), "image") == 0)
- {
- info->context |= EMBED_CONTEXT_IMAGE;
- nsCOMPtr<nsIDOMHTMLInputElement> input;
- input = do_QueryInterface (node);
- if (!input) return NS_ERROR_FAILURE;
-
- nsEmbedString img;
- rv = input->GetSrc (img);
- if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
-
- nsEmbedCString cImg;
- rv = ResolveBaseURL (img, cImg);
- if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
- SetStringProperty ("image", cImg.get());
- }
- else if (g_ascii_strcasecmp (value.get(), "radio") != 0 &&
- g_ascii_strcasecmp (value.get(), "submit") != 0 &&
- g_ascii_strcasecmp (value.get(), "reset") != 0 &&
- g_ascii_strcasecmp (value.get(), "hidden") != 0 &&
- g_ascii_strcasecmp (value.get(), "button") != 0 &&
- g_ascii_strcasecmp (value.get(), "checkbox") != 0)
- {
- info->context |= EMBED_CONTEXT_INPUT;
- }
+ CheckInput (node);
}
else if (g_ascii_strcasecmp (tag.get(), "textarea") == 0)
{
@@ -494,8 +460,11 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
CheckLinkScheme (href);
}
}
- else if (g_ascii_strcasecmp (tag.get(), "textarea") == 0 ||
- g_ascii_strcasecmp (tag.get(), "input") == 0)
+ else if (g_ascii_strcasecmp (tag.get(), "input") == 0)
+ {
+ CheckInput (node);
+ }
+ else if (g_ascii_strcasecmp (tag.get(), "textarea") == 0)
{
info->context |= EMBED_CONTEXT_INPUT;
}
@@ -741,6 +710,50 @@ nsresult EventContext::GetTargetDocument (nsIDOMDocument **domDoc)
return NS_OK;
}
+nsresult EventContext::CheckInput (nsIDOMNode *aNode)
+{
+ const PRUnichar typeLiteral[] = { 't', 'y', 'p', 'e', '\0' };
+
+ nsCOMPtr<nsIDOMElement> element;
+ element = do_QueryInterface (aNode);
+ if (!element) return NS_ERROR_FAILURE;
+
+ nsEmbedString uValue;
+ element->GetAttribute (nsEmbedString(typeLiteral), uValue);
+
+ nsEmbedCString value;
+ NS_UTF16ToCString (uValue, NS_CSTRING_ENCODING_UTF8, value);
+
+ if (g_ascii_strcasecmp (value.get(), "image") == 0)
+ {
+ mEmbedEvent->context |= EMBED_CONTEXT_IMAGE;
+ nsCOMPtr<nsIDOMHTMLInputElement> input;
+ input = do_QueryInterface (aNode);
+ if (!input) return NS_ERROR_FAILURE;
+
+ nsresult rv;
+ nsEmbedString img;
+ rv = input->GetSrc (img);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
+ nsEmbedCString cImg;
+ rv = ResolveBaseURL (img, cImg);
+ if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+ SetStringProperty ("image", cImg.get());
+ }
+ else if (g_ascii_strcasecmp (value.get(), "radio") != 0 &&
+ g_ascii_strcasecmp (value.get(), "submit") != 0 &&
+ g_ascii_strcasecmp (value.get(), "reset") != 0 &&
+ g_ascii_strcasecmp (value.get(), "hidden") != 0 &&
+ g_ascii_strcasecmp (value.get(), "button") != 0 &&
+ g_ascii_strcasecmp (value.get(), "checkbox") != 0)
+ {
+ mEmbedEvent->context |= EMBED_CONTEXT_INPUT;
+ }
+
+ return NS_OK;
+}
+
nsresult EventContext::CheckLinkScheme (const nsAString &link)
{
nsCOMPtr<nsIURI> uri;
diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h
index efc05322b..56ac96c58 100644
--- a/embed/mozilla/EventContext.h
+++ b/embed/mozilla/EventContext.h
@@ -57,6 +57,7 @@ private:
MozillaEmbedEvent *info);
nsresult GetCSSBackground (nsIDOMNode *node, nsAString& url);
nsresult IsPageFramed (nsIDOMNode *node, PRBool *Framed);
+ nsresult CheckInput (nsIDOMNode *node);
nsresult CheckLinkScheme (const nsAString &link);
nsresult SetIntProperty (const char *name, int value);
nsresult SetStringProperty (const char *name, const char *value);