implementing an interface to control SSR.
adding menu item to allow user to control SSR. moved site specific css hacks to sites.css experimenting with urlbar autocomplete. Something is still a bit off in popup handling. MINIMO ONLY.
This commit is contained in:
Родитель
77384ab964
Коммит
d84ded0bf1
|
@ -30,3 +30,4 @@ pipnss
|
|||
pippki
|
||||
phone
|
||||
snav
|
||||
ssr
|
||||
|
|
|
@ -30,3 +30,4 @@ NSS
|
|||
PKI
|
||||
nsPhoneSupportModule
|
||||
SpatialNavigationModule
|
||||
SSRModule
|
||||
|
|
|
@ -45,6 +45,9 @@ var gtabCounter=0;
|
|||
var gBrowserStatusHandler;
|
||||
var gSelectedTab=null;
|
||||
var gFullScreen=false;
|
||||
var gGlobalHistory = null;
|
||||
var gURIFixup = null;
|
||||
var gSSRSupport = null;
|
||||
|
||||
function nsBrowserStatusHandler()
|
||||
{
|
||||
|
@ -258,6 +261,7 @@ function BrowserLoadURL()
|
|||
{
|
||||
try {
|
||||
loadURI(gURLBar.value);
|
||||
content.focus();
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
|
@ -283,11 +287,9 @@ function BrowserReload()
|
|||
getWebNavigation().reload(nsIWebNavigation.LOAD_FLAGS_NONE);
|
||||
}
|
||||
|
||||
function BrowserAddTab() {
|
||||
|
||||
|
||||
var thisTab=getBrowser().addTab("http://taboca.com");
|
||||
|
||||
function BrowserAddTab()
|
||||
{
|
||||
var thisTab=getBrowser().addTab("http://mozilla.org");
|
||||
browserInit(thisTab);
|
||||
}
|
||||
|
||||
|
@ -325,8 +327,6 @@ function tabbrowserAreaClick(e) {
|
|||
* urlbar indentity, style, progress indicator.
|
||||
**/
|
||||
function urlbar() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -369,3 +369,70 @@ function DoFullScreen()
|
|||
getBrowser().setStripVisibilityTo(!gFullScreen);
|
||||
window.fullScreen = gFullScreen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addToUrlbarHistory()
|
||||
{
|
||||
var urlToAdd = gURLBar.value;
|
||||
|
||||
if (!urlToAdd)
|
||||
return;
|
||||
|
||||
if (urlToAdd.search(/[\x00-\x1F]/) != -1) // don't store bad URLs
|
||||
return;
|
||||
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
|
||||
if (!gURIFixup)
|
||||
gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Components.interfaces.nsIURIFixup);
|
||||
try {
|
||||
if (urlToAdd.indexOf(" ") == -1) {
|
||||
var fixedUpURI = gURIFixup.createFixupURI(urlToAdd, 0);
|
||||
gGlobalHistory.markPageAsTyped(fixedUpURI);
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
|
||||
function URLBarEntered()
|
||||
{
|
||||
|
||||
try { addToUrlbarHistory(); } catch(ex) {}
|
||||
BrowserLoadURL();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function URLBarFocusHandler()
|
||||
{
|
||||
gURLBar.showHistoryPopup();
|
||||
}
|
||||
|
||||
function URLBarClickHandler()
|
||||
{
|
||||
}
|
||||
|
||||
function BrowserToogleSSR()
|
||||
{
|
||||
if(!gSSRSupport)
|
||||
gSSRSupport = Components.classes["@mozilla.org/ssr;1"].getService(Components.interfaces.nsISSRSupport);
|
||||
|
||||
gSSRSupport.SSREnabled = !gSSRSupport.SSREnabled;
|
||||
|
||||
BrowserReload(); // hack until this is done by ssr itself
|
||||
}
|
||||
|
||||
function BrowserToogleSiteSSR()
|
||||
{
|
||||
if(!gSSRSupport)
|
||||
gSSRSupport = Components.classes["@mozilla.org/ssr;1"].getService(Components.interfaces.nsISSRSupport);
|
||||
|
||||
gSSRSupport.siteSSREnabled = !gSSRSupport.siteSSREnabled;
|
||||
|
||||
BrowserReload(); // hack until this is done by ssr itself
|
||||
}
|
||||
|
|
|
@ -61,6 +61,10 @@
|
|||
|
||||
<script type="application/x-javascript" src="chrome://minimo/content/minimo.js"/>
|
||||
|
||||
<popupset id="mainPopupSet">
|
||||
<popup type="autocomplete" id="PopupAutoComplete"/>
|
||||
</popupset>
|
||||
|
||||
<toolbox>
|
||||
|
||||
<!-- command definitions -->
|
||||
|
@ -68,6 +72,8 @@
|
|||
<!-- we shall enable all the command="cmd_commandName" for each Menu Item -->
|
||||
<!-- so far, the -->
|
||||
<command id="cmd_BrowserOpenTab" oncommand="BrowserOpenTab()"/>
|
||||
<command id="cmd_BrowserSSR" oncommand="BrowserToogleSSR()"/>
|
||||
<command id="cmd_BrowserSiteSSR" oncommand="BrowserToogleSiteSSR()"/>
|
||||
<command id="cmd_BrowserOpenInfo" oncommand="BrowserOpenInfo()"/>
|
||||
<command id="cmd_BrowserTestDialogs" oncommand="BrowserTestDialogs()"/>
|
||||
<command id="cmd_BrowserTestSendSMS" oncommand="BrowserTestSendSMS()"/>
|
||||
|
@ -76,7 +82,15 @@
|
|||
<menubar class="chromeclass-menubar">
|
||||
<menu id="menu-button" >
|
||||
<menupopup>
|
||||
<menuitem id="command_BrowserOpenTab" command="cmd_BrowserOpenTab" label="new Tab" />
|
||||
<menuitem id="command_BrowserOpenTab" command="cmd_BrowserOpenTab" label="New Tab" />
|
||||
|
||||
<menu id="SSR" label="SSR">
|
||||
<menupopup >
|
||||
<menuitem id="command_BrowserSSR" type="checkbox" command="cmd_BrowserSSR" label="Toggle SSR" />
|
||||
<menuitem id="command_BrowserSiteSSR" type="checkbox" command="cmd_BrowserSiteSSR" label="Toggle Site SSR"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="menu-zoom" label="Text zoom">
|
||||
<menupopup >
|
||||
<menuitem id="" oncommand="BrowserResetZoomPlus()" label="ZOOM + " />
|
||||
|
@ -95,14 +109,36 @@
|
|||
<toolbarbutton id="back-button" onclick="BrowserBack()"/>
|
||||
<toolbarbutton id="forward-button" onclick="BrowserForward()"/>
|
||||
<toolbarbutton id="reload-stop-button" class="reload-button" onclick="BrowserReload()"/>
|
||||
<textbox id="urlbar" flex="100%" onkeypress="if( event.keyCode == 13 ) { BrowserLoadURL(); }"/>
|
||||
|
||||
|
||||
<textbox id="urlbar" flex="100%" onkeypress="if(event.keyCode == 13 ) { BrowserLoadURL(); }"/>
|
||||
<!--
|
||||
<textbox id="urlbar"
|
||||
flex="100%"
|
||||
type="autocomplete"
|
||||
enablehistory="true"
|
||||
autocompletesearch="history"
|
||||
completeselectedindex="true"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
onfocus="URLBarFocusHandler();"
|
||||
ontextentered="return URLBarEntered();"/>
|
||||
-->
|
||||
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
||||
<hbox flex="1" >
|
||||
<hbox id="appcontent" flex="100%">
|
||||
<hbox id="browser" context="context" flex="1">
|
||||
<tabbrowser contentcontextmenu="contentAreaContextMenu" context="context" type="content-primary" id="content" src="about:blank" flex="1" onclick="tabbrowserAreaClick(event)" onnewtab="BrowserOpenTab()"/>
|
||||
<tabbrowser contentcontextmenu="contentAreaContextMenu"
|
||||
context="context"
|
||||
type="content-primary"
|
||||
id="content"
|
||||
src="about:blank"
|
||||
flex="1"
|
||||
autocompletepopup="PopupAutoComplete"
|
||||
onclick="tabbrowserAreaClick(event)"
|
||||
onnewtab="BrowserOpenTab()"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</hbox>
|
||||
|
|
|
@ -42,4 +42,37 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE_NAME = ssr
|
||||
MODULE = ssr
|
||||
LIBRARY_NAME = ssr
|
||||
|
||||
IS_COMPONENT = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
dom \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
necko \
|
||||
windowwatcher \
|
||||
xpcom \
|
||||
string \
|
||||
pref \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = nsSSRSupport.cpp
|
||||
XPIDLSRCS = nsISSRSupport.idl
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
|
||||
|
||||
EXPORT_RESOURCE = \
|
||||
$(srcdir)/smallScreen.css \
|
||||
$(srcdir)/sites.css \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs:: $(EXPORT_RESOURCE)
|
||||
$(INSTALL) $^ $(DIST)/bin/res
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is SSR
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@meer.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "string.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsISSRSupport.h"
|
||||
#include "nsIStyleSheetService.h"
|
||||
|
||||
|
||||
// TODO make the SSR persistent.
|
||||
// auto reload SSR in C.
|
||||
|
||||
class nsSSRSupport : public nsISSRSupport
|
||||
{
|
||||
public:
|
||||
nsSSRSupport();
|
||||
virtual ~nsSSRSupport();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISSRSUPPORT
|
||||
|
||||
nsCOMPtr<nsIStyleSheetService> m_sss;
|
||||
|
||||
PRBool mUsingSSR;
|
||||
PRBool mUsingSiteSSR;
|
||||
};
|
||||
|
||||
nsSSRSupport::nsSSRSupport()
|
||||
: mUsingSiteSSR(PR_FALSE), mUsingSSR(PR_FALSE)
|
||||
{
|
||||
m_sss = do_GetService("@mozilla.org/content/style-sheet-service;1");
|
||||
}
|
||||
|
||||
nsSSRSupport::~nsSSRSupport()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsSSRSupport, nsISSRSupport)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSSRSupport::GetSSREnabled(PRBool *aSsrEnabled)
|
||||
{
|
||||
*aSsrEnabled = mUsingSSR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSSRSupport::SetSSREnabled(PRBool aSsrEnabled)
|
||||
{
|
||||
if (!m_sss)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("resource://gre/res/smallScreen.css"));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (aSsrEnabled)
|
||||
return m_sss->LoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
|
||||
return m_sss->UnregisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSSRSupport::GetSiteSSREnabled(PRBool *aSiteSSREnabled)
|
||||
{
|
||||
*aSiteSSREnabled = mUsingSiteSSR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSSRSupport::SetSiteSSREnabled(PRBool aSiteSSREnabled)
|
||||
{
|
||||
if (!m_sss)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("resource://gre/res/sites.css"));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (aSiteSSREnabled)
|
||||
return m_sss->LoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
|
||||
return m_sss->UnregisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// XPCOM REGISTRATION BELOW
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define SSRSupport_CID \
|
||||
{ 0x3dc8b3d0, 0xeaff, 0x4904, \
|
||||
{0x8e, 0x80, 0x99, 0xf8, 0x26, 0x62, 0x96, 0x3a} }
|
||||
|
||||
#define SSRSupport_ContractID "@mozilla.org/ssr;1"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSSRSupport)
|
||||
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "SoftKeyBoardService",
|
||||
SSRSupport_CID,
|
||||
SSRSupport_ContractID,
|
||||
nsSSRSupportConstructor,
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(SSRModule, components)
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
@-moz-document domain(maps.google.com)
|
||||
{
|
||||
div#rhs { display: none ! important;}
|
||||
|
||||
div#map { height: 80%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: inherit;
|
||||
}
|
||||
}
|
||||
|
|
@ -71,14 +71,20 @@ img[src*="spacer"] {
|
|||
}
|
||||
|
||||
|
||||
/* google maps hack */
|
||||
@-moz-document domain(maps.google.com)
|
||||
{
|
||||
div#rhs { display: none ! important;}
|
||||
*:focus
|
||||
{
|
||||
-moz-outline: 3px solid #FFFF00 !important;
|
||||
-moz-outline-offset: 1px !important;
|
||||
-moz-outline-radius: 3px !important;
|
||||
}
|
||||
|
||||
div#map { height: 80%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: inherit;
|
||||
}
|
||||
}
|
||||
textarea:focus, button:focus, select:focus, input:focus
|
||||
{
|
||||
-moz-outline-offset: -1px !important;
|
||||
}
|
||||
|
||||
input[type="radio"]:focus
|
||||
{
|
||||
-moz-outline-radius: 8px !important;
|
||||
-moz-outline-offset: 0px !important;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче