Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/88e0cac06a4c4f1ccc274...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/88e0cac06a4c4f1ccc2744e...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/88e0cac06a4c4f1ccc2744ebb...
The branch, mono/spidermonkey-1.70-support has been updated
discards c741fe5c5deac57ca3ee5abc6e1b576c29d596fe (commit)
discards c867d7f71a52b67def795b26f6e875ac468b32b6 (commit)
discards f9b6d3ced41b07258ced3fa28da9a19ce8fca85c (commit)
discards f920d9eb3c2002febf80ce5ce661b451471e35bc (commit)
discards 1a80e32a478b68b63ca90a4544fa65ff0bbee60f (commit)
discards 67eb5d25b5c9d311cec3dd89fe26c605da30a60c (commit)
discards 84b291980859458f787f2c21585af229567dcc90 (commit)
discards 2b8ab33ee2153d1db938f72c238b91791f41a04c (commit)
discards 6acd23e3cc457101703f90f7b7dae108aff00b2e (commit)
discards 010d45c5a2f0a62737dc4513761f084d367c9ff2 (commit)
discards 12ad11301182e97ca929636da379822a363e5580 (commit)
via 88e0cac06a4c4f1ccc2744ebb8545fabc86e78fe (commit)
via 78b0c04cf2b2e27f433cee72f6cc0c8501076b21 (commit)
via 6a65c9a3bde50161e650c16d33bb0925c41b4b8d (commit)
via 1feac6c12d011487bd9df347a0e79214c6fe2f75 (commit)
via d3acfd8cd7fc0e43a9ae2677b9a7acead60107ef (commit)
via f9683adff13c4422f0d8b76ff73b9333d13013df (commit)
via a93b5b6b6dbbd101a33764a4977d61043877ddc9 (commit)
via 8b387ed07efd40958d7747a8d9858a02392b4225 (commit)
via 2b5b221a254ce05a63ef8b11e194554920de413a (commit)
via 7b868e4287591671163efafbe46c61f5ae9ac249 (commit)
via 1c1ac7f5a170a080f0967cd25d2f6b3a4d8b8635 (commit)
via 607c06c96d0215f383d271afa92e1cfbeb4f50c7 (commit)
via d97eb2f52054e8f77adb16d2a8afbf5fd0e576a1 (commit)
via 836c13f87d792f074c6c5ad7a3da3fa8f7237175 (commit)
via bae65c18a907cd43ad21dc30c2dfa8f0f003eec7 (commit)
via 10e5597a946bc76a52b761d7652805aa89409a21 (commit)
via 2988193e44c183542a8f7cf52dc63f76ec3c5249 (commit)
via c5a84e17f78ff82d98af155c9d075e7b0f4978cf (commit)
via ff2f1f1836f4a3b33bbfaafbb2bbdc2c1dba4d63 (commit)
via e237ebac8f6cca443a52966de74934d98096be1f (commit)
via e85284d7d15f8f64dc8074e57526ef100a9793bf (commit)
via 887a2ca18638755f74594913b7e07ac41b27e8a6 (commit)
via c67187079e034ad2a0fe41521b9068f02a6f103d (commit)
via 654609887678aef9b62ba62b6427de0b9fc9bdb2 (commit)
via bc8fee46f73307aba2f567ec1e35bd187b706eb8 (commit)
via 4357f5e9d72b0f4efe939e02a7012fc60d43095d (commit)
via 37d148f4d790cdfb756ea6348a15da8c3d75fdff (commit)
via 311953f453d2c32ba792e8676e944a9795f5a9c9 (commit)
via 32c4fdeead33e9106343f91d76072d00b47565e3 (commit)
via 792e8881696147755dfae2a38364061926404706 (commit)
via 7604b76161b16d11a4d70859a03a1c40d415a7ce (commit)
via 29356734eb6d537d606a5f00c040b3619d061519 (commit)
via 920c8b390e2c7473bf9dd1adb4daa6fce77fcd3c (commit)
via 5787323b2c37615a5d2805d6ee0b5aebf40a77bc (commit)
via 153c4444543411b00fc8682bd38d6e1758a63082 (commit)
via d489908af8cda59c94ad2375e1340bad6957e64a (commit)
via d307a854fc7fc4a0961cf3bc0bb43df503a0d9b1 (commit)
via 8984bf9647e107ee5b89323cf7c48cf06fec8793 (commit)
via 892aee8070750372c9b0c9e4b34f8a75f04ebd98 (commit)
via 02afe314afdfa3e795117e2ade21969ad9fb9992 (commit)
via bc6087f9b60496c30c1dad488a13fd35994a69c0 (commit)
via d43ac4760231635960b331a7590059e55de0688c (commit)
via afdf72d7b58110b2848ed9be6b8c15cc45b59891 (commit)
via 7ffe9c2b5d85057876252896219f712663f9a6fc (commit)
via 1086fc5246d0bec95228437cf2a2eabf84a3f5b3 (commit)
via f0392b0790cae721ee50c8de75ef1308c34dbeb5 (commit)
via cd28d4179523d388361fec7a17cef3333df6a81f (commit)
via d76e7db6fef96598713de096782468f042d519db (commit)
via 634b8f642e10dbb3c2c08281cea5170cf50ed785 (commit)
via 3b631f473b46ab226d247b365a33187febec6c60 (commit)
via f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd (commit)
via 45736594a173d7a715b217a5236e33fb89c95436 (commit)
via b1342796448c01515d8dcb4d992f804a5f2f4fb4 (commit)
via 74a9ec6de4e4180a1279633de6a4611e57ef2995 (commit)
via 9a0a2ff90fdc7d031b80a8b3bb18a648336f9a0a (commit)
via f478ee4db70f36b4a3231832ff5bdfcc98c60c7e (commit)
via d9799299f8c639a65bf317e299e49c0eb5539398 (commit)
via dd6d24e83dca2f47558193ae77a8de368eae338a (commit)
via 2b9a8d13c88a621cc094689082f48d1299ce9590 (commit)
via e461d9879b6859c6ca34b3512412f2dee3d36f4d (commit)
via 7a9027092726bc226b887a2d2106021cf4ec5930 (commit)
via d4ca800268987eb04e93f5fca6fb22a4e71ab416 (commit)
via 4581375209bbba2687bf6a1f42af4cc7e677652c (commit)
via 9202c137b252456ddee91fdc28eff99cf6107ea1 (commit)
via 8fc0eab89b2424a2d44b40cce9d051316c8b9cd9 (commit)
via 014fb9db8dab9c5e93ce949318e430edbf6fd8f5 (commit)
via a11de47b644d88dc5951f82b3f4bec589b7da3ff (commit)
via daf10f00a6c19ac279f53190bfaa39d04772809a (commit)
via 400ce416234e37889e2f2410f86d115373f39c82 (commit)
via 854e5560415063226499d018af9146a238d49ab8 (commit)
via 2d6da52f38ea078b0d67eb262e2507ee83902f6d (commit)
via 6219ee7b24326322c1522926d25b7054b594c791 (commit)
via 9a82677312778c13d01bc832b329a9de7b8660a9 (commit)
via edef40bbc432c092b1e5f4f6f5d408180ba188b3 (commit)
via 971058cd67f738e4d64d1bbce234fa9340cb2668 (commit)
via 427fb928c56988fcacfae87ba45ece8fc8e5f2c5 (commit)
via d2a1c8506318208b7e7962332567d3285c54d01f (commit)
via a4f796e217373daa0498b85ed8f231d1a194daa4 (commit)
via 7d4af30468b3d217f6a9ba2c01483329db94a367 (commit)
via a39082585ae833a6cabd864038e9926ac765e850 (commit)
via ea2b556047b9929a9013c3fb534a600b7f0fc691 (commit)
via 4985b56b68192b91d406698976a7a922f556ea09 (commit)
via 57d2e31e591b97106f9c66ce54c96bc094208a54 (commit)
via 762cade3622a4295c7209307a4626773bd6bc7c0 (commit)
via 081976105ad13c74c340034de6229eb9bdafcb7b (commit)
via 1c40d8a58c7ed07424f58b11392bc9ecadee7cbe (commit)
via 47db5546c5ea409703d9dfe885808647e89f917e (commit)
via d878ea4fb91143941ed84a9d300e4bb34731e41f (commit)
via 65e825c0c5d10820e66a7907ceb64afaae1e533d (commit)
via 908d5655d23aad62947910993cb2fe6ab431b1d7 (commit)
via c4b284e43c1aad1d825152de89ab2894df1fac3f (commit)
via 5a2d4c6ddbb61c53cee48c721f9f21f111db219b (commit)
via 45755a9e0d991a116f2d53a0e178a4e3dc5d06e6 (commit)
via a2906b39943dc078654f2f1dc5d122221d826d9a (commit)
via 19d2a0c01185451d2e2903f116f792e591b8ff5f (commit)
via 8e4819e450f5922cde793477c634df9c82c21fb6 (commit)
via b122d0be7b97ba0630559f48a6b85eeb1a757983 (commit)
via 45e536d9618c7a8a835c85ffb884f734b67e8511 (commit)
via 9867da4935093007a63818a0125ad522753d13a6 (commit)
via eb35a576c1b5845d4aa6b2b77d8039f49f048edc (commit)
via 6d39b569c700ddfa405c5c9a7a49320be2945997 (commit)
via be00425776514fccddd79d69caa8ed01dc172779 (commit)
via 22368db2325bf25d597023f34399b51c59cdfc2e (commit)
via fc0f732dec6a89e4c169bee222ee50daf33c7acd (commit)
via fb6186484e105ae3041ec630c06dc71cb8bd4190 (commit)
via 8e315f9f8fceb6cc847fddd30095c2460b7cd637 (commit)
via 142a0bf859b70a2b278b007aac99a5ab0811a956 (commit)
via e177fa49c29ca05f5b2498f286f78da6545f8278 (commit)
via 402de7572d76686dd65a5ee71274a690a421cc8f (commit)
via a548275fa238870075fc3c9a5076a731d3d11a9e (commit)
via 317a1dd92326e5bd189d529e395f5d6917d6bbab (commit)
via d9bd357802795ba3b30d280bafe2c66daa44be54 (commit)
via 35fd2ad7f2f2a62624f1445e352c0aaf6ac0b0ac (commit)
via cb9781e057c4da81f014de9a5a560dd80e5543d1 (commit)
via f04845b2cf3aaa6b15dbaa2acaa20197075d3234 (commit)
via 1919c8e07168859cc6362c5283d47d0ced3a9bc2 (commit)
via 049d5097b8d625fc19f86cb9fb836de9a164b56b (commit)
via 27b65235e99dfd76ac4aaa8a5f35f7124c7211f7 (commit)
via fd3aadf8fa99974eba6d239c7d73bdd45c13e491 (commit)
via 1e52aac5161396dbcdbd44b52c23fae67c213f94 (commit)
via d8872b6bab6cbe551d51fd9d795d2123572c2a16 (commit)
via 6daf6c178df8d0b61cc9d7a43a646d5dd43bbab0 (commit)
via 195a77a4cd5a0dde92821795caf362b1fef3729b (commit)
via c1be4c9e778370bba2c66f54de048c61d9fdffe7 (commit)
via 7277ce5dfc981394047bb865ceaf3a37fc33ccd6 (commit)
via 83c8e940f80368771eb499f8fbea6abafe04cd67 (commit)
via 02d5589dfab86f13b1fc93ae32c52540d0c97f80 (commit)
via 3e00973521c4bf641742e44cab52d33ae919a8b0 (commit)
via a736775bbd5dbea26e84bc5fc98d35dea412494c (commit)
via 699173331bb65505a67610b44ea9bef8ab5cfb33 (commit)
via 4872bc30b8e20a8da9e822725066cc6a5f7955e1 (commit)
via 21caff6365147b74d3941b00bfcf5edf5f1b3139 (commit)
via d73f62aabc8dd31ceeed92c750cceeb934dc3cbf (commit)
via a1d315e3e4c7e6b1d7e4508b81e54ef9add2ff4b (commit)
via e5928ebd5f842dc5ae66543f628af0cede4397bd (commit)
via e5374cc042645cc03bccb37fea0730d88a5ae879 (commit)
via 5fb51a0fb76707e1b5dac4bbe04613d0396d7bc0 (commit)
via a3ef5c2c3c448f6ded44b4135a1a745721653230 (commit)
via fcb7143ecb0c1acedfb30d34931896dbefc660b1 (commit)
via c3f9e3d3cea7bddb708fb0c75d9b4ed31e6341d7 (commit)
via 5526d7e6f2e071a115359f6b9c0dca7b2c4c4efe (commit)
via b51816c222dded2095fc2d5c1581575540095f43 (commit)
via 119b5cca3f7e61e96bd62477d3ab40d3deeed64b (commit)
via 19b3876ff27b5dfb48c9694721e528827742e654 (commit)
via d09dc4431045df534fd909ade462b9d7c6b8b135 (commit)
via 5810d131d5b28e448b8f9c707942f336f6113f5e (commit)
via 8c12ecd5cd167c298d8c8097cc2d4b7a988db499 (commit)
via 41e12953dcbc05fd69304415ba7d6357642739fe (commit)
via cc6c3a7c707878cbb0598476c1f8185d6a2557d5 (commit)
via 4aa913cd1840f891a6b7592a35f8bf2633793028 (commit)
via 3f9565753f4c7d658ea2d9f3d4f6ea1223e2e73e (commit)
via 4d6ada8c9afbc3aed902e4fb1f7ac93b95d2b30c (commit)
via 86f3e70f1af9130c2f24638fd560804ccb736af8 (commit)
via e9b036a794fc0b7b453581c4c3e017176213df6c (commit)
via 4c945bd16fa496b622cac73790272ea327848718 (commit)
via f58b5924a54fbef69de33dbb0340d1bf9f4fd237 (commit)
via 8e8c75cfe308e2fff277fbb3043fa850211f79b8 (commit)
via b6c149f3d68c6ae179b0f7917b0e7b85bf29aae5 (commit)
via c8a83bf1b41b9588225769f56fd4b4e5b8330c2c (commit)
via d106091d6e5df26a83460ae484c31753b873368c (commit)
via 68947c377ed358db310b32ee241db375e0b51de4 (commit)
via 986bc5ff8332d39629f65177cc8232c5ec7c8791 (commit)
via 76583d63ecccd3e37e6b3a33330caa2fb71dce4d (commit)
via de982b4d3e9c7e6b6f100e383d647f0edc9321a3 (commit)
via 786a5186aa38897170317d453bf49b55cf8e70a3 (commit)
via ee4346c26ef98af4bc60796a337d332665602d79 (commit)
via 5ac9c7128ad67e3e678ca6709174b8f77bcc1875 (commit)
via c7766fddff000614de3e1467e39cdfb0301a022d (commit)
via 8b31fc0e7880fed1da176c996fdf5acd5b63d8fb (commit)
via 59784ba8528182089c77e710f5ff31b3c78d6dc1 (commit)
via 0210ef066b75da6ff2a91b5de9ad6d3f583548f2 (commit)
via 69ad5db2d111b2af153ad63926ae5549c5dadb77 (commit)
via d6b293001d67e71e751b1d54e4a9dc8529cd29d6 (commit)
via 642470fb74c4a3c9e5dd222a64a19da75b807537 (commit)
via 6aaf1065752b13896f71cb489e11388cb9c444d6 (commit)
via bc4401414b7c964544354a92795cff007b56064d (commit)
via ad1336ac45a993ce911036844a95807dbbda61f6 (commit)
via 3ed1339b3fc0f701417bbf0a618ed3bc6997f9fa (commit)
via 7c9ac8980f9af36df59654a0843cf8a72f47a2ec (commit)
via 2364d68367dcd6b901ec8d5e02a240ffc9b3acec (commit)
via eaa6183567b1c9b5726a77d30e885c8b299cae6e (commit)
via a0b344afe6069e77058d383d092ba773c6ecf32e (commit)
via c456153e902177da27d99fc3baca4fcd89f6de6c (commit)
via 53a379ea45a3dd497c5471acc692addfe3f5297e (commit)
via eee26ed867167ee70e96904de6d719c5ead7a39d (commit)
via bc5918ebbc01a4d5022c8b3b308af41318097c84 (commit)
via e4d2677c80985914b2b37efd5d0a70a1856741b2 (commit)
via d3b4a286f93d6d341d7b2f60ece83b3e31cf90ff (commit)
via 411fdc6186434382d0ffaa45a104ecce106c1b47 (commit)
via b0ca8175bb5bffaad44b3226ceebfd2d09894128 (commit)
via 78620910e89ce312525ab8f04ba5782e0aeaf440 (commit)
via 137bba297832fca352cf99a5fc0251ba3e251d91 (commit)
via ad5db89b499d4737b8d6cc20d1e1dcf1efcb6440 (commit)
via 2eef2a22647a9ea1501c6eb6897afc3c31d33c4f (commit)
via 56967bbf0657fb52605f17cb56de595a3e6cf159 (commit)
via 0ace9f5e0b0b1ec56bdf2dfe128b5a0b1e3fe4d1 (commit)
via 8304a01b6f5c7bd46da54a99999799c6ff509f6e (commit)
via 34c79b454ac37148d3bfce25874ef0a942d806aa (commit)
via 126141a52ccece200d3a5629f4505935e3175184 (commit)
via 1547aebdbb228fd5cc71145b6f7b0d437f1b038b (commit)
via 61c268269aa5b91d03793c0a5906e9cb2ad91766 (commit)
via 67488450424a7a8be38c2e007c6d0e94e6c0834b (commit)
via b9446a3abb87d0b1999756e2132837b30c51cc97 (commit)
via 3ba621759c4fb20dc35724414cb59c665686d418 (commit)
via 2eeb2c07bfe836b66ad3804b5c5a373c65674e59 (commit)
via 0d8aca4f125e9376444a9d4a1db729b99bf6cbea (commit)
via dd7935bb1f8f4437f47a1ebb097afd4c262e107f (commit)
via 391d483c9ded316cd3c40b77d37eb5ed021cd250 (commit)
via 9fac1daff4a99714ab95ff076ee7891b86bfc5e4 (commit)
via a262507b3aa67ca8af1b754646d0835b317a58d7 (commit)
via 0ce133099b7b4eff3b77cdabb164de0d406f5a62 (commit)
via 6ceb8ca9ebacc16a39e4ce93843df62e40e79bbf (commit)
via 8c6dab520d92b4149fd74c01f883bdc87245fd5c (commit)
via 1ef7336f22c5751f8dd35c60d2e34fe0f49af455 (commit)
via 6d602b103e317a2e69618681ae0216d541b7b7af (commit)
via b777549cc2ed940d65934eb34d4aedb0652037fa (commit)
via ff8d7d974c74e139f06791bef2aa85af22e0f122 (commit)
via b2514d5270ab2bdb0af3b7d976344a62c93bf213 (commit)
via 82c4ea7686747dbb202ceefd660b1a8574ed5669 (commit)
via a423eb712dc387b879f62826fd36325110470ec8 (commit)
via 25f1acb504ee7de4690fb83ba4a39a75c8539273 (commit)
via 59af85e0b50f7343fe7c867cdb8cb868d7aac58f (commit)
via 803970589b1a8516686481f6ef3b6456d46fceb2 (commit)
via 74e794d7a25db2c245120ce4d7b98fb6ff9e8d15 (commit)
via c359b9400b720f9ee175154a1ffa542b5ccc2d97 (commit)
via a46c5ae09f2a1fe048b0da5418cf9ed33f512166 (commit)
via 55c08431ee40a28589ff3278a51f61a6847b7f4e (commit)
via d577a48bb7cce5f88904e86499906ade86809d8a (commit)
via 337b0f6724144800b9d226e1f949642ec200b511 (commit)
via 34154ebb99c9ce199e6c9c9ed5993e017023c697 (commit)
via 1ceced6e673cd9e573bd1a0475fa8357296b3289 (commit)
via 5a055e3b05925a4b482ff2fc1e4d18d57825df59 (commit)
via 0f1685f131e3f4bdb4b679eeeb1f23a23990f06d (commit)
via 400d02bc24a5530baf03c019bb8451831d7463e0 (commit)
via eed37af7518fcb9a30d7bb4d1c5e6349a90f95bb (commit)
via dad8065f0a0f9a572983444b3f51d4cddca69ecc (commit)
via 6f647139778b86c00f77fa8b72807e4361530711 (commit)
via fce70264848a04683282da567e429b71b6666847 (commit)
via 5f8d9e25ab7d504b41dfdde7dc65878ef87692f8 (commit)
via da4968b8e0af30d0caaf2fcaed88f5d60a0fccdf (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (c741fe5c5deac57ca3ee5abc6e1b576c29d596fe)
\
N -- N -- N (88e0cac06a4c4f1ccc2744ebb8545fabc86e78fe)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/88e0cac06a4c4f1ccc2...
commit 88e0cac06a4c4f1ccc2744ebb8545fabc86e78fe
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fix compilation, waiting for proper solution.
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 52041dc..ac877c6 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -54,6 +54,7 @@
# define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
/* "this" JSObject getter */
+JSObject * js_ComputeThis(JSContext *cx, JSObject *thisp, void *argv);
#define JS_THIS_OBJECT(cx, vp) \
js_ComputeThis(cx, JSVAL_TO_OBJECT(vp[-1]), vp)
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/78b0c04cf2b2e27f433...
commit 78b0c04cf2b2e27f433cee72f6cc0c8501076b21
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added JS_THIS_OBJECT macro
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 815ac15..52041dc 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -53,6 +53,10 @@
/* return value setter */
# define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+/* "this" JSObject getter */
+#define JS_THIS_OBJECT(cx, vp) \
+ js_ComputeThis(cx, JSVAL_TO_OBJECT(vp[-1]), vp)
+
# endif
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/6a65c9a3bde50161e65...
commit 6a65c9a3bde50161e650c16d33bb0925c41b4b8d
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Revert "Added JS_THIS_OBJECT macro"
This reverts commit c28978992ab5a0368556a8885fb40a6abc81be97.
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index b7338d3..815ac15 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -53,9 +53,6 @@
/* return value setter */
# define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
-/* "this" JSObject getter */
-#define JS_THIS_OBJECT(cx, vp) js_ComputeThis(cx, JSVAL_TO_OBJECT(vp[-1]), vp)
-
# endif
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/1feac6c12d011487bd9...
commit 1feac6c12d011487bd9df347a0e79214c6fe2f75
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added JS_THIS_OBJECT macro
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 815ac15..b7338d3 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -53,6 +53,9 @@
/* return value setter */
# define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+/* "this" JSObject getter */
+#define JS_THIS_OBJECT(cx, vp) js_ComputeThis(cx, JSVAL_TO_OBJECT(vp[-1]), vp)
+
# endif
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/d3acfd8cd7fc0e43a9a...
commit d3acfd8cd7fc0e43a9ae2677b9a7acead60107ef
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fixed typo in JSString_to_char
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index ff63f21..815ac15 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -118,7 +118,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JS_StrictPropertyStub JS_PropertyStub
#define JSString_to_char(injsstring, outchar, outlen) \
-<<<<<<< HEAD
outchar = JS_GetStringBytes(injsstring); \
outlen = strlen(outchar)
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/f9683adff13c4422f0d...
commit f9683adff13c4422f0d8b76ff73b9333d13013df
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Free global object before recreation
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index d0ebbc9..ff63f21 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -102,6 +102,12 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
JSPrincipals *principals)
{
JSObject *global;
+ global = JS_GetGlobalObject(cx);
+ if (global != NULL) {
+ JS_RemoveRoot(cx, global);
+ JS_SetGlobalObject(cx, NULL);
+ JS_MaybeGC(cx);
+ }
global = JS_NewObject(cx, jsclass, NULL, NULL);
if (global == NULL) {
return NULL;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/a93b5b6b6dbbd101a33...
commit a93b5b6b6dbbd101a33764a4977d61043877ddc9
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Macro indent
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 454fd6a..d0ebbc9 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -38,22 +38,22 @@
# if JS_VERSION <= 170
# ifndef JSVERSION_LATEST
-# define JSVERSION_LATEST JS_VERSION
+# define JSVERSION_LATEST JS_VERSION
# endif
/* JSNative initializer macros */
-#define JS_FS(name, call, nargs, flags, extra) \
+# define JS_FS(name, call, nargs, flags, extra) \
{name, call, nargs, flags, extra}
-#define JS_FS_END JS_FS(NULL, NULL, 0, 0, 0)
+# define JS_FS_END JS_FS(NULL, NULL, 0, 0, 0)
/* return value getter */
-#define JS_RVAL(cx, jsrval) (jsrval)
+# define JS_RVAL(cx, jsrval) (jsrval)
/* return value setter */
-#define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+# define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
-#endif
+# endif
/* *CAUTION* these macros introduce and use jsthis and jsrval
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/8b387ed07efd40958d7...
commit 8b387ed07efd40958d7747a8d9858a02392b4225
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Added support macros for Spidermonkey <= 1.70
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index ae9c208..454fd6a 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -35,6 +35,27 @@
#include <string.h>
+# if JS_VERSION <= 170
+
+# ifndef JSVERSION_LATEST
+# define JSVERSION_LATEST JS_VERSION
+# endif
+
+/* JSNative initializer macros */
+#define JS_FS(name, call, nargs, flags, extra) \
+ {name, call, nargs, flags, extra}
+
+#define JS_FS_END JS_FS(NULL, NULL, 0, 0, 0)
+
+/* return value getter */
+#define JS_RVAL(cx, jsrval) (jsrval)
+
+/* return value setter */
+#define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+
+#endif
+
+
/* *CAUTION* these macros introduce and use jsthis and jsrval
* parameters, native function code should not conflict with these
*/
@@ -59,6 +80,7 @@
/* arguments */
#define JSAPI_ARGV(cx, vp) (vp)
+
/* proprty native calls */
#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
commitdiff
http://git.netsurf-browser.org/netsurf.git/commitdiff/2b5b221a254ce05a63e...
commit 2b5b221a254ce05a63ef8b11e194554920de413a
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fixed typo in JSString_to_char macro
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index c4c1ed0..ae9c208 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -90,6 +90,7 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JS_StrictPropertyStub JS_PropertyStub
#define JSString_to_char(injsstring, outchar, outlen) \
+<<<<<<< HEAD
outchar = JS_GetStringBytes(injsstring); \
outlen = strlen(outchar)
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
Makefile | 67 +---
Makefile.defaults | 25 +-
Makefile.resources | 19 -
Makefile.sources | 2 +-
amiga/Makefile.target | 49 +++
amiga/arexx.c | 2 +-
amiga/bitmap.c | 118 ++++++-
amiga/bitmap.h | 8 +-
amiga/clipboard.c | 51 ++--
amiga/context_menu.c | 64 ++---
amiga/dist/Install | 50 +++-
amiga/dist/Install.info | Bin 8892 -> 8892 bytes
amiga/dist/NetSurf.guide | 15 +-
amiga/dist/NetSurf.guide.info | Bin 6741 -> 6741 bytes
amiga/dist/Rexx.info | Bin 6206 -> 6206 bytes
amiga/dist/netsurf.readme | 6 +-
amiga/dist/netsurf.readme.info | Bin 6238 -> 6238 bytes
amiga/dt_anim.c | 7 +-
amiga/dt_picture.c | 1 -
amiga/dt_sound.c | 6 +-
amiga/file.c | 2 +-
amiga/font.c | 36 ++-
amiga/font.h | 2 +-
amiga/gui.c | 107 ++++---
amiga/gui.h | 3 +-
amiga/gui_options.c | 3 +-
amiga/history_local.c | 1 +
amiga/icon.c | 4 +-
amiga/menu.c | 4 +-
amiga/options.h | 9 +
amiga/{dist => pkg}/AutoInstall | 0
amiga/pkg/drawer.info | Bin 17208 -> 17208 bytes
amiga/plotters.c | 345 +++++++++++++-------
amiga/plotters.h | 3 +
amiga/plugin_hack.c | 15 +-
amiga/search.c | 17 +-
amiga/theme.c | 50 +---
amiga/tree.c | 7 +-
atari/Makefile.target | 115 +++++++-
atari/browser.c | 79 +++---
atari/browser_win.c | 19 +-
atari/ctxmenu.c | 39 +--
atari/ctxmenu.h | 18 +
atari/encoding.c | 18 +
atari/encoding.h | 18 +
atari/font.c | 18 +
atari/global_evnt.c | 1 +
atari/gui.c | 61 ++--
atari/options.h | 6 +-
atari/osspec.c | 22 ++
atari/plot/font_freetype.c | 273 +++++++++++-----
atari/plot/font_freetype.h | 2 +-
atari/plot/fontplot.c | 18 +
atari/redrawslots.h | 19 +
atari/save.h | 18 +
atari/schedule.h | 1 +
atari/search.c | 51 ++-
atari/search.h | 20 +-
atari/settings.c | 62 +++--
atari/toolbar.c | 1 +
beos/Makefile.target | 24 ++
beos/gui.cpp | 4 +-
beos/scaffolding.cpp | 12 +-
beos/window.cpp | 55 +---
cocoa/BookmarksController.m | 1 +
cocoa/BrowserView.m | 2 +-
cocoa/BrowserViewController.m | 2 +-
cocoa/FormSelectMenu.m | 1 +
cocoa/HistoryView.m | 2 +-
cocoa/Makefile.target | 12 +
cocoa/PreferencesWindowController.m | 2 +-
cocoa/SearchWindowController.m | 2 +-
cocoa/coordinates.h | 2 +-
cocoa/gui.m | 2 +-
cocoa/selection.m | 5 +-
content/content.c | 83 +++--
content/content.h | 51 +++-
content/content_protected.h | 7 +-
content/fetch.c | 19 +-
content/fetchers/data.c | 2 +-
content/fetchers/file.c | 121 ++++++--
css/select.c | 3 +-
desktop/browser.c | 162 ++++++++-
desktop/browser.h | 170 +---------
desktop/browser_private.h | 177 ++++++++++
desktop/frame_types.h | 1 -
desktop/frames.c | 78 +++--
desktop/frames.h | 6 +-
desktop/gui.h | 13 +-
desktop/mouse.h | 34 ++
desktop/scrollbar.c | 20 --
desktop/scrollbar.h | 2 -
desktop/search.c | 33 ++-
desktop/search.h | 38 +--
desktop/selection.c | 149 ++++++++-
desktop/selection.h | 12 +-
desktop/textinput.c | 2 +-
desktop/tree_url_node.h | 2 +
framebuffer/Makefile.target | 20 +-
framebuffer/clipboard.c | 5 +-
framebuffer/fbtk/event.c | 4 +-
framebuffer/font_freetype.c | 5 +-
framebuffer/gui.c | 3 +-
framebuffer/localhistory.c | 1 +
gtk/Makefile.target | 62 +++-
gtk/dialogs/options.c | 1 +
gtk/dialogs/source.c | 1 +
gtk/gui.c | 3 +-
gtk/plotters.c | 13 +-
gtk/scaffolding.c | 13 +-
gtk/search.c | 6 +-
gtk/selection.c | 9 +-
gtk/toolbar.c | 1 +
gtk/window.c | 3 +-
image/image_cache.c | 12 +-
image/jpeg.c | 14 +-
javascript/jsapi.h | 19 +-
javascript/jsapi/console.c | 3 +-
javascript/jsapi/document.c | 124 +-------
javascript/jsapi/element.c | 106 ++-----
javascript/jsapi/eventtarget.c | 14 +-
javascript/jsapi/htmldocument.c | 262 +++++++++++++++
javascript/jsapi/htmlelement.c | 230 +++++++++++++
javascript/{none.c => jsapi/jsclass.h} | 44 +--
javascript/jsapi/navigator.c | 5 +-
javascript/jsapi/node.c | 41 ++-
javascript/jsapi/window.c | 20 +-
monkey/Makefile.target | 19 +-
monkey/browser.c | 5 +-
render/box.c | 96 +-----
render/box.h | 7 +-
render/box_construct.c | 2 +-
render/box_normalise.c | 1 +
render/form.c | 182 +++++-----
render/form.h | 5 +-
render/html.c | 152 +++++++--
render/html.h | 1 +
render/html_interaction.c | 487 +++++++++++++--------------
render/html_internal.h | 4 +-
render/html_redraw.c | 5 +
render/html_script.c | 10 +-
render/search.c | 518 ++++++++++++++---------------
render/search.h | 15 +-
render/textinput.c | 42 ++-
render/textplain.c | 39 +--
riscos/Makefile.target | 25 ++-
riscos/dialog.c | 5 +-
riscos/gui.c | 13 +-
riscos/gui.h | 2 +-
riscos/history.c | 1 +
riscos/menus.c | 3 -
riscos/print.c | 1 +
riscos/save.c | 38 +--
riscos/search.c | 5 +-
riscos/textselection.c | 9 +-
riscos/window.c | 4 +-
test/js/doc-dom1.html | 14 +
test/js/doc-dom2.html | 12 +
test/js/index.html | 10 +-
utils/config.h | 6 +
utils/nsurl.c | 12 +-
utils/types.h | 5 +
utils/utils.h | 12 +
windows/Makefile.target | 25 ++-
windows/NetSurfInstaller.nsi | 94 ------
windows/about.c | 5 +-
windows/bitmap.c | 3 +
windows/download.c | 7 +-
windows/drawable.c | 4 +-
windows/findfile.c | 3 +
windows/font.c | 4 +
windows/gui.c | 6 +-
windows/localhistory.c | 4 +-
windows/main.c | 5 +-
windows/misc.c | 3 +
windows/plot.c | 20 +-
windows/prefs.c | 2 +
windows/res/installer.nsi | 133 ++++++++
{beos => windows}/res/internal.css | 0
{beos => windows}/res/netsurf.png | 0
{framebuffer => windows}/res/welcome.html | 0
windows/thumbnail.c | 2 +
183 files changed, 4003 insertions(+), 2419 deletions(-)
delete mode 100644 Makefile.resources
rename amiga/{dist => pkg}/AutoInstall (100%)
create mode 100644 desktop/browser_private.h
create mode 100644 javascript/jsapi/htmldocument.c
create mode 100644 javascript/jsapi/htmlelement.c
copy javascript/{none.c => jsapi/jsclass.h} (61%)
create mode 100644 test/js/doc-dom1.html
create mode 100644 test/js/doc-dom2.html
delete mode 100644 windows/NetSurfInstaller.nsi
create mode 100644 windows/res/installer.nsi
copy {beos => windows}/res/internal.css (100%)
copy {beos => windows}/res/netsurf.png (100%)
copy {framebuffer => windows}/res/welcome.html (100%)
diff --git a/.gitignore b/.gitignore
index 053a220..20a059f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ nsmonkey
nsdebug
Makefile.config
NetSurf.exe
+netsurf-installer.exe
NetSurf.app
NetSurf.dbg
NetSurf.dmg
diff --git a/Makefile b/Makefile
index 087fa69..da0d41e 100644
--- a/Makefile
+++ b/Makefile
@@ -187,10 +187,6 @@ ifeq ($(TARGET),riscos)
EXEEXT := ,ff8
endif
PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
- CCACHE := $(shell which ccache)
- ifneq ($(CCACHE),)
- CC := $(CCACHE) $(CC)
- endif
endif
else
ifeq ($(TARGET),beos)
@@ -267,8 +263,14 @@ else
endif
endif
-# Target paths
+# CCACHE
+ifeq ($(origin CCACHE),undefined)
+ CCACHE=$(word 1,$(shell ccache -V 2>/dev/null))
+endif
+CC := $(CCACHE) $(CC)
+
+# Target paths
OBJROOT = build-$(HOST)-$(TARGET)$(SUBTARGET)
DEPROOT := $(OBJROOT)/deps
TOOLROOT := $(OBJROOT)/tools
@@ -631,61 +633,14 @@ $(eval $(foreach SOURCE,$(filter %.m,$(SOURCES)), \
$(eval $(foreach SOURCE,$(filter %.s,$(SOURCES)), \
$(call compile_target_s,$(SOURCE),$(subst /,_,$(SOURCE:.s=.o)),$(subst
/,_,$(SOURCE:.s=.d)))))
-.PHONY: all clean docs install install-gtk
+.PHONY: all clean docs install package-$(TARGET) package install-$(TARGET)
clean: $(CLEANS)
-install-gtk: nsgtk
- mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber
- mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)icons
- mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
- @cp nsgtk $(DESTDIR)$(NETSURF_GTK_BIN)netsurf
- @cp -RL gtk/res/adblock.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/arrow_down_8x32.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/ca-bundle.txt $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/default.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/default.ico $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/favicon.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/gtkdefault.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/icons/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/internal.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/languages $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/license $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/netsurf.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/netsurf.xpm $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/netsurf-16x16.xpm $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/quirks.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/themelist $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/throbber/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber
- @cp -RL gtk/res/toolbarIndices $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @cp -RL gtk/res/SearchEngines $(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @tar cf - --exclude .svn -C gtk/res themes | tar xf - -C
$(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @# Install translations
- @tar cf - --exclude .svn -C gtk/res C de en fr it nl | tar xf - -C
$(DESTDIR)$(NETSURF_GTK_RESOURCES)
- @# Install glade templates
- @cp -v gtk/res/*.gtk*.ui $(DESTDIR)$(NETSURF_GTK_RESOURCES)
-
-install-beos: NetSurf
-# TODO:HAIKU -- not sure if throbber is needed. being left out for now.
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_BIN)
- mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
-# mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber
- @copyattr -d NetSurf $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
- @cp -vRL beos/res/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL beos/res/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL beos/res/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL beos/res/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
- @cp -vRL gtk/res/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
-# @cp -vRL beos/res/throbber/*.png $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber
- gzip -9v < beos/res/messages > $(DESTDIR)$(NETSURF_BEOS_RESOURCES)messages
-
-
-install-framebuffer: $(EXETARGET)
- mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
- mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
- @cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf$(SUBTARGET)
- @for F in default.css messages; do cp -vL framebuffer/res/$$F
$(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
+# Target builds a distribution package
+package: all-program package-$(TARGET)
+# Target installs executable on the host system
install: all-program install-$(TARGET)
docs:
diff --git a/Makefile.defaults b/Makefile.defaults
index 1347956..8ee569c 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -288,9 +288,7 @@ ifeq ($(TARGET),framebuffer)
# Valid options: internal, freetype
NETSURF_FB_FONTLIB := internal
- # freetype compiled in font locations
- NETSURF_FB_FONTPATH :=
/usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts
-
+ # Default freetype font files
NETSURF_FB_FONT_SANS_SERIF := DejaVuSans.ttf
NETSURF_FB_FONT_SANS_SERIF_BOLD := DejaVuSans-Bold.ttf
NETSURF_FB_FONT_SANS_SERIF_ITALIC := DejaVuSans-Oblique.ttf
@@ -302,18 +300,19 @@ ifeq ($(TARGET),framebuffer)
NETSURF_FB_FONT_CURSIVE := Comic_Sans_MS.ttf
NETSURF_FB_FONT_FANTASY := Impact.ttf
- # Framebuffer frontends may have differing root paths for resources
- # As such, these specify the resource path and config path.
- NETSURF_FB_RESPATH_linux := $(PREFIX)/share/netsurf/
- NETSURF_FB_RESPATH_able := (tftpboot)/
- NETSURF_FB_RESPATH_dummy := ./
- NETSURF_FB_RESPATH_sdl := $(PREFIX)/share/netsurf/
- NETSURF_FB_RESPATH_x := $(PREFIX)/share/netsurf/
- NETSURF_FB_RESPATH_vnc := $(PREFIX)/share/netsurf/
-
- NETSURF_FRAMEBUFFER_RESOURCES = $(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))
+ # Default binary install path
NETSURF_FRAMEBUFFER_BIN := $(PREFIX)/bin/
+ # Default resource install path
+ NETSURF_FRAMEBUFFER_RESOURCES := $(PREFIX)/share/netsurf/
+
+ # Default framebuffer search path
+ NETSURF_FB_RESPATH :=
$${HOME}/.netsurf/:$${NETSURFRES}:$(NETSURF_FRAMEBUFFER_RESOURCES):./framebuffer/res
+
+ # freetype compiled in font serch path
+ NETSURF_FB_FONTPATH :=
/usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts
+
+
endif
# ----------------------------------------------------------------------------
diff --git a/Makefile.resources b/Makefile.resources
deleted file mode 100644
index 519499d..0000000
--- a/Makefile.resources
+++ /dev/null
@@ -1,19 +0,0 @@
-# Makefile for NetSurf's resources
-#
-# Copyright 2009 Daniel Silverstone <dsilvers(a)netsurf-browser.org>
-#
-#
-# This file provides the rules and setup for built-in resources for
-# the NetSurf browser binary.
-
-ifeq ($(TARGET),framebuffer)
-
-
-# End of framebuffer resource definitions
-endif
-
-ifeq ($(TARGET),windows)
-
-
-# End of windows resource definitions
-endif
diff --git a/Makefile.sources b/Makefile.sources
index f7f05ca..0229e91 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -31,7 +31,7 @@ S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
# Javascript sources
ifeq ($(NETSURF_USE_JS),YES)
-S_JSAPI = window.c document.c navigator.c console.c element.c
+S_JSAPI = window.c navigator.c console.c htmldocument.c htmlelement.c
S_JAVASCRIPT += content.c jsapi.c $(addprefix jsapi/,$(S_JSAPI))
else
S_JAVASCRIPT += none.c
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index f2d23bb..bb2b1c7 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -90,3 +90,52 @@ S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_AMIGA) $(S_PDF)
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-amiga:
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-amiga: netsurf.lha
+
+AMIGA_LANGUAGES := de en fr it ja nl
+AMIGA_PLATFORM_RESOURCES := Pointers Themes default.css default.css.info favicon.png
LangNames mimetypes Resource.map SearchEngines splash.png
+AMIGA_GENERIC_RESOURCES := $(AMIGA_LANGUAGES) ca-bundle
+AMIGA_RESOURCES := $(addprefix amiga/resources/,$(AMIGA_PLATFORM_RESOURCES)) $(addprefix
\!NetSurf/Resources/,$(AMIGA_GENERIC_RESOURCES))
+AMIGA_LIBRARIES := parserutils.library nsgif.library nsbmp.library iconv.library
hubbub.library
+AMIGA_LIBS := $(addprefix /Libs/,$(AMIGA_LIBRARIES))
+AMIGA_SHARED_OBJS := libjpeg.so.8 libxml2.so.9 libcurl.so.7 librtmp.so.0 libsvgtiny.so.0
libssl.so.1.0.0 libcrypto.so.1.0.0 libcss.so.0 libwapcaplet.so.0 libpng12.so libdom.so.0
libhubbub.so.0
+AMIGA_SOBJS := $(addprefix /SObjs/,$(AMIGA_SHARED_OBJS))
+AMIGA_DISTRIBUTION_FILES := amiga/dist/*
+AMIGA_INSTALL_TARGET_DIR := NetSurf_Amiga
+
+netsurf.lha: $(EXETARGET)
+ $(VQ)echo Creating netsurf.lha
+ $(Q)rm -rf $(AMIGA_INSTALL_TARGET_DIR)
+ $(Q)mkdir -p $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
+ $(Q)cp NetSurf $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
+ $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
+ $(Q)cp -r $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
+ $(Q)cp -r $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
+ $(Q)cp \!NetSurf/Resources/AdBlock,f79
$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
+ $(Q)cp \!NetSurf/Resources/CSS,f79
$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/nsdefault.css
+ $(Q)cp \!NetSurf/Resources/internal.css,f79
$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css
+ $(Q)cp \!NetSurf/Resources/Quirks,f79
$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css
+ $(Q)cp \!NetSurf/Resources/netsurf.png,b60
$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png
+ $(Q)cp amiga/pkg/fitr $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
+ $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info
+ $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR)
+ ifeq ($(HOST),amiga)
+ $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs
+ $(Q)cp $(AMIGA_LIBS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Libs
+ $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
+ $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
+ endif
+ $(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \
+ lha a netsurf.lha NetSurf NetSurf.info AutoInstall
+
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 4a24cb4..06e82ac 100755
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -24,7 +24,7 @@
#include "desktop/options.h"
#include "amiga/theme.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include <string.h>
#include <math.h>
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index ce665aa..ee15065 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2012 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -48,7 +48,7 @@
void *bitmap_create(int width, int height, unsigned int state)
{
struct bitmap *bitmap;
-
+
bitmap = AllocVec(sizeof(struct bitmap),MEMF_PRIVATE | MEMF_CLEAR);
if(bitmap)
{
@@ -62,6 +62,7 @@ void *bitmap_create(int width, int height, unsigned int state)
if(state & BITMAP_OPAQUE) bitmap->opaque = true;
else bitmap->opaque = false;
}
+
return bitmap;
}
@@ -117,9 +118,21 @@ void bitmap_destroy(void *bitmap)
if(bm)
{
- if(bm->nativebm) p96FreeBitMap(bm->nativebm);
+ if((bm->nativebm) && (bm->dto == NULL)) {
+ p96FreeBitMap(bm->nativebm);
+ }
+
+ if(bm->dto) {
+ DisposeDTObject(bm->dto);
+ }
+
+ if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
FreeVec(bm->pixdata);
bm->pixdata = NULL;
+ bm->nativebm = NULL;
+ bm->native_mask = NULL;
+ bm->dto = NULL;
+
FreeVec(bm);
bm = NULL;
}
@@ -160,8 +173,14 @@ bool bitmap_save(void *bitmap, const char *path, unsigned flags)
void bitmap_modified(void *bitmap) {
struct bitmap *bm = bitmap;
- p96FreeBitMap(bm->nativebm);
+ if((bm->nativebm) && (bm->dto == NULL))
+ p96FreeBitMap(bm->nativebm);
+
+ if(bm->dto) DisposeDTObject(bm->dto);
+ if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
bm->nativebm = NULL;
+ bm->dto = NULL;
+ bm->native_mask = NULL;
}
@@ -208,7 +227,7 @@ bool bitmap_test_opaque(void *bitmap)
for(a=0;a<p;a+=4)
{
- if ((*bmi & 0xff000000U) != 0xff000000U) return false;
+ if ((*bmi & 0x000000ffU) != 0x000000ffU) return false;
bmi++;
}
return true;
@@ -337,9 +356,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
return bm;
}
-
-
-struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct
BitMap *friendbm)
+static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int
height,struct BitMap *friendbm)
{
struct RenderInfo ri;
struct BitMap *tbm = NULL;
@@ -454,3 +471,88 @@ struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int
width,int height,s
return tbm;
}
+
+PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
+ int height, struct BitMap *n_bm)
+{
+ uint32 *bmi = (uint32 *) bitmap->pixdata;
+ UBYTE maskbit = 0;
+ ULONG bm_width;
+ int y, x, bpr;
+
+ if((height != bitmap->height) || (width != bitmap->width)) return NULL;
+ if(bitmap_get_opaque(bitmap) == true) return NULL;
+ if(bitmap->native_mask) return bitmap->native_mask;
+
+ bm_width = GetBitMapAttr(n_bm, BMA_WIDTH);
+ bpr = RASSIZE(bm_width, 1);
+ bitmap->native_mask = AllocRaster(bm_width, height);
+ SetMem(bitmap->native_mask, 0, bpr * height);
+
+ for(y=0; y<height; y++) {
+ for(x=0; x<width; x++) {
+ if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
+ else maskbit = 1;
+ bmi++;
+ bitmap->native_mask[(y*bpr) + (x/8)] |=
+ maskbit << (7 - (x % 8));
+ }
+ }
+
+ return bitmap->native_mask;
+}
+
+static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
+ int width, int height)
+{
+ struct BitMap *dtbm;
+
+ /* Dispose the DataTypes object if we've performed a layout already,
+ and we need to scale, as scaling can only be performed before
+ the first GM_LAYOUT */
+
+ if(bitmap->dto &&
+ ((bitmap->nativebmwidth != width) ||
+ (bitmap->nativebmheight != height))) {
+ DisposeDTObject(bitmap->dto);
+ bitmap->dto = NULL;
+ }
+
+ if(bitmap->dto == NULL) {
+ bitmap->dto = ami_datatype_object_from_bitmap(bitmap);
+
+ SetDTAttrs(bitmap->dto, NULL, NULL,
+ PDTA_Screen, scrn,
+ PDTA_ScaleQuality, nsoption_bool(scale_quality),
+ PDTA_DitherQuality, nsoption_int(dither_quality),
+ PDTA_FreeSourceBitMap, TRUE,
+ TAG_DONE);
+
+ if((bitmap->width != width) || (bitmap->height != height)) {
+ IDoMethod(bitmap->dto, PDTM_SCALE, width, height, 0);
+ }
+
+ if((DoDTMethod(bitmap->dto, 0, 0, DTM_PROCLAYOUT, 0, 1)) == 0)
+ return NULL;
+ }
+
+ GetDTAttrs(bitmap->dto,
+ PDTA_DestBitMap, &dtbm,
+ TAG_END);
+
+ bitmap->nativebmwidth = width;
+ bitmap->nativebmheight = height;
+
+ ami_bitmap_get_mask(bitmap, width, height, dtbm);
+ return dtbm;
+}
+
+struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
+ int width, int height, struct BitMap *friendbm)
+{
+ if(ami_plot_screen_is_palettemapped() == true) {
+ return ami_bitmap_get_palettemapped(bitmap, width, height);
+ } else {
+ return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);
+ }
+}
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index 41d488e..0fbfc52 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -35,12 +35,18 @@ struct bitmap {
struct BitMap *nativebm;
int nativebmwidth;
int nativebmheight;
+ PLANEPTR native_mask;
+ Object *dto;
char *url; /* temporary storage space */
char *title; /* temporary storage space */
ULONG *icondata; /* for appicons */
};
-struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct
BitMap *friendbm);
+struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
+ int width, int height, struct BitMap *friendbm);
+PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
+ int height, struct BitMap *n_bm);
+
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
#endif
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index b092650..8ecc4ef 100755
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -17,9 +17,9 @@
*/
#include "desktop/gui.h"
+#include "desktop/plotters.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
-#include "render/box.h"
#include "utils/utf8.h"
#include "amiga/bitmap.h"
@@ -47,11 +47,6 @@
struct IFFHandle *iffh = NULL;
-bool ami_add_to_clipboard(const char *text, size_t length, bool space);
-static bool ami_copy_selection(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text,
- size_t whitespace_length);
-
static LONG ami_clipboard_iffp_do_nothing(struct Hook *hook, void *object, LONG *cmd)
{
return 0;
@@ -245,7 +240,8 @@ bool gui_empty_clipboard(void)
return false;
}
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
/* This might crash or at least not work if gui_empty_clipboard isn't called first,
and gui_commit_clipboard after.
@@ -320,38 +316,34 @@ bool gui_copy_to_clipboard(struct selection *s)
struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin)
{
struct ami_text_selection *sel;
+ int len;
+ char *ss;
sel = AllocVec(sizeof(struct ami_text_selection),
MEMF_PRIVATE | MEMF_CLEAR);
- if(sel) selection_traverse(browser_window_get_selection(gwin->bw),
ami_copy_selection, sel);
-
- return sel;
-}
-
-static bool ami_copy_selection(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text,
- size_t whitespace_length)
-{
- struct ami_text_selection *sel = handle;
- int len = length;
+ if (sel) {
+ /* Get selection string */
+ ss = selection_get_copy(browser_window_get_selection(gwin->bw));
+ if (ss == NULL)
+ return sel;
- if((length + (sel->length)) > (sizeof(sel->text)))
- len = sizeof(sel->text) - (sel->length);
+ len = strlen(ss);
- if(len <= 0) return false;
+ if (len > sizeof(sel->text))
+ len = sizeof(sel->text) - 1;
- memcpy((sel->text) + (sel->length), text, len);
- sel->length += len;
+ memcpy(sel->text, ss, len);
+ sel->length = len;
+ sel->text[sel->length] = '\0';
- sel->text[sel->length] = '\0';
-
- return true;
+ free(ss);
+ }
+ return sel;
}
void ami_drag_selection(struct selection *s)
{
- struct box *text_box;
int x;
int y;
char *utf8text;
@@ -368,7 +360,7 @@ void ami_drag_selection(struct selection *s)
x = gwin->win->MouseX;
y = gwin->win->MouseY;
- if(text_box = ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
+ if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
{
iffh = ami_clipboard_init_internal(1);
@@ -418,7 +410,8 @@ void ami_drag_selection(struct selection *s)
bool ami_easy_clipboard(char *text)
{
if(!gui_empty_clipboard()) return false;
- if(!gui_add_to_clipboard(text,strlen(text),false)) return false;
+ if(!gui_add_to_clipboard(text,strlen(text),false,plot_style_font))
+ return false;
if(!gui_commit_clipboard()) return false;
return true;
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c3b9cf7..2e09c99 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -39,15 +39,14 @@
#include "amiga/theme.h"
#include "amiga/tree.h"
#include "amiga/utf8.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/hotlist.h"
#include "desktop/selection.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree_url_node.h"
-#include "render/box.h"
#include "render/form.h"
-#include "render/html.h"
#include "utils/utf8.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -124,6 +123,12 @@ enum {
CMID_LAST
};
+struct ami_file_input_menu_data {
+ int x;
+ int y;
+ struct browser_window *bw;
+};
+
struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
static char *ctxmenulab[CMID_LAST];
@@ -218,7 +223,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub,
void *userdat
* CMSUB_OBJECT - userdata = hlcache_object *
* CMSUB_SEL - userdata = browser_window *
* CMSUB_NAVIGATE - userdata = browser_window * (only for menu construction)
- * CMID_SELECTFILE - userdata = box *
+ * CMID_SELECTFILE - userdata = ami_file_input_menu_data *
*/
struct browser_window *bw = NULL;
@@ -582,7 +587,6 @@ BOOL ami_context_menu_mouse_trap(struct gui_window_2 *gwin, BOOL
trap)
void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
struct hlcache_handle *cc = gwin->bw->current_content;
- struct box *curbox;
int box_x=0;
int box_y=0;
bool no_more_menus = false;
@@ -649,30 +653,6 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
}
else
{
- if(content_get_type(cc) == CONTENT_HTML)
- {
- curbox = html_get_box_tree(gwin->bw->current_content);
-
- while(curbox = box_at_point(curbox, x, y, &box_x, &box_y, &cc))
- {
- if (curbox->style &&
- css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (curbox->gadget)
- {
- switch (curbox->gadget->type)
- {
- case GADGET_FILE:
- ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, curbox);
- menuhascontent = true;
- no_more_menus = true;
- break;
- }
- }
- }
- }
-
if(no_more_menus == false)
{
browser_window_get_contextual_content(gwin->bw, x, y, &ccdata);
@@ -698,6 +678,17 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
menuhascontent = true;
}
+ if(ccdata.form_features == CTX_FORM_FILE)
+ {
+ struct ami_file_input_menu_data file_input = {
+ .x = x,
+ .y = y,
+ .bw = gwin->bw
+ };
+ ami_context_menu_add_submenu(ctxmenuobj, CMID_SELECTFILE, &file_input);
+ menuhascontent = true;
+ }
+
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_NAVIGATE, gwin->bw);
menuhascontent = true;
@@ -741,7 +732,8 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object
*item,APTR reserved
ASLFR_DoSaveMode,FALSE,
TAG_DONE))
{
- struct box *box = userdata;
+ struct ami_file_input_menu_data
+ *file_input = userdata;
char *utf8_fn;
char fname[1024];
int x,y;
@@ -755,15 +747,11 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object
*item,APTR reserved
break;
}
- free(box->gadget->value);
- box->gadget->value = utf8_fn;
-
- box_coords(box, (int *)&x, (int *)&y);
- ami_do_redraw_limits(gwin->bw->window,
- gwin->bw->window->shared->bw,
- x,y,
- x + box->width,
- y + box->height);
+ browser_window_drop_file_at_point(
+ file_input->bw,
+ file_input->x,
+ file_input->y,
+ utf8_fn);
}
break;
diff --git a/amiga/dist/Install b/amiga/dist/Install
index c3d5af2..e794939 100755
--- a/amiga/dist/Install
+++ b/amiga/dist/Install
@@ -283,7 +283,7 @@
(if (= @default-dest "")
(
; Workaround for Installer bug picking TEXTCLIP: as a sensible location
- (if (= @default-dest "TextClip:") (set @default-dest
"SYS:Utilities"))
+ (if (= @default-dest "TextClip:") (set @default-dest
"SYS:Internet"))
(if (= @user-level 0)
(
@@ -297,7 +297,7 @@
(set @default-dest
(askdir
(prompt "Where would you like to install NetSurf?\n"
- "(a drawer will not be created)")
+ "(a drawer WILL NOT be created)")
(help @askdir-help)
(default @default-dest)
)
@@ -311,6 +311,9 @@
(set osver (/ osver 65536))
(set #versions-available 0)
+(set #static-filename "NetSurf-Static")
+(set #cairo-filename "NetSurf")
+
(if (exists "NetSurf-Static")
(
(set #static-name "Static/graphics.library")
@@ -322,11 +325,32 @@
)
)
-(if (AND (>= osver 53) (exists "NetSurf"))
+(if (exists "NetSurf")
(
- (set #cairo-name "Shared objects/part-Cairo")
- (set #versions-available (+ #versions-available 1))
- (set #cairo-version 1)
+ (if (exists "SObjs")
+ (
+ (if (>= osver 53)
+ (
+ (set #cairo-name "Shared objects/part-Cairo")
+ (set #versions-available (+ #versions-available 1))
+ (set #cairo-version 1)
+ )
+ ;else
+ (
+ (set #cairo-version 0)
+ (set #cairo-name "")
+ )
+ )
+ )
+ ;else
+ (
+ ; assume static if sobjs is not present
+ (set #static-name "Static/graphics.library")
+ (set #versions-available (+ #versions-available 1))
+ (set #cairo-version 0)
+ (set #static-filename "NetSurf")
+ )
+ )
)
; else
(
@@ -421,7 +445,7 @@
(complete 20)
-(set #netsurf-name (select #cairo-version "NetSurf-Static"
"NetSurf"))
+(set #netsurf-name (select #cairo-version #static-filename #cairo-filename))
(if (= #AutoInstall 0)
(
@@ -482,10 +506,14 @@
(set #complete 40)
(working "Copying Libraries")
-(foreach "Libs" "#?"
- (complete #complete)
- (p_copylib @each-name)
- (set #complete (+ #complete 2))
+(if (exists "Libs")
+ (
+ (foreach "Libs" "#?"
+ (complete #complete)
+ (p_copylib @each-name)
+ (set #complete (+ #complete 2))
+ )
+ )
)
(set #complete 60)
diff --git a/amiga/dist/Install.info b/amiga/dist/Install.info
index 477ee2e..944fcc6 100644
Binary files a/amiga/dist/Install.info and b/amiga/dist/Install.info differ
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index e1135f4..2287172 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -42,10 +42,15 @@ There are a couple of Amiga-specific options which can only be changed
directly
@{b}kiosk_mode@{ub} No gadgets
@{b}printer_unit@{ub} Specifies which printer.device unit to print to
@{b}drag_save_icons@{ub} Enables displaying Workbench-style transparent icons under the
pointer when performing drag saves (ctrl-drag of objects available if NetSurf is running
on the Workbench screen) and text selection drags. If set to 0 the pointer style will
change instead. OS 4.0 users may want to set this to 0 as icons will appear opaque and
obscure the drop position.
-@{b}cairo_renderer@{ub} Set rendering engine (SObjs version only). 0 = graphics.library,
1 = Cairo/graphics.library mixed (recommended), 2 = Full Cairo.
+@{b}cairo_renderer@{ub} Set rendering engine. -1 = palette-mapped (set automatically when
required), 0 = graphics.library, 1 = Cairo/graphics.library mixed (recommended), 2 = Full
Cairo.
@{b}monitor_aspect_x@{ub}/@{b}monitor_aspect_y@{ub} Correct aspect ratio for displays
(default of 0 means "assume square pixels").
@{b}screen_compositing@{ub} Use compositing on NetSurf's own screen. 0=disable,
1=enable, 2=default
@{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the
off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables
tiling (will use a bitmap at least the size of the screen NetSurf is running on)
+@{b}font_antialiasing@{ub} Switch text anti-aliasing on or off. Defaults to on in
true-colour modes, but text rendering performance can be improved by setting to 0.
+@{b}window_simple_refresh@{ub} If set to 1, NetSurf will use SimpleRefresh rather than
SmartRefresh windows. These have slower redraw but use less memory. Note that this
setting has no noticeable effect if compositing is enabled. Defaults to 0 (SmartRefresh)
+
+@{b}dithering_quality@{ub} Specify the dithering quality from all values supported by
picture.datatype. Currently these are 0=None, 1=Normal, 2=High quality. Other values are
undefined. This is only used when NetSurf is running in palette-mapped mode.
+@{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to
full transparency (0 - 255, where 255 will convert even opaque pixels to transparent).
Defaults to 50 (0x32). This is only used in palette-mapped modes where alpha blending is
not currently supported.
@{b}url_file@{ub} Path to URL database file
@{b}hotlist_file@{ub} Path to Hotlist file
@@ -69,11 +74,15 @@ If the font NetSurf is trying to use does not contain a specific
character used
For most users, installing and selecting @{"Code2000" rxs "address netsurf
'open
http://code2000.sf.net'"} or @{"Bitstream Cyberbit" rxs
"address netsurf 'open
http://ftp.netscape.com/pub/communicator/extras/fonts/windows/'"} is the best
option.
+Additional fall-back fonts can be provided since NetSurf 3.0. These need to go into
Users/user/Choices as a comma-separated list, for the font_unicode_list option.
+
+NB: Since NetSurf 3.0, NetSurf will scan the provided Unicode fonts, and the rest of the
system fonts, on first startup. Setting font_unicode_only:1 will prevent fonts not in the
preferred Unicode fonts list from being scanned or used as fallback fonts. If the system
fonts or NetSurf's fallback fonts list changes, this cache will need to be
re-generated. This can be forced by deleting the font glyph cache (which defaults to
Users/user/FontGlyphCache).
+
@{b}Font sizes@{ub}
The default and minimum font sizes can also be set.
NB: The resolution setting on the "Rendering" tab in NetSurf's preferences
affects how big text appears on screen (the conversion between point and pixel sizes)
amongst other things. To find the correct value, divide the number of pixels on the
screen vertically by the physical height of the screen in inches (horizontal resolution is
calculated automatically if NetSurf is running on a custom screen, square pixels are
assumed on all other screens).
-If the monitor is widescreen, monitor_aspect_x and monitor_aspect_y values in
Users/Default/Choices will also need modifying.
+If the monitor is widescreen, monitor_aspect_x and monitor_aspect_y values in
Users/Default/Choices may also need modifying.
@endnode
@node Themes
@@ -266,6 +275,8 @@ Deselect @{b}Higher quality scaling@{ub}, this will be very slow if
not done in
@{lindent 2}* In @{"Options" link Options}, set cairo_renderer:1@{lindent}
@{lindent 2}* In @{"Options" link Options}, increase redraw_tile_size_x/y
(increasing this value uses more graphics mem)@{lindent}
+
+@{lindent 2}* In @{"Options" link Options}, set font_antialiasing:0@{lindent}
@endnode
@node contact "Credits"
diff --git a/amiga/dist/NetSurf.guide.info b/amiga/dist/NetSurf.guide.info
index fedb27f..d6d529d 100644
Binary files a/amiga/dist/NetSurf.guide.info and b/amiga/dist/NetSurf.guide.info differ
diff --git a/amiga/dist/Rexx.info b/amiga/dist/Rexx.info
index 2cb1357..908b018 100644
Binary files a/amiga/dist/Rexx.info and b/amiga/dist/Rexx.info differ
diff --git a/amiga/dist/netsurf.readme b/amiga/dist/netsurf.readme
index 391e7c3..47a9381 100755
--- a/amiga/dist/netsurf.readme
+++ b/amiga/dist/netsurf.readme
@@ -2,13 +2,13 @@ Short: Fast CSS capable web browser
Uploader: chris(a)unsatisfactorysoftware.co.uk (Chris Young)
Author: NetSurf contributors (OS4 port by Chris Young)
Type: comm/www
-Version: 3.0 development (SVN 10866)
-Architecture: ppc-amigaos >= 4.1.0
+Version: 3.0 development
+Architecture: ppc-amigaos >= 4.0.0
Install manually with Installer script only -
INTENTIONALLY NOT AVAILABLE VIA AMIUPDATE
-This is a preview release of NetSurf 3.0 for AmigaOS 4.
+This is a test build of NetSurf 3.0 for AmigaOS 4.
It is beta software, which means it is unstable and missing
features - use at your own risk!
diff --git a/amiga/dist/netsurf.readme.info b/amiga/dist/netsurf.readme.info
index d6fb397..c0ee5ff 100644
Binary files a/amiga/dist/netsurf.readme.info and b/amiga/dist/netsurf.readme.info differ
diff --git a/amiga/dt_anim.c b/amiga/dt_anim.c
index d92bfae..9d79257 100644
--- a/amiga/dt_anim.c
+++ b/amiga/dt_anim.c
@@ -27,7 +27,6 @@
#include "content/content_protected.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
-#include "render/box.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
@@ -66,8 +65,7 @@ static bool amiga_dt_anim_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
static void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
static void amiga_dt_anim_close(struct content *c);
static nserror amiga_dt_anim_clone(const struct content *old, struct content **newc);
static content_type amiga_dt_anim_content_type(void);
@@ -285,8 +283,7 @@ bool amiga_dt_anim_redraw(struct content *c,
* \param params object parameters, or 0 if not an object
*/
void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params)
+ struct content *page, struct object_params *params)
{
LOG(("amiga_dt_anim_open"));
diff --git a/amiga/dt_picture.c b/amiga/dt_picture.c
index b6e0a91..0768479 100644
--- a/amiga/dt_picture.c
+++ b/amiga/dt_picture.c
@@ -27,7 +27,6 @@
#include "desktop/plotters.h"
#include "image/bitmap.h"
#include "image/image_cache.h"
-#include "render/box.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
diff --git a/amiga/dt_sound.c b/amiga/dt_sound.c
index 4b69402..d1e9771 100644
--- a/amiga/dt_sound.c
+++ b/amiga/dt_sound.c
@@ -53,8 +53,7 @@ static bool amiga_dt_sound_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
static void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
static nserror amiga_dt_sound_clone(const struct content *old, struct content **newc);
static content_type amiga_dt_sound_content_type(void);
@@ -216,8 +215,7 @@ bool amiga_dt_sound_redraw(struct content *c,
void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params)
+ struct content *page, struct object_params *params)
{
amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
struct object_param *param;
diff --git a/amiga/file.c b/amiga/file.c
index 126c4e3..c2e4f13 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -28,7 +28,7 @@
#include "content/content.h"
#include "content/fetch.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf/pdf_plotters.h"
diff --git a/amiga/font.c b/amiga/font.c
index 8be4076..ffecf85 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -79,7 +79,7 @@ ULONG ami_devicedpi;
ULONG ami_xdpi;
int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
- uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth);
+ uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth, bool aa);
int32 ami_font_width_glyph(struct OutlineFont *ofont,
uint16 char1, uint16 char2, uint32 emwidth);
struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle,
@@ -108,7 +108,7 @@ bool nsfont_width(const plot_font_style_t *fstyle,
const char *string, size_t length,
int *width)
{
- *width = ami_unicode_text(NULL,string,length,fstyle,0,0);
+ *width = ami_unicode_text(NULL, string, length, fstyle, 0, 0, false);
if(*width <= 0) *width == length; // fudge
@@ -517,20 +517,27 @@ struct OutlineFont *ami_open_outline_font(const plot_font_style_t
*fstyle,
}
int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp,
- uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth)
+ uint16 char1, uint16 char2, uint32 x, uint32 y, uint32 emwidth, bool aa)
{
struct GlyphMap *glyph;
UBYTE *glyphbm;
int32 char_advance = 0;
FIXED kern = 0;
-
+ ULONG glyphmaptag = OT_GlyphMap8Bit;
+ ULONG template_type = BLITT_ALPHATEMPLATE;
+
+ if(aa == false) {
+ glyphmaptag = OT_GlyphMap;
+ template_type = BLITT_TEMPLATE;
+ }
+
if(ESetInfo(&ofont->olf_EEngine,
OT_GlyphCode, char1,
OT_GlyphCode2, char2,
TAG_END) == OTERR_Success)
{
if(EObtainInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,&glyph,
+ glyphmaptag, &glyph,
TAG_END) == 0)
{
glyphbm = glyph->glm_BitMap;
@@ -545,7 +552,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort
*rp,
BLITA_Width, glyph->glm_BlackWidth,
BLITA_Height, glyph->glm_BlackHeight,
BLITA_Source, glyphbm,
- BLITA_SrcType, BLITT_ALPHATEMPLATE,
+ BLITA_SrcType, template_type,
BLITA_Dest, rp,
BLITA_DestType, BLITT_RASTPORT,
BLITA_SrcBytesPerRow, glyph->glm_BMModulo,
@@ -561,7 +568,7 @@ int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort
*rp,
char_advance = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
EReleaseInfo(&ofont->olf_EEngine,
- OT_GlyphMap8Bit,glyph,
+ glyphmaptag, glyph,
TAG_END);
}
}
@@ -691,7 +698,8 @@ uint16 ami_font_translate_smallcaps(uint16 utf16char)
return utf16char;
}
-ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG length,const
plot_font_style_t *fstyle,ULONG dx, ULONG dy)
+ULONG ami_unicode_text(struct RastPort *rp, const char *string, ULONG length,
+ const plot_font_style_t *fstyle, ULONG dx, ULONG dy, bool aa)
{
uint16 *utf16 = NULL, *outf16 = NULL;
uint16 utf16charsc = 0, utf16nextsc = 0;
@@ -712,8 +720,6 @@ ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG
length,const
outf16 = utf16;
if(!(ofont = ami_open_outline_font(fstyle, 0))) return 0;
- if(rp)
SetRPAttrs(rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fstyle->foreground),TAG_DONE);
-
while(*utf16 != 0)
{
if (*utf16 < 0xD800 || 0xDFFF < *utf16)
@@ -729,7 +735,8 @@ ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG
length,const
utf16nextsc = ami_font_translate_smallcaps(utf16next);
if(rp) {
- tempx = ami_font_plot_glyph(ofont, rp, utf16charsc, utf16nextsc, dx + x, dy,
emwidth);
+ tempx = ami_font_plot_glyph(ofont, rp, utf16charsc, utf16nextsc,
+ dx + x, dy, emwidth, aa);
} else {
tempx = ami_font_width_glyph(ofont, utf16charsc, utf16nextsc, emwidth);
}
@@ -738,7 +745,8 @@ ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG
length,const
if(tempx == 0) {
if(rp) {
- tempx = ami_font_plot_glyph(ofont, rp, *utf16, utf16next, dx + x, dy, emwidth);
+ tempx = ami_font_plot_glyph(ofont, rp, *utf16, utf16next,
+ dx + x, dy, emwidth, aa);
} else {
tempx = ami_font_width_glyph(ofont, *utf16, utf16next, emwidth);
}
@@ -755,7 +763,7 @@ ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG
length,const
{
if(rp) {
tempx = ami_font_plot_glyph(ufont, rp, *utf16, utf16next,
- dx + x, dy, emwidth);
+ dx + x, dy, emwidth, aa);
} else {
tempx = ami_font_width_glyph(ufont, *utf16, utf16next, emwidth);
}
@@ -765,7 +773,7 @@ ULONG ami_unicode_text(struct RastPort *rp,const char *string,ULONG
length,const
{
if(rp) {
tempx = ami_font_plot_glyph(ofont, rp, 0xfffd, utf16next,
- dx + x, dy, emwidth);
+ dx + x, dy, emwidth, aa);
} else {
tempx = ami_font_width_glyph(ofont, 0xfffd, utf16next, emwidth);
}
diff --git a/amiga/font.h b/amiga/font.h
index 36bdbf9..10137f7 100755
--- a/amiga/font.h
+++ b/amiga/font.h
@@ -26,7 +26,7 @@
struct ami_font_node;
ULONG ami_unicode_text(struct RastPort *rp, const char *string,
- ULONG length, const plot_font_style_t *fstyle, ULONG x, ULONG y);
+ ULONG length, const plot_font_style_t *fstyle, ULONG x, ULONG y, bool aa);
void ami_font_setdevicedpi(int id);
void ami_init_fonts(void);
void ami_close_fonts(void);
diff --git a/amiga/gui.c b/amiga/gui.c
index 6fc8a29..53a6aa2 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -19,6 +19,7 @@
/* NetSurf core includes */
#include "content/urldb.h"
#include "css/utils.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/mouse.h"
#include "desktop/netsurf.h"
@@ -30,9 +31,6 @@
#include "desktop/textinput.h"
#include "desktop/tree.h"
#include "image/ico.h"
-#include "render/box.h"
-#include "render/form.h"
-#include "render/html.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
@@ -571,7 +569,6 @@ void gui_init(int argc, char** argv)
save_complete_init();
ami_theme_init();
ami_init_mouse_pointers();
- ami_theme_throbber_setup();
}
static void ami_gui_newprefs_hook(struct Hook *hook, APTR window, APTR reserved)
@@ -603,8 +600,8 @@ void ami_openscreen(void)
if(screenmodereq = AllocAslRequest(ASL_ScreenModeRequest,NULL))
{
if(AslRequestTags(screenmodereq,
- ASLSM_MinDepth,16,
- ASLSM_MaxDepth,32,
+ ASLSM_MinDepth, 0,
+ ASLSM_MaxDepth, 32,
TAG_DONE))
{
char *modeid = malloc(20);
@@ -665,6 +662,7 @@ void ami_openscreenfirst(void)
{
ami_openscreen();
if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0);
+ ami_theme_throbber_setup();
}
static void gui_init2(int argc, char** argv)
@@ -2209,6 +2207,7 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw)
return;
}
+ ami_plot_release_pens(&gwin->shared_pens);
ami_update_buttons(gwin);
ami_menu_update_disabled(gwin->bw->window, gwin->bw->current_content);
@@ -2574,6 +2573,8 @@ struct gui_window *gui_create_browser_window(struct browser_window
*bw,
return NULL;
}
+ NewMinList(&g->shared->shared_pens);
+
g->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook;
g->shared->scrollerhook.h_Data = g->shared;
@@ -3182,12 +3183,14 @@ void gui_window_destroy(struct gui_window *g)
return;
}
+ ami_plot_release_pens(&g->shared->shared_pens);
+
DisposeObject(g->shared->objects[OID_MAIN]);
ami_gui_appicon_remove(g->shared);
if(g->shared->appwin) RemoveAppWindow(g->shared->appwin);
/* These aren't freed by the above.
- * TODO: nav_west etc need freeing too */
+ * TODO: nav_west etc need freeing too? */
DisposeObject(g->shared->objects[GID_ADDTAB_BM]);
DisposeObject(g->shared->objects[GID_CLOSETAB_BM]);
DisposeObject(g->shared->objects[GID_TABS_FLAG]);
@@ -3280,6 +3283,8 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->bw->scale);
int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->bw->scale);
+ browserglob.shared_pens = &gwin->shared_pens;
+
if(top < 0) {
height += top;
top = 0;
@@ -3308,7 +3313,7 @@ void ami_do_redraw_tiled(struct gui_window_2 *gwin,
if(width <= 0) return;
if(height <= 0) return;
-//printf("%ld %ld %ld %ld\n",left, top, width, height);
+// printf("%ld %ld %ld %ld\n",left, top, width, height);
for(y = top; y < (top + height); y += tile_y_scale) {
clip.y0 = 0;
@@ -3470,14 +3475,14 @@ void ami_do_redraw(struct gui_window_2 *g)
g->bw->window->c_h = g->bw->window->c_h_temp;
- if(vcurrent>oldv)
+ if(vcurrent>oldv) /* Going down */
{
ami_do_redraw_limits(g->bw->window, g->bw,
hcurrent, (height / g->bw->scale) + oldv - 1,
hcurrent + (width / g->bw->scale),
vcurrent + (height / g->bw->scale) + 1);
}
- else if(vcurrent<oldv)
+ else if(vcurrent<oldv) /* Going up */
{
ami_do_redraw_limits(g->bw->window, g->bw,
hcurrent, vcurrent,
@@ -3485,14 +3490,14 @@ void ami_do_redraw(struct gui_window_2 *g)
oldv);
}
- if(hcurrent>oldh)
+ if(hcurrent>oldh) /* Going right */
{
ami_do_redraw_limits(g->bw->window, g->bw,
(width / g->bw->scale) + oldh , vcurrent,
hcurrent + (width / g->bw->scale),
vcurrent + (height / g->bw->scale));
}
- else if(hcurrent<oldh)
+ else if(hcurrent<oldh) /* Going left */
{
ami_do_redraw_limits(g->bw->window, g->bw,
hcurrent, vcurrent,
@@ -3516,6 +3521,7 @@ void ami_do_redraw(struct gui_window_2 *g)
}
else
{
+ browserglob.shared_pens = &g->shared_pens;
temprp = browserglob.rp;
browserglob.rp = g->win->RPort;
clip.x0 = bbox->Left;
@@ -3805,6 +3811,7 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle
*icon)
struct BitMap *bm = NULL;
struct IBox *bbox;
ULONG cur_tab = 0;
+ struct bitmap *icon_bitmap;
if(nsoption_bool(kiosk_mode) == true) return;
if(!g) return;
@@ -3813,9 +3820,9 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle
*icon)
g->shared->objects[GID_TABS],
(ULONG *)&cur_tab);
- if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
+ if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
{
- bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16,
+ bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
g->shared->win->RPort->BitMap);
}
@@ -3828,6 +3835,18 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle
*icon)
if(bm)
{
+ ULONG tag, tag_data, minterm;
+
+ if(ami_plot_screen_is_palettemapped() == false) {
+ tag = BLITA_UseSrcAlpha;
+ tag_data = !icon_bitmap->opaque;
+ minterm = 0xc0;
+ } else {
+ tag = BLITA_MaskPlane;
+ tag_data = (ULONG)ami_bitmap_get_mask(icon_bitmap, 16, 16, bm);
+ minterm = (ABC|ABNC|ANBC);
+ }
+
BltBitMapTags(BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestX, bbox->Left,
@@ -3838,7 +3857,8 @@ void gui_window_set_icon(struct gui_window *g, hlcache_handle
*icon)
BLITA_Dest, g->shared->win->RPort,
BLITA_SrcType, BLITT_BITMAP,
BLITA_DestType, BLITT_RASTPORT,
- BLITA_UseSrcAlpha, TRUE,
+ BLITA_Minterm, minterm,
+ tag, tag_data,
TAG_DONE);
}
}
@@ -3868,15 +3888,15 @@ void gui_window_set_search_ico(hlcache_handle *ico)
struct nsObject *nnode;
struct gui_window_2 *gwin;
char fname[100];
+ struct bitmap *ico_bitmap;
if(IsMinListEmpty(window_list)) return;
if(nsoption_bool(kiosk_mode) == true) return;
if (ico == NULL) ico = search_web_ico();
- if ((ico != NULL) && (content_get_bitmap(ico) != NULL))
- {
- bm = ami_getcachenativebm(content_get_bitmap(ico), 16, 16, NULL);
- }
+ ico_bitmap = content_get_bitmap(ico);
+ if ((ico != NULL) && (ico_bitmap != NULL))
+ bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
node = (struct nsObject *)GetHead((struct List *)window_list);
@@ -3898,6 +3918,18 @@ void gui_window_set_search_ico(hlcache_handle *ico)
if(bm)
{
+ ULONG tag, tag_data, minterm;
+
+ if(ami_plot_screen_is_palettemapped() == false) {
+ tag = BLITA_UseSrcAlpha;
+ tag_data = !ico_bitmap->opaque;
+ minterm = 0xc0;
+ } else {
+ tag = BLITA_MaskPlane;
+ tag_data = (ULONG)ami_bitmap_get_mask(ico_bitmap, 16, 16, bm);
+ minterm = (ABC|ABNC|ANBC);
+ }
+
BltBitMapTags(BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestX, bbox->Left,
@@ -3908,7 +3940,8 @@ void gui_window_set_search_ico(hlcache_handle *ico)
BLITA_Dest, gwin->win->RPort,
BLITA_SrcType, BLITT_BITMAP,
BLITA_DestType, BLITT_RASTPORT,
- BLITA_UseSrcAlpha, TRUE,
+ BLITA_Minterm, minterm,
+ tag, tag_data,
TAG_DONE);
}
}
@@ -3997,7 +4030,7 @@ void gui_window_new_content(struct gui_window *g)
g->shared->oldh = 0;
g->shared->oldv = 0;
g->favicon = NULL;
-
+ ami_plot_release_pens(&g->shared->shared_pens);
ami_menu_update_disabled(g, c);
}
@@ -4078,17 +4111,12 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct
IntuiMessage *msg
/* return the text box at posn x,y in window coordinates
x,y are updated to be document co-ordinates */
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y)
{
struct IBox *bbox;
ULONG xs,ys,width,height;
- struct box *box,*text_box=0;
- hlcache_handle *content;
int box_x=0,box_y=0;
-
- content = gwin->bw->current_content;
-
- if(content_get_type(content) != CONTENT_HTML) return NULL;
+ struct contextual_content data;
GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
(ULONG *)&bbox);
@@ -4102,27 +4130,12 @@ struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG
*x, ULONG *y)
width=bbox->Width;
height=bbox->Height;
- box = html_get_box_tree(content);
- while ((box = box_at_point(box, *x, *y, &box_x, &box_y, &content)))
- {
- if (box->style && css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN) continue;
+ browser_window_get_contextual_content(gwin->bw, x, y, &data);
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- text_box = box;
- break;
+ if (data.form_features == CTX_FORM_TEXT)
+ return true;
- default:
- break;
- }
- }
- }
- return text_box;
+ return false;
}
BOOL ami_gadget_hit(Object *obj, int x, int y)
diff --git a/amiga/gui.h b/amiga/gui.h
index 01588c7..498e270 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -112,6 +112,7 @@ struct gui_window_2 {
gui_drag_type drag_op;
struct IBox *ptr_lock;
struct AppWindow *appwin;
+ struct MinList shared_pens;
};
struct gui_window
@@ -142,7 +143,7 @@ void ami_do_redraw_limits(struct gui_window *g, struct browser_window
*bw,
int x0, int y0, int x1, int y1);
STRPTR ami_locale_langs(void);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
-struct box *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
+bool *ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y);
BOOL ami_gadget_hit(Object *obj, int x, int y);
void ami_gui_history(struct gui_window_2 *gwin, bool back);
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index 2d65099..5297a4e 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -34,6 +34,7 @@
#include "amiga/gui.h"
#include "amiga/gui_options.h"
#include "utils/messages.h"
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "amiga/utf8.h"
#include "desktop/searchweb.h"
@@ -669,7 +670,7 @@ void ami_gui_opts_open(void)
GA_RelVerify, TRUE,
GA_Disabled,screenmodedisabled,
GETSCREENMODE_DisplayID,screenmodeid,
- GETSCREENMODE_MinDepth, 16,
+ GETSCREENMODE_MinDepth, 0,
GETSCREENMODE_MaxDepth, 32,
GetScreenModeEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_SCREENNAME] = StringObject,
diff --git a/amiga/history_local.c b/amiga/history_local.c
index 300363f..465d77e 100755
--- a/amiga/history_local.c
+++ b/amiga/history_local.c
@@ -25,6 +25,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/plotters.h"
#include "amiga/os3support.h"
diff --git a/amiga/icon.c b/amiga/icon.c
index e4d0cde..87a8a5c 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -382,7 +382,7 @@ void amiga_icon_superimpose_favicon_internal(struct hlcache_handle
*icon, struct
{
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
{
- bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16, NULL);
+ bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
}
if(bm)
@@ -503,7 +503,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
if(bm)
{
- bitmap = ami_getcachenativebm(bm, THUMBNAIL_WIDTH,
+ bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
bm->icondata = AllocVec(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT,
MEMF_CLEAR);
diff --git a/amiga/menu.c b/amiga/menu.c
index 74048d5..ab8381a 100755
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -58,7 +58,7 @@
#include "amiga/utf8.h"
#include "desktop/tree_url_node.h"
#include "desktop/hotlist.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
@@ -721,7 +721,7 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR
window, struct I
#else
TDR_Arg2,"graphics.library static build",
#endif
- TDR_Arg4,verdate,
+ TDR_Arg3,verdate,
TAG_DONE);
free(temp2);
diff --git a/amiga/options.h b/amiga/options.h
index 287b7ff..8d026cf 100644
--- a/amiga/options.h
+++ b/amiga/options.h
@@ -49,6 +49,8 @@
int download_task_pri; \
bool faster_scroll; \
bool scale_quality; \
+ int dither_quality; \
+ int mask_alpha; \
bool ask_overwrite; \
int printer_unit; \
int print_scale; \
@@ -59,6 +61,7 @@
char *font_unicode_list; \
char *font_unicode_file; \
bool font_unicode_only; \
+ bool font_antialiasing; \
bool drag_save_icons; \
int hotlist_window_xpos; \
int hotlist_window_ypos; \
@@ -109,6 +112,8 @@
.download_task_pri = -1, \
.faster_scroll = true, \
.scale_quality = false, \
+ .dither_quality = 1, \
+ .mask_alpha = 50, \
.ask_overwrite = true, \
.printer_unit = 0, \
.print_scale = 100, \
@@ -119,6 +124,7 @@
.font_unicode_list = NULL, \
.font_unicode_file = NULL, \
.font_unicode_only = false, \
+ .font_antialiasing = true, \
.drag_save_icons = true, \
.hotlist_window_xpos = 0, \
.hotlist_window_ypos = 0, \
@@ -168,6 +174,8 @@
{ "download_task_pri", OPTION_INTEGER, &nsoptions.download_task_pri}, \
{ "faster_scroll", OPTION_BOOL, &nsoptions.faster_scroll}, \
{ "scale_quality", OPTION_BOOL, &nsoptions.scale_quality}, \
+{ "dither_quality", OPTION_INTEGER, &nsoptions.dither_quality}, \
+{ "mask_alpha", OPTION_INTEGER, &nsoptions.mask_alpha}, \
{ "ask_overwrite", OPTION_BOOL, &nsoptions.ask_overwrite}, \
{ "printer_unit", OPTION_INTEGER, &nsoptions.printer_unit}, \
{ "print_scale", OPTION_INTEGER, &nsoptions.print_scale}, \
@@ -178,6 +186,7 @@
{ "font_unicode_list", OPTION_STRING, &nsoptions.font_unicode_list }, \
{ "font_unicode_file", OPTION_STRING, &nsoptions.font_unicode_file }, \
{ "font_unicode_only", OPTION_BOOL, &nsoptions.font_unicode_only }, \
+{ "font_antialiasing", OPTION_BOOL, &nsoptions.font_antialiasing }, \
{ "drag_save_icons", OPTION_BOOL, &nsoptions.drag_save_icons}, \
{ "hotlist_window_xpos", OPTION_INTEGER, &nsoptions.hotlist_window_xpos},
\
{ "hotlist_window_ypos", OPTION_INTEGER, &nsoptions.hotlist_window_ypos},
\
diff --git a/amiga/dist/AutoInstall b/amiga/pkg/AutoInstall
similarity index 100%
rename from amiga/dist/AutoInstall
rename to amiga/pkg/AutoInstall
diff --git a/amiga/pkg/drawer.info b/amiga/pkg/drawer.info
index 4b41433..0a9548a 100644
Binary files a/amiga/pkg/drawer.info and b/amiga/pkg/drawer.info differ
diff --git a/amiga/plotters.c b/amiga/plotters.c
index c2a5c0b..8d54444 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2012 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -19,23 +19,29 @@
#include "amiga/plotters.h"
#include "amiga/bitmap.h"
#include "amiga/font.h"
+#include "amiga/gui.h"
+#include "amiga/utf8.h"
+
+#include "desktop/options.h"
+#include "utils/utils.h"
+#include "utils/log.h"
+
#include <proto/Picasso96API.h>
+#include <proto/exec.h>
+#include <proto/intuition.h>
+
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
#include <graphics/gfxmacros.h>
#include <graphics/gfxbase.h>
-#include "amiga/utf8.h"
-#include "desktop/options.h"
+
#ifdef __amigaos4__
#include <graphics/blitattr.h>
#include <graphics/composite.h>
#endif
-#include "utils/log.h"
+
#include <math.h>
#include <assert.h>
-#include <proto/exec.h>
-#include "amiga/gui.h"
-#include "utils/utils.h"
static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct
BackFillMessage *bfmsg);
@@ -45,8 +51,15 @@ struct bfbitmap {
ULONG height;
int offsetx;
int offsety;
+ APTR mask;
};
+struct ami_plot_pen {
+ struct MinNode node;
+ ULONG pen;
+};
+
+bool palette_mapped = false;
#ifndef M_PI /* For some reason we don't always get this from math.h */
#define M_PI 3.14159265358979323846
@@ -118,20 +131,36 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG
height)
/* init shared bitmaps *
* Height is set to screen width to give enough space for thumbnails *
* Also applies to the further gfx/layers functions and memory below */
-
+
+ ULONG depth = 32;
+ struct DrawInfo *dri;
struct BitMap *friend = NULL; /* Required to be NULL for Cairo and ARGB bitmaps */
+ depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
+ if((depth < 16) || (nsoption_int(cairo_renderer) == -1)) {
+ palette_mapped = true;
+ // friend = scrn->RastPort.BitMap;
+ } else {
+ palette_mapped = false;
+ }
+
if(nsoption_int(redraw_tile_size_x) <= 0) nsoption_set_int(redraw_tile_size_x,
scrn->Width);
if(nsoption_int(redraw_tile_size_y) <= 0) nsoption_set_int(redraw_tile_size_y,
scrn->Height);
if(!width) width = nsoption_int(redraw_tile_size_x);
if(!height) height = nsoption_int(redraw_tile_size_y);
gg->layerinfo = NewLayerInfo();
- gg->areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
- gg->tmprasbuf = AllocVec(width*height,MEMF_PRIVATE | MEMF_CLEAR);
-
- gg->bm = p96AllocBitMap(width, height, 32,
- BMF_INTERLEAVED, friend, RGBFB_A8R8G8B8);
+ gg->areabuf = AllocVec(100, MEMF_PRIVATE | MEMF_CLEAR);
+ gg->tmprasbuf = AllocVec(width * height, MEMF_PRIVATE | MEMF_CLEAR);
+
+ if(palette_mapped == true) {
+ gg->bm = AllocBitMap(width, height, depth,
+ BMF_INTERLEAVED | BMF_DISPLAYABLE, friend);
+ } else {
+ gg->bm = p96AllocBitMap(width, height, 32,
+ BMF_INTERLEAVED | BMF_DISPLAYABLE, friend, RGBFB_A8R8G8B8);
+ }
+
if(!gg->bm) warn_user("NoMemory","");
gg->rp = AllocVec(sizeof(struct RastPort), MEMF_PRIVATE | MEMF_CLEAR);
@@ -182,7 +211,11 @@ void ami_free_layers(struct gui_globals *gg)
FreeVec(gg->tmprasbuf);
FreeVec(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
- p96FreeBitMap(gg->bm);
+ if(palette_mapped == false) {
+ p96FreeBitMap(gg->bm);
+ } else {
+ FreeBitMap(gg->bm);
+ }
}
void ami_clearclipreg(struct gui_globals *gg)
@@ -198,6 +231,70 @@ void ami_clearclipreg(struct gui_globals *gg)
gg->rect.MaxY = scrn->Height-1;
}
+static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colour)
+{
+ struct ami_plot_pen *node;
+ ULONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
+ (colour & 0x000000ff) << 24,
+ (colour & 0x0000ff00) << 16,
+ (colour & 0x00ff0000) << 8,
+ NULL);
+
+ if(pen == -1) LOG(("WARNING: Cannot allocate pen for ABGR:%lx", colour));
+
+ if(shared_pens != NULL) {
+ if(node = (struct ami_plot_pen *)AllocVec(sizeof(struct ami_plot_pen),
+ MEMF_PRIVATE | MEMF_CLEAR)) {
+ AddTail((struct List *)shared_pens, (struct Node *)node);
+ }
+ } else {
+ /* Immediately release the pen if we can't keep track of it. */
+ ReleasePen(scrn->ViewPort.ColorMap, pen);
+ }
+ return pen;
+}
+
+void ami_plot_release_pens(struct MinList *shared_pens)
+{
+ struct ami_plot_pen *node;
+ struct ami_plot_pen *nnode;
+
+ if(IsMinListEmpty(shared_pens)) return;
+ node = (struct ami_plot_pen *)GetHead((struct List *)shared_pens);
+
+ do
+ {
+ nnode = (struct ami_plot_pen *)GetSucc((struct Node *)node);
+ ReleasePen(scrn->ViewPort.ColorMap, node->pen);
+ Remove((struct Node *)node);
+ FreeVec(node);
+ }while(node = nnode);
+}
+
+static void ami_plot_setapen(ULONG colour)
+{
+ if(palette_mapped == false) {
+ SetRPAttrs(glob->rp, RPTAG_APenColor,
+ p96EncodeColor(RGBFB_A8B8G8R8, colour),
+ TAG_DONE);
+ } else {
+ ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);
+ if(pen != -1) SetAPen(glob->rp, pen);
+ }
+}
+
+static void ami_plot_setopen(ULONG colour)
+{
+ if(palette_mapped == false) {
+ SetRPAttrs(glob->rp, RPTAG_OPenColor,
+ p96EncodeColor(RGBFB_A8B8G8R8, colour),
+ TAG_DONE);
+ } else {
+ ULONG pen = ami_plot_obtain_pen(glob->shared_pens, colour);
+ if(pen != -1) SetOPen(glob->rp, pen);
+ }
+}
+
bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
#ifdef AMI_PLOTTER_DEBUG
@@ -206,11 +303,10 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const
plot_style_t *style)
if (style->fill_type != PLOT_OP_TYPE_NONE) {
- if(nsoption_int(cairo_renderer) < 2)
+ if((nsoption_int(cairo_renderer) < 2) ||
+ (palette_mapped == true))
{
- SetRPAttrs(glob->rp, RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour),
- TAG_DONE);
+ ami_plot_setapen(style->fill_colour);
RectFill(glob->rp, x0, y0, x1-1, y1-1);
}
else
@@ -228,7 +324,8 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t
*style)
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- if(nsoption_int(cairo_renderer) < 2)
+ if((nsoption_int(cairo_renderer) < 2) ||
+ (palette_mapped == true))
{
glob->rp->PenWidth = style->stroke_width;
glob->rp->PenHeight = style->stroke_width;
@@ -248,10 +345,7 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t
*style)
break;
}
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour),
- TAG_DONE);
+ ami_plot_setapen(style->stroke_colour);
Move(glob->rp, x0,y0);
Draw(glob->rp, x1, y0);
Draw(glob->rp, x1, y1);
@@ -267,25 +361,25 @@ bool ami_rectangle(int x0, int y0, int x1, int y1, const
plot_style_t *style)
#ifdef NS_AMIGA_CAIRO
ami_cairo_set_colour(glob->cr, style->stroke_colour);
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- ami_cairo_set_solid(glob->cr);
- break;
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ ami_cairo_set_solid(glob->cr);
+ break;
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- ami_cairo_set_dotted(glob->cr);
- break;
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ ami_cairo_set_dotted(glob->cr);
+ break;
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- ami_cairo_set_dashed(glob->cr);
- break;
- }
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ ami_cairo_set_dashed(glob->cr);
+ break;
+ }
- if (style->stroke_width == 0)
- cairo_set_line_width(glob->cr, 1);
- else
- cairo_set_line_width(glob->cr, style->stroke_width);
+ if (style->stroke_width == 0)
+ cairo_set_line_width(glob->cr, 1);
+ else
+ cairo_set_line_width(glob->cr, style->stroke_width);
cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
cairo_stroke(glob->cr);
@@ -301,7 +395,7 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t
*style)
LOG(("[ami_plotter] Entered ami_line()"));
#endif
- if(nsoption_int(cairo_renderer) < 2)
+ if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true))
{
glob->rp->PenWidth = style->stroke_width;
glob->rp->PenHeight = style->stroke_width;
@@ -321,10 +415,7 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t
*style)
break;
}
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour),
- TAG_DONE);
+ ami_plot_setapen(style->stroke_colour);
Move(glob->rp,x0,y0);
Draw(glob->rp,x1,y1);
@@ -337,25 +428,25 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t
*style)
#ifdef NS_AMIGA_CAIRO
ami_cairo_set_colour(glob->cr, style->stroke_colour);
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- ami_cairo_set_solid(glob->cr);
- break;
-
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- ami_cairo_set_dotted(glob->cr);
- break;
-
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- ami_cairo_set_dashed(glob->cr);
- break;
- }
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ ami_cairo_set_solid(glob->cr);
+ break;
+
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ ami_cairo_set_dotted(glob->cr);
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ ami_cairo_set_dashed(glob->cr);
+ break;
+ }
- if (style->stroke_width == 0)
- cairo_set_line_width(glob->cr, 1);
- else
- cairo_set_line_width(glob->cr, style->stroke_width);
+ if (style->stroke_width == 0)
+ cairo_set_line_width(glob->cr, 1);
+ else
+ cairo_set_line_width(glob->cr, style->stroke_width);
/* core expects horizontal and vertical lines to be on pixels, not
* between pixels */
@@ -377,17 +468,12 @@ bool ami_polygon(const int *p, unsigned int n, const plot_style_t
*style)
int k;
- if(nsoption_int(cairo_renderer) < 1)
+ if((nsoption_int(cairo_renderer) < 1) || (palette_mapped == true))
{
ULONG cx,cy;
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour),
- RPTAG_OPenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour),
-// RPTAG_OPenColor,0xffffffff,
- TAG_DONE);
+ ami_plot_setapen(style->fill_colour);
+ ami_plot_setopen(style->fill_colour);
AreaMove(glob->rp,p[0],p[1]);
@@ -443,7 +529,7 @@ bool ami_clip(const struct rect *clip)
}
#ifdef NS_AMIGA_CAIRO
- if(nsoption_int(cairo_renderer) == 2)
+ if((nsoption_int(cairo_renderer) == 2) && (palette_mapped == false))
{
cairo_reset_clip(glob->cr);
cairo_rectangle(glob->cr, clip->x0, clip->y0,
@@ -462,7 +548,14 @@ bool ami_text(int x, int y, const char *text, size_t length,
LOG(("[ami_plotter] Entered ami_text()"));
#endif
- ami_unicode_text(glob->rp,text,length,fstyle,x,y);
+ bool aa = true;
+
+ if((nsoption_bool(font_antialiasing) == false) || (palette_mapped == true))
+ aa = false;
+
+ ami_plot_setapen(fstyle->foreground);
+ ami_unicode_text(glob->rp, text, length, fstyle, x, y, aa);
+
return true;
}
@@ -472,23 +565,16 @@ bool ami_disc(int x, int y, int radius, const plot_style_t *style)
LOG(("[ami_plotter] Entered ami_disc()"));
#endif
- if(nsoption_int(cairo_renderer) < 2)
+ if((nsoption_int(cairo_renderer) < 2) || (palette_mapped == true))
{
if (style->fill_type != PLOT_OP_TYPE_NONE) {
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour),
- TAG_DONE);
+ ami_plot_setapen(style->fill_colour);
AreaCircle(glob->rp,x,y,radius);
AreaEnd(glob->rp);
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour),
- TAG_DONE);
-
+ ami_plot_setapen(style->stroke_colour);
DrawEllipse(glob->rp,x,y,radius,radius);
}
}
@@ -525,8 +611,12 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2, const
plot_style_
LOG(("[ami_plotter] Entered ami_arc()"));
#endif
- if(nsoption_int(cairo_renderer) >= 1)
- {
+ if((nsoption_int(cairo_renderer) <= 0) || (palette_mapped == true)) {
+ /* TODO: gfx.lib plotter needs arc support */
+ /* eg.
http://www.crbond.com/primitives.htm CommonFuncsPPC.lha */
+ ami_plot_setapen(style->fill_colour);
+ /* DrawArc(glob->rp,x,y,(float)angle1,(float)angle2,radius); */
+ } else {
#ifdef NS_AMIGA_CAIRO
ami_cairo_set_colour(glob->cr, style->fill_colour);
ami_cairo_set_solid(glob->cr);
@@ -538,19 +628,7 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2, const
plot_style_
cairo_stroke(glob->cr);
#endif
}
- else
- {
- /* TODO: gfx.lib plotter needs arc support */
-/*
http://www.crbond.com/primitives.htm
-CommonFuncsPPC.lha */
-
- SetRPAttrs(glob->rp,
- RPTAG_APenColor,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour),
- TAG_DONE);
-
-// DrawArc(glob->rp,x,y,(float)angle1,(float)angle2,radius);
- }
+
return true;
}
@@ -570,15 +648,14 @@ static bool ami_bitmap(int x, int y, int width, int height, struct
bitmap *bitma
(y > glob->rect.MaxY))
return true;
- tbm = ami_getcachenativebm(bitmap,width,height,glob->rp->BitMap);
-
+ tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
if(!tbm) return true;
#ifdef AMI_PLOTTER_DEBUG
LOG(("[ami_plotter] ami_bitmap() got native bitmap"));
#endif
- if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function
isn't in OS4.0, so checking for v53 (OS4.1)
+ if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
uint32 comptype = COMPOSITE_Src;
if(!bitmap->opaque)
@@ -598,6 +675,18 @@ static bool ami_bitmap(int x, int y, int width, int height, struct
bitmap *bitma
}
else
{
+ ULONG tag, tag_data, minterm = 0xc0;
+
+ if(palette_mapped == false) {
+ tag = BLITA_UseSrcAlpha;
+ tag_data = !bitmap->opaque;
+ minterm = 0xc0;
+ } else {
+ tag = BLITA_MaskPlane;
+ if(tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm))
+ minterm = (ABC|ABNC|ANBC);
+ }
+
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
@@ -606,12 +695,12 @@ static bool ami_bitmap(int x, int y, int width, int height, struct
bitmap *bitma
BLITA_DestY,y,
BLITA_SrcType,BLITT_BITMAP,
BLITA_DestType,BLITT_RASTPORT,
-// BLITA_Mask,0xFF,
- BLITA_UseSrcAlpha,!bitmap->opaque,
+ BLITA_Minterm, minterm,
+ tag, tag_data,
TAG_DONE);
}
- if(tbm != bitmap->nativebm)
+ if((bitmap->dto == NULL) && (tbm != bitmap->nativebm))
{
p96FreeBitMap(tbm);
}
@@ -643,8 +732,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if((bitmap->opaque == false) && (bitmap->width == 1) &&
(bitmap->height == 1))
return true;
- tbm = ami_getcachenativebm(bitmap,width,height,glob->rp->BitMap);
-
+ tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
if(!tbm) return true;
ox = x;
@@ -699,6 +787,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
bfbm.height = height;
bfbm.offsetx = ox;
bfbm.offsety = oy;
+ bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
bfh = AllocVec(sizeof(struct Hook),MEMF_CLEAR);
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
bfh->h_SubEntry = 0;
@@ -713,7 +802,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if(bitmap->opaque) DeleteBackFillHook(bfh);
else FreeVec(bfh);
- if(tbm != bitmap->nativebm)
+ if((bitmap->dto == NULL) && (tbm != bitmap->nativebm))
{
p96FreeBitMap(tbm);
}
@@ -730,9 +819,9 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort
*rp,struct Ba
for (xf = -bfbm->offsetx; xf < bfmsg->Bounds.MaxX; xf += bfbm->width) {
for (yf = -bfbm->offsety; yf < bfmsg->Bounds.MaxY; yf += bfbm->height) {
- if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function
isn't in OS4.0, so checking for v53 (OS4.1)
+ if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
- CompositeTags(COMPOSITE_Src_Over_Dest,bfbm->bm,rp->BitMap,
+ CompositeTags(COMPOSITE_Src_Over_Dest,bfbm->bm, rp->BitMap,
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
COMPTAG_DestX,bfmsg->Bounds.MinX,
COMPTAG_DestY,bfmsg->Bounds.MinY,
@@ -746,17 +835,30 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort
*rp,struct Ba
}
else
{
- BltBitMapTags(BLITA_Width,bfbm->width,
- BLITA_Height,bfbm->height,
- BLITA_Source,bfbm->bm,
- BLITA_Dest,rp,
- BLITA_DestX,xf,
- BLITA_DestY,yf,
- BLITA_SrcType,BLITT_BITMAP,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_UseSrcAlpha,TRUE,
+ ULONG tag, tag_data, minterm = 0xc0;
+
+ if(palette_mapped == false) {
+ tag = BLITA_UseSrcAlpha;
+ tag_data = TRUE;
+ minterm = 0xc0;
+ } else {
+ tag = BLITA_MaskPlane;
+ if(tag_data = (ULONG)bfbm->mask)
+ minterm = (ABC|ABNC|ANBC);
+ }
+
+ BltBitMapTags(BLITA_Width, bfbm->width,
+ BLITA_Height, bfbm->height,
+ BLITA_Source, bfbm->bm,
+ BLITA_Dest, rp,
+ BLITA_DestX, xf,
+ BLITA_DestY, yf,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_DestType, BLITT_RASTPORT,
+ BLITA_Minterm, minterm,
+ tag, tag_data,
TAG_DONE);
- }
+ }
}
}
}
@@ -801,7 +903,7 @@ bool ami_path(const float *p, unsigned int n, colour fill, float
width,
/* We should probably check if the off-screen bitmap is 32-bit and render
* using Cairo regardless if it is. For now, we respect user preferences.
*/
- if(nsoption_int(cairo_renderer) >= 1)
+ if((nsoption_int(cairo_renderer) >= 1) && (palette_mapped == false))
{
unsigned int i;
cairo_matrix_t old_ctm, n_ctm;
@@ -880,3 +982,8 @@ bool ami_path(const float *p, unsigned int n, colour fill, float
width,
#endif
return true;
}
+
+bool ami_plot_screen_is_palettemapped(void)
+{
+ return palette_mapped;
+}
diff --git a/amiga/plotters.h b/amiga/plotters.h
index c3f816d..db767b6 100755
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -33,6 +33,7 @@ struct gui_globals
APTR areabuf;
APTR tmprasbuf;
struct Rectangle rect;
+ struct MinList *shared_pens;
#ifdef NS_AMIGA_CAIRO
cairo_surface_t *surface;
cairo_t *cr;
@@ -63,6 +64,8 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width,
void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height);
void ami_free_layers(struct gui_globals *gg);
void ami_clearclipreg(struct gui_globals *gg);
+void ami_plot_release_pens(struct MinList *shared_pens);
+bool ami_plot_screen_is_palettemapped(void);
struct gui_globals *glob;
#endif
diff --git a/amiga/plugin_hack.c b/amiga/plugin_hack.c
index 5fc4591..89e80e3 100644
--- a/amiga/plugin_hack.c
+++ b/amiga/plugin_hack.c
@@ -23,8 +23,8 @@
#include "amiga/filetype.h"
#include "amiga/plugin_hack.h"
#include "content/content_protected.h"
+#include "content/hlcache.h"
#include "desktop/plotters.h"
-#include "render/box.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
@@ -49,8 +49,7 @@ static bool amiga_plugin_hack_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
static void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
static void amiga_plugin_hack_close(struct content *c);
static nserror amiga_plugin_hack_clone(const struct content *old, struct content
**newc);
static content_type amiga_plugin_hack_content_type(void);
@@ -172,15 +171,15 @@ bool amiga_plugin_hack_redraw(struct content *c,
* \param params object parameters, or 0 if not an object
*/
void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params)
+ struct content *page, struct object_params *params)
{
LOG(("amiga_plugin_hack_open %s", nsurl_access(content_get_url(c))));
- if(c && box)
+ if(c)
{
- c->width = box->width;
- c->height = box->height;
+ /* TODO: Do we need valid dimensions at this point? */
+ c->width = 0;
+ c->height = 0;
}
return;
diff --git a/amiga/search.c b/amiga/search.c
index 9ac7c5a..6f8ebd4 100755
--- a/amiga/search.c
+++ b/amiga/search.c
@@ -30,8 +30,6 @@
#include "desktop/gui.h"
#include "desktop/search.h"
#include "desktop/selection.h"
-#include "render/box.h"
-#include "render/html.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -59,19 +57,6 @@
#define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
#endif
-struct list_entry {
- unsigned start_idx; /* start position of match */
- unsigned end_idx; /* end of match */
-
- struct box *start_box; /* used only for html contents */
- struct box *end_box;
-
- struct selection *sel;
-
- struct list_entry *prev;
- struct list_entry *next;
-};
-
static bool search_insert;
static struct find_window *fwin = NULL;
@@ -84,7 +69,7 @@ static void ami_search_add_recent(const char *string, void *p);
static void ami_search_set_forward_state(bool active, void *p);
static void ami_search_set_back_state(bool active, void *p);
-static struct search_callbacks ami_search_callbacks = {
+static struct gui_search_callbacks ami_search_callbacks = {
ami_search_set_forward_state,
ami_search_set_back_state,
ami_search_set_status,
diff --git a/amiga/theme.c b/amiga/theme.c
index 1bcd6a7..fce69ed 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -25,7 +25,6 @@
#include <proto/graphics.h>
#include <proto/icon.h>
#include <proto/intuition.h>
-#include <proto/Picasso96API.h>
#include <gadgets/clicktab.h>
#include <gadgets/space.h>
@@ -35,7 +34,9 @@
#include <intuition/pointerclass.h>
#include <workbench/icon.h>
+#include "amiga/bitmap.h"
#include "amiga/drag.h"
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "amiga/theme.h"
#include "desktop/searchweb.h"
@@ -43,6 +44,7 @@
#include "utils/utils.h"
struct BitMap *throbber = NULL;
+struct bitmap *throbber_nsbm = NULL;
ULONG throbber_frames,throbber_update_interval;
static Object *mouseptrobj[AMI_LASTPOINTER+1];
static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1];
@@ -131,53 +133,25 @@ void ami_theme_throbber_setup(void)
{
char throbberfile[1024];
Object *dto;
+ struct bitmap *bm;
ami_get_theme_filename(throbberfile,"theme_throbber",false);
throbber_frames=atoi(messages_get("theme_throbber_frames"));
throbber_update_interval = atoi(messages_get("theme_throbber_delay"));
if(throbber_update_interval == 0) throbber_update_interval = 100;
- if(dto = NewDTObject(throbberfile,
- DTA_GroupID,GID_PICTURE,
- PDTA_DestMode,PMODE_V43,
- TAG_DONE))
- {
- struct BitMapHeader *throbber_bmh;
- struct RastPort throbber_rp;
-
- if(GetDTAttrs(dto,PDTA_BitMapHeader,&throbber_bmh,TAG_DONE))
- {
- throbber_width = throbber_bmh->bmh_Width / throbber_frames;
- throbber_height = throbber_bmh->bmh_Height;
-
- InitRastPort(&throbber_rp);
-
- if(throbber = p96AllocBitMap(throbber_bmh->bmh_Width,
- throbber_height,32,
- BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
- NULL,RGBFB_A8R8G8B8))
- {
- struct RenderInfo ri;
- UBYTE *throbber_tempmem =
AllocVec(throbber_bmh->bmh_Width*throbber_height*4,MEMF_PRIVATE | MEMF_CLEAR);
- throbber_rp.BitMap = throbber;
- ri.Memory = throbber_tempmem;
- ri.BytesPerRow = 4*throbber_bmh->bmh_Width;
- ri.RGBFormat = RGBFB_A8R8G8B8;
-
- IDoMethod(dto,PDTM_READPIXELARRAY,ri.Memory,PBPAFMT_ARGB,ri.BytesPerRow,0,0,throbber_bmh->bmh_Width,throbber_height);
-
- p96WritePixelArray((struct RenderInfo
*)&ri,0,0,&throbber_rp,0,0,throbber_bmh->bmh_Width,throbber_height);
-
- FreeVec(throbber_tempmem);
- }
- }
- DisposeDTObject(dto);
- }
+ bm = ami_bitmap_from_datatype(throbberfile);
+ throbber = ami_bitmap_get_native(bm, bm->width, bm->height, NULL);
+
+ throbber_width = bm->width / throbber_frames;
+ throbber_height = bm->height;
+ throbber_nsbm = bm;
}
void ami_theme_throbber_free(void)
{
- p96FreeBitMap(throbber);
+ bitmap_destroy(throbber_nsbm);
+ throbber = NULL;
}
void ami_get_theme_filename(char *filename, char *themestring, bool protocol)
diff --git a/amiga/tree.c b/amiga/tree.c
index 0ec527e..da7e303 100755
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -98,6 +98,7 @@ struct treeview_window {
char *sslerr;
char *sslaccept;
char *sslreject;
+ struct MinList shared_pens;
};
void ami_tree_draw(struct treeview_window *twin);
@@ -130,8 +131,11 @@ struct treeview_window *ami_tree_create(uint8 flags,
}
twin->ssl_data = ssl_data;
-
twin->tree = tree_create(flags, &ami_tree_callbacks, twin);
+
+ NewMinList(&twin->shared_pens);
+ twin->globals.shared_pens = &twin->shared_pens;
+
return twin;
}
@@ -666,6 +670,7 @@ void ami_tree_close(struct treeview_window *twin)
DisposeObject(twin->objects[OID_MAIN]);
DelObjectNoFree(twin->node);
ami_free_layers(&twin->globals);
+ ami_plot_release_pens(&twin->shared_pens);
for(i=0;i<AMI_TREE_MENU_ITEMS;i++)
{
diff --git a/atari/Makefile.target b/atari/Makefile.target
index fcb6a25..9c7157e 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -2,14 +2,23 @@
# Atari target setup
# ----------------------------------------------------------------------------
+ifeq ($(ATARI_ARCH),68000)
+PRGSUFFIX := 000.app
+PKGNAME := ns000.zip
+endif
+
ifeq ($(ATARI_ARCH),68020-60)
CFLAGS += -m68020-60
LDFLAGS += -m68020-60
+PRGSUFFIX := 020.app
+PKGNAME := ns020.zip
endif
ifeq ($(ATARI_ARCH),5475)
CFLAGS += -mcpu=5475
LDFLAGS += -mcpu=5475
+PRGSUFFIX := v4e.app
+PKGNAME := nsv4e.zip
endif
# non-pkgconfig components
@@ -52,6 +61,7 @@ LDFLAGS += -lcflib -lcurl
LDFLAGS += -lcss -lparserutils -ldom -lwapcaplet -lhubbub
LDFLAGS += -lssl -lcrypto
LDFLAGS += -lxml2 -lz -liconv -lcares -lHermes -lwindom -lgem -lm
+LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
# S_ATARI are sources purely for the Atari FreeMiNT build
@@ -70,6 +80,109 @@ S_ATARI := $(addprefix atari/,$(S_ATARI))
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_ATARI)
-EXETARGET := ns$(SUBTARGET).prg
+EXETARGET := ns$(SUBTARGET)$(PRGSUFFIX)
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+ATARI_TARGET_DIR := netsurf/
+ATARI_RES_DIR := atari/res/
+ATARI_DOC_DIR := atari/doc/
+ATARI_FONT_NAME := ttf-bitstream-vera-1.10
+ATARI_FONT_SOURCE_URL :=
http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/$(ATARI_FO...
+#ATARI_FONT_SOURCE_URL :=
http://localhost/$(ATARI_FONT_NAME).tar.gz
+ATARI_FONT_TMP_DIR := $(DEPROOT)/../
+ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/
+
+ifeq ($(HOST),mint)
+ STRIP := strip
+ STACK := stack
+endif
+
+ifneq ($(HOST),mint)
+ STRIP := m68k-atari-mint-strip
+ STACK := m68k-atari-mint-stack
+endif
+
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-atari:
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+$(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME):
+ $(Q)wget $(ATARI_FONT_SOURCE_URL) -O $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME).tar.gz
+ tar xfz $(ATARI_FONT_TMP_DIR)/$(ATARI_FONT_NAME).tar.gz -C $(ATARI_FONT_TMP_DIR)
+
+package-atari: $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME) $(PKGNAME)
+ $(VQ)echo Creating $(PKGNAME)
+
+$(PKGNAME): $(EXETARGET)
+ $(Q)$(STRIP) $(EXETARGET)
+ $(Q)$(STACK) -S 256k $(EXETARGET)
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
+ $(Q)rm -rf $(PKGNAME)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
+ $(Q)mkdir $(ATARI_TARGET_DIR)
+ $(Q)mkdir $(ATARI_TARGET_DIR)doc
+ $(Q)mkdir $(ATARI_TARGET_DIR)download
+ $(Q)mkdir $(ATARI_TARGET_DIR)res
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/fonts
+ $(Q)mkdir $(ATARI_TARGET_DIR)res/icons
+ $(Q)touch $(ATARI_TARGET_DIR)cookies
+ $(Q)touch $(ATARI_TARGET_DIR)url.db
+
+ $(Q)cp $(ATARI_DOC_DIR)bugs $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)faq.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)readme.txt $(ATARI_TARGET_DIR)doc/
+ $(Q)cp $(ATARI_DOC_DIR)todo.txt $(ATARI_TARGET_DIR)doc/
+
+# GUI resources:
+ $(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_TARGET_DIR)res/netsurf.rsc
+ $(Q)cp $(ATARI_RES_DIR)/icons -R $(ATARI_TARGET_DIR)res/icons
+ $(Q)cp \!NetSurf/Resources/Icons/content.png -R $(ATARI_TARGET_DIR)res/icons/
+ $(Q)cp \!NetSurf/Resources/Icons/directory.png -R $(ATARI_TARGET_DIR)res/icons/dir.png
+
+ $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(ATARI_TARGET_DIR)res/adblock.css
+ $(Q)cp \!NetSurf/Resources/CSS,f79 $(ATARI_TARGET_DIR)res/default.css
+ $(Q)cp \!NetSurf/Resources/Quirks,f79 $(ATARI_TARGET_DIR)res/quirks.css
+ $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css
+ $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+ $(Q)cp resources/FatMessages $(ATARI_TARGET_DIR)res/messages
+ $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+
+# copy "Bitstream Vera" font:
+# try "cp
+# /path/to/local/copy/font.ttf /path/to/pkg/font.ttf || wget -O
+# /path/to/pkg/font.ttf
http://foo/font.ttf"
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)RELEASENOTES.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)README.TXT $(ATARI_TARGET_DIR)res/fonts/
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)COPYRIGHT.TXT $(ATARI_TARGET_DIR)res/fonts/
+
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)Vera.ttf $(ATARI_TARGET_DIR)res/fonts/ss.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBd.ttf $(ATARI_TARGET_DIR)res/fonts/ssb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraIt.ttf $(ATARI_TARGET_DIR)res/fonts/ssi.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraBI.ttf $(ATARI_TARGET_DIR)res/fonts/ssib.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSe.ttf $(ATARI_TARGET_DIR)res/fonts/s.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraSeBd.ttf $(ATARI_TARGET_DIR)res/fonts/sb.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMono.ttf $(ATARI_TARGET_DIR)res/fonts/mono.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBd.ttf $(ATARI_TARGET_DIR)res/fonts/monob.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoIt.ttf $(ATARI_TARGET_DIR)res/fonts/cursive.ttf
+ $(Q)cp $(ATARI_FONT_SOURCE_DIR)VeraMoBI.ttf $(ATARI_TARGET_DIR)res/fonts/fantasy.ttf
+
+ $(Q)cp $(EXETARGET) $(ATARI_TARGET_DIR)$(EXETARGET)
+# zip files
+ $(Q)zip $(PKGNAME) -9 -r ./$(ATARI_TARGET_DIR)
+# delete temporary folders
+ $(Q)rm -rf $(ATARI_TARGET_DIR)
+# $(Q)rm -rf $(ATARI_FONT_SOURCE_DIR)
diff --git a/atari/browser.c b/atari/browser.c
index c8efe3d..f88610a 100755
--- a/atari/browser.c
+++ b/atari/browser.c
@@ -34,14 +34,13 @@
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/textinput.h"
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "css/css.h"
-#include "render/box.h"
-#include "render/form.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -58,9 +57,9 @@
#include "atari/ctxmenu.h"
#include "cflib.h"
-extern struct gui_window *input_window;
-
-extern long atari_plot_flags;
+extern struct gui_window *input_window;
+
+extern long atari_plot_flags;
extern int atari_plot_vdi_handle;
static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect );
@@ -253,7 +252,7 @@ static void __CDECL browser_evnt_mbutton( COMPONENT * c, long buff[8],
void * da
int sy_origin = (my + gw->browser->scroll.current.y);
short rel_cur_x, rel_cur_y;
- short prev_x=sx_origin, prev_y=sy_origin;
+ short prev_x=sx_origin, prev_y=sy_origin;
bool dragmode = 0;
/* Detect left mouse button state and compare with event state: */
@@ -271,14 +270,14 @@ static void __CDECL browser_evnt_mbutton( COMPONENT * c, long
buff[8], void * da
BROWSER_MOUSE_DRAG_ON|BROWSER_MOUSE_DRAG_1,
rel_cur_x, rel_cur_y);
prev_x = rel_cur_x;
- prev_y = rel_cur_y;
+ prev_y = rel_cur_y;
dragmode = true;
- } else {
- if( dragmode == false ){
+ } else {
+ if( dragmode == false ){
browser_window_mouse_track( gw->browser->bw,BROWSER_MOUSE_PRESS_1,
- rel_cur_x, rel_cur_y);
- }
- }
+ rel_cur_x, rel_cur_y);
+ }
+ }
if( browser_redraw_required( gw ) ){
browser_redraw( gw );
}
@@ -726,7 +725,7 @@ void browser_redraw_caret( struct gui_window * gw, LGRECT * area )
/* restore old clip area: */
plot_clip( &old_clip );
/* restore the mouse */
- v_show_c ( app.graf.handle, 1);
+ v_show_c ( app.graf.handle, 1);
b->caret.current.g_x = caret.g_x + gw->browser->scroll.current.x;
b->caret.current.g_y = caret.g_y + gw->browser->scroll.current.y;
b->caret.current.g_w = caret.g_w;
@@ -748,7 +747,7 @@ void browser_redraw( struct gui_window * gw )
}
browser_get_rect(gw, BR_CONTENT, &bwrect);
-
+
plot_set_dimensions(bwrect.g_x, bwrect.g_y, bwrect.g_w, bwrect.g_h);
clip.x0 = 0;
clip.y0 = 0;
@@ -764,26 +763,26 @@ void browser_redraw( struct gui_window * gw )
}
if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL )
{
- if( (atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
+ if( (atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
int i;
GRECT area;
- GRECT fbwork;
+ GRECT fbwork;
short wf_top[4];
todo[0] = bwrect.g_x;
todo[1] = bwrect.g_y;
todo[2] = todo[0] + bwrect.g_w-1;
todo[3] = todo[1] + bwrect.g_h-1;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
-
- wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
- &wf_top[2], &wf_top[3] );
-
- if( wf_top[0] == gw->root->handle->handle
- && wf_top[1] == _AESapid ){
- /* The window is on top, so there is no need to walk the */
- /* AES rectangle list. */
- for( i=0; i<b->redraw.areas_used; i++ ){
+ vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
+
+ wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
+ &wf_top[2], &wf_top[3] );
+
+ if( wf_top[0] == gw->root->handle->handle
+ && wf_top[1] == _AESapid ){
+ /* The window is on top, so there is no need to walk the */
+ /* AES rectangle list. */
+ for( i=0; i<b->redraw.areas_used; i++ ){
fbwork.g_x = todo[0] - bwrect.g_x;
fbwork.g_y = todo[1] - bwrect.g_y;
if( fbwork.g_x < 0 ){
@@ -809,13 +808,13 @@ void browser_redraw( struct gui_window * gw )
redraw_area.y1 = area.g_y + area.g_h;
browser_redraw_content( gw, 0, 0, &redraw_area );
} else {
- /* the area should be kept scheduled for later redraw,*/
- /* but because this is onscreen plotter, it doesn't */
+ /* the area should be kept scheduled for later redraw,*/
+ /* but because this is onscreen plotter, it doesn't */
/* make much sense anyway... */
}
- }
- } else {
- /* walk the AES rectangle list: */
+ }
+ } else {
+ /* walk the AES rectangle list: */
if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
while (todo[2] && todo[3]) {
@@ -847,8 +846,8 @@ void browser_redraw( struct gui_window * gw )
redraw_area.y1 = area.g_y + area.g_h;
browser_redraw_content( gw, 0, 0, &redraw_area );
} else {
- /* the area should be kept scheduled for later redraw,*/
- /* but because this is onscreen plotter, it doesn't */
+ /* the area should be kept scheduled for later redraw,*/
+ /* but because this is onscreen plotter, it doesn't */
/* make much sense anyway... */
}
@@ -858,13 +857,13 @@ void browser_redraw( struct gui_window * gw )
break;
}
}
- }
- }
+ }
+ }
vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
- } else {
+ } else {
- /* its save to do a complete redraw without knowledge about GEM windows :) */
- /* walk the redraw requests: */
+ /* its save to do a complete redraw without knowledge about GEM windows :) */
+ /* walk the redraw requests: */
int i;
for( i=0; i<b->redraw.areas_used; i++ ){
struct redraw_context ctx = {
@@ -874,12 +873,12 @@ void browser_redraw( struct gui_window * gw )
};
browser_window_redraw( b->bw, -b->scroll.current.x,
-b->scroll.current.y, &b->redraw.areas[i], &ctx );
- }
+ }
GRECT area;
area.g_x = bwrect.g_x;
area.g_y = bwrect.g_y;
area.g_w = bwrect.g_w;
- area.g_h = bwrect.g_h;
+ area.g_h = bwrect.g_h;
//plot_blit( plotter, &area );
}
b->redraw.areas_used = 0;
diff --git a/atari/browser_win.c b/atari/browser_win.c
index 0877101..9887083 100755
--- a/atari/browser_win.c
+++ b/atari/browser_win.c
@@ -34,6 +34,7 @@
#include "desktop/history_core.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
@@ -41,12 +42,10 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "css/css.h"
-#include "render/box.h"
-#include "render/form.h"
#include "atari/gui.h"
#include "atari/browser_win.h"
#include "atari/browser.h"
-#include "atari/misc.h"
+#include "atari/misc.h"
#include "atari/plot/plot.h"
#include "atari/global_evnt.h"
#include "atari/res/netsurf.rsh"
@@ -154,7 +153,7 @@ int window_create( struct gui_window * gw,
EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, gw );
/* capture resize/move events so we can handle that manually */
EvntDataAdd( gw->root->handle, WM_SIZED, evnt_window_rt_resize, gw, EV_BOT );
- EvntDataAdd( gw->root->handle, WM_MOVED, evnt_window_rt_resize, gw, EV_BOT );
+ EvntDataAdd( gw->root->handle, WM_MOVED, evnt_window_rt_resize, gw, EV_BOT );
EvntDataAdd( gw->root->handle, WM_FULLED, evnt_window_rt_resize, gw, EV_BOT );
EvntDataAdd( gw->root->handle, WM_DESTROY,evnt_window_destroy, gw, EV_TOP );
EvntDataAdd( gw->root->handle, WM_ARROWED,evnt_window_arrowed, gw, EV_TOP );
@@ -162,7 +161,7 @@ int window_create( struct gui_window * gw,
EvntDataAdd( gw->root->handle, WM_TOPPED, evnt_window_newtop, gw, EV_BOT);
EvntDataAdd( gw->root->handle, WM_ICONIFY, evnt_window_iconify, gw, EV_BOT);
EvntDataAdd( gw->root->handle, WM_UNICONIFY, evnt_window_uniconify, gw, EV_BOT);
- EvntDataAttach( gw->root->handle, AP_DRAGDROP, evnt_window_dd, gw );
+ EvntDataAttach( gw->root->handle, AP_DRAGDROP, evnt_window_dd, gw );
EvntDataAttach( gw->root->handle, WM_ICONDRAW, evnt_window_icondraw, gw);
EvntDataAttach( gw->root->handle, WM_SLIDEXY, evnt_window_slider, gw );
@@ -227,16 +226,16 @@ void window_open( struct gui_window * gw, GRECT pos )
/* recompute the nested component sizes and positions: */
browser_update_rects( gw );
mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH,
(GRECT*)&gw->root->loc);
- browser_get_rect( gw, BR_CONTENT, &br );
+ browser_get_rect( gw, BR_CONTENT, &br );
plot_set_dimensions(br.g_x, br.g_y, br.g_w, br.g_h);
gw->browser->attached = true;
if( gw->root->statusbar != NULL ){
gw->root->statusbar->attached = true;
}
- tb_adjust_size( gw );
+ tb_adjust_size( gw );
/*TBD: get already present content and set size? */
input_window = gw;
- window_set_focus( gw, BROWSER, gw->browser );
+ window_set_focus( gw, BROWSER, gw->browser );
}
@@ -499,9 +498,9 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8],
void * dat
tree->ob_height = h;
mt_objc_draw( tree, 0, 8, buff[4], buff[5], buff[6], buff[7], app.aes_global );
} else {
- struct rect clip = { 0,0,w,h };
+ struct rect clip = { 0,0,w,h };
plot_set_dimensions( x,y,w,h );
- plot_clip(&clip);
+ plot_clip(&clip);
atari_plotters.bitmap(0, 0, w, h, gw->icon, 0xffffff, 0);
}
}
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 25b3c84..79395ca 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -28,15 +28,13 @@
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/textinput.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "render/html.h"
+#include "content/urldb.h"
#include "css/css.h"
-#include "render/box.h"
-#include "render/form.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -68,12 +66,10 @@ struct s_context_info ctxinfo;
static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short
my )
{
- struct box *box;
hlcache_handle *h;
- int box_x, box_y;
LGRECT bwrect;
struct contextual_content ccdata;
- struct browser_window * bw = gw->browser->bw;
+ struct browser_window * bw = gw->browser->bw;
h = bw->current_content;
ctxinfo.flags = 0;
@@ -107,31 +103,8 @@ static struct s_context_info * get_context_info( struct gui_window *
gw, short m
ctxinfo.flags |= CNT_IMG;
}
}
-
- box = html_get_box_tree(h);
- box_x = box->margin[LEFT];
- box_y = box->margin[TOP];
-
- while ((box = box_at_point(box, mx+gw->browser->scroll.current.x,
my+gw->browser->scroll.current.y, &box_x, &box_y, &h)))
- {
- if (box->style && css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
- continue;
- if (box->gadget)
- {
- switch (box->gadget->type)
- {
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- // TODO: check if there is really an selection, but it
- // doesn't hurt for now...:
- ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
- break;
-
- default: break;
- }
- }
- }
+ if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
+ ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
return( &ctxinfo );
}
@@ -259,7 +232,7 @@ void context_popup( struct gui_window * gw, short x, short y )
case POP_CTX_VIEW_SOURCE:
editor = nsoption_charp(atari_editor);
if (editor != NULL && strlen(editor)>0) {
- data = content_get_source_data(gw->browser->bw->current_content,
+ data = content_get_source_data(gw->browser->bw->current_content,
&size);
if (size > 0 && data != NULL){
tempfile = tmpnam( NULL );
diff --git a/atari/ctxmenu.h b/atari/ctxmenu.h
index 1c0b131..079860d 100644
--- a/atari/ctxmenu.h
+++ b/atari/ctxmenu.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#ifndef CTXMENU_H_INCLUDED
#define CTXMENU_H_INCLUDED
diff --git a/atari/encoding.c b/atari/encoding.c
index 93737b5..2cd2670 100644
--- a/atari/encoding.c
+++ b/atari/encoding.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include "atari/encoding.h"
diff --git a/atari/encoding.h b/atari/encoding.h
index 80b51c8..7b9cc82 100644
--- a/atari/encoding.h
+++ b/atari/encoding.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#ifndef NS_ATARI_ENCODING_H
#define NS_ATARI_ENCODING_H
diff --git a/atari/font.c b/atari/font.c
index 7137658..afb1209 100755
--- a/atari/font.c
+++ b/atari/font.c
@@ -18,6 +18,24 @@
#include <inttypes.h>
#include <assert.h>
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include <stdbool.h>
#include <windom.h>
diff --git a/atari/global_evnt.c b/atari/global_evnt.c
index f002f3f..1a0e8f6 100755
--- a/atari/global_evnt.c
+++ b/atari/global_evnt.c
@@ -28,6 +28,7 @@
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/textinput.h"
#include "desktop/hotlist.h"
diff --git a/atari/gui.c b/atari/gui.c
index 99b5f99..8478bd3 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -46,10 +46,9 @@
#include "desktop/selection.h"
#include "desktop/textinput.h"
#include "desktop/browser.h"
-#include "desktop/mouse.h"
-#include "render/html.h"
+#include "desktop/browser_private.h"
+#include "desktop/mouse.h"
#include "render/font.h"
-#include "render/box.h"
#include "utils/schedule.h"
#include "utils/url.h"
#include "utils/log.h"
@@ -65,7 +64,7 @@
#include "atari/statusbar.h"
#include "atari/toolbar.h"
#include "atari/verify_ssl.h"
-#include "atari/hotlist.h"
+#include "atari/hotlist.h"
#include "atari/history.h"
#include "atari/login.h"
#include "atari/global_evnt.h"
@@ -92,8 +91,8 @@ bool rendering = false;
/* Comandline / Options: */
int option_window_width;
-int option_window_height;
-int option_window_x;
+int option_window_height;
+int option_window_x;
int option_window_y;
/* Defaults to option_homepage_url, commandline options overwrites that value */
@@ -151,7 +150,7 @@ void gui_poll(bool active)
if( evnt.timer != 0 && !active ){
/* this suits for stuff with lower priority */
/* TBD: really be spare on redraws??? */
- hotlist_redraw();
+ hotlist_redraw();
global_history_redraw();
}
}
@@ -643,7 +642,8 @@ bool gui_empty_clipboard(void)
return true;
}
-bool gui_add_to_clipboard(const char *text_utf8, size_t length_utf8, bool space)
+bool gui_add_to_clipboard(const char *text_utf8, size_t length_utf8, bool space,
+ const plot_font_style_t *fstyle)
{
LOG(("(%s): %s (%d)\n", (space)?"space":"",
(char*)text_utf8, (int)length_utf8));
char * oldptr = tmp_clipboard;
@@ -791,10 +791,10 @@ void gui_quit(void)
browser_window_destroy(gw->browser->bw);
gw = tmp;
}
-
+
global_history_destroy();
hotlist_destroy();
- toolbar_exit();
+ toolbar_exit();
urldb_save_cookies(nsoption_charp(cookie_file));
urldb_save(nsoption_charp(url_file));
@@ -820,34 +820,34 @@ void gui_quit(void)
static bool
process_cmdline(int argc, char** argv)
{
- int opt;
+ int opt;
bool set_default_dimensions = true;
LOG(("argc %d, argv %p", argc, argv));
if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
-
+
option_window_width = nsoption_int(window_width);
- option_window_height = nsoption_int(window_height);
+ option_window_height = nsoption_int(window_height);
option_window_x = nsoption_int(window_x);
- option_window_y = nsoption_int(window_y);
-
- if (option_window_width <= app.w && option_window_height < app.h) {
- set_default_dimensions = false;
+ option_window_y = nsoption_int(window_y);
+
+ if (option_window_width <= app.w && option_window_height < app.h) {
+ set_default_dimensions = false;
}
- }
-
+ }
+
if (set_default_dimensions) {
if( sys_type() == SYS_TOS ){
/* on single tasking OS, start as fulled window: */
option_window_width = app.w;
- option_window_height = app.h-20;
- option_window_x = app.w/2-(option_window_width/2);
+ option_window_height = app.h-20;
+ option_window_x = app.w/2-(option_window_width/2);
option_window_y = (app.h/2)-(option_window_height/2);
} else {
option_window_width = 600;
- option_window_height = 360;
- option_window_x = 10;
+ option_window_height = 360;
+ option_window_x = 10;
option_window_y = 30;
}
}
@@ -951,13 +951,18 @@ static void gui_init(int argc, char** argv)
LOG(("Enabling core select menu"));
nsoption_set_bool(core_select_menu, true);
-
+
+ LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
if( strlen(nsoption_charp(url_file)) ){
urldb_load(nsoption_charp(url_file));
- }
+ }
+
+ if (nsoption_charp(cookie_file) == NULL ){
+ nsoption_set_charp(cookie_file, "cookies");
+ }
+ LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
if( strlen(nsoption_charp(cookie_file)) ){
urldb_load_cookies(nsoption_charp(cookie_file));
- LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
}
if (process_cmdline(argc,argv) != true)
@@ -976,9 +981,9 @@ static void gui_init2(int argc, char** argv)
if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
menu_register( _AESapid, (char*)" NetSurf ");
}
- tree_set_icon_dir( nsoption_charp(tree_icons_path) );
+ tree_set_icon_dir( nsoption_charp(tree_icons_path) );
global_history_init();
- hotlist_init();
+ hotlist_init();
toolbar_init();
}
diff --git a/atari/options.h b/atari/options.h
index 3ec2646..56be492 100755
--- a/atari/options.h
+++ b/atari/options.h
@@ -49,13 +49,13 @@
char *tree_icons_path
#define NSOPTION_EXTRA_DEFAULTS \
- .atari_font_driver = (char*)"vdi", \
+ .atari_font_driver = (char*)"freetype", \
.atari_font_monochrom = 0, \
.atari_dither = 1, \
.atari_transparency = 1, \
.atari_image_toolbar_folder = (char*)"default", \
- .atari_image_toolbar = 0, \
- .atari_toolbar_bg = 0xFFFFFF, \
+ .atari_image_toolbar = 1, \
+ .atari_toolbar_bg = 0xbbbbbb, \
.atari_face_sans_serif = NULL, \
.atari_face_sans_serif_bold = NULL, \
.atari_face_sans_serif_italic = NULL, \
diff --git a/atari/osspec.c b/atari/osspec.c
index 6dcc34b..d697f43 100644
--- a/atari/osspec.c
+++ b/atari/osspec.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2010 <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <stdlib.h>
@@ -12,6 +30,10 @@
#include "utils/log.h"
#include "atari/osspec.h"
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
NS_ATARI_SYSINFO atari_sysinfo;
unsigned short _systype_v;
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8b526a7..2339cd6 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -18,16 +18,82 @@
*/
#ifdef WITH_FREETYPE_FONT_DRIVER
+
#include <ft2build.h>
#include FT_CACHE_H
#include "desktop/options.h"
#include "atari/plot/plot.h"
-#include "atari/plot/font_freetype.h"
-
-
-#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
-
+#include "atari/plot/font_freetype.h"
+#include "atari/findfile.h"
+
+/* -------------------------------------------------------------------------- */
+/* Font Loading & Mapping scheme */
+/* -------------------------------------------------------------------------- */
+/*
+
+Truetype fonts are loaded in the following priority order:
+
+1. Option values.
+2. default resouce names (8.3 compatible).
+3. default font package installation path.
+
+
+Resource font names & their meanings:
+--------------------------------------------
+s.ttf => Serif
+sb.ttf => Serif Bold
+ss.ttf => Sans Serif *Default Font
+ssb.ttf => Sans Serif Bold
+ssi.ttf => Sans Serif Italic
+ssib.ttf => Sans Serif Italic Bold
+mono.ttf => Monospaced
+monob.ttf => Monospaced Bold
+cursive.ttf => Cursive
+fantasy.ttf => Fantasy
+*/
+
+#define FONT_RESOURCE_PATH "fonts/"
+#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
+#define BITSTREAM_PATH "/usr/share/fonts/truetype/ttf-bitstream-vera/"
+
+#if !defined(USE_BITSTREAM_FONT_PACKAGE) && !defined(USE_DEJAVU_FONT_PACKAGE)
+# define USE_BITSTREAM_FONT_PACKAGE
+#endif
+
+#if defined(USE_DEJAVU_FONT_PACKAGE)
+# define FONT_PKG_PATH DEJAVU_PATH
+# define FONT_FILE_SANS "DejaVuSans.ttf"
+# define FONT_FILE_SANS_BOLD "DejaVuSans-Bold.ttf"
+# define FONT_FILE_SANS_OBLIQUE "DejaVuSans-Oblique.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "DejaVuSans-BoldOblique.ttf"
+# define FONT_FILE_SERIF "DejaVuSerif.ttf"
+# define FONT_FILE_SERIF_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_MONO "DejaVuSansMono.ttf"
+# define FONT_FILE_MONO_BOLD "DejaVuSerif-Bold.ttf"
+# define FONT_FILE_OBLIQUE "DejaVuSansMono-Oblique.ttf"
+# define FONT_FILE_FANTASY "DejaVuSerifCondensed-Bold.ttf"
+#elif defined(USE_BITSTREAM_FONT_PACKAGE)
+# define FONT_PKG_PATH BITSTREAM_PATH
+# define FONT_FILE_SANS "Vera.ttf"
+# define FONT_FILE_SANS_BOLD "VeraBd.ttf"
+# define FONT_FILE_SANS_OBLIQUE "VeraIt.ttf"
+# define FONT_FILE_SANS_BOLD_OBLIQUE "VeraBI.ttf"
+# define FONT_FILE_SERIF "VeraSe.ttf"
+# define FONT_FILE_SERIF_BOLD "VeraSeBd.ttf"
+# define FONT_FILE_MONO "VeraMono.ttf"
+# define FONT_FILE_MONO_BOLD "VeraMoBd.ttf"
+# define FONT_FILE_OBLIQUE "VeraMoIt.ttf"
+# define FONT_FILE_FANTASY "VeraMoBI.ttf"
+
+#endif
+
+#define CACHE_SIZE 2048
+#define CACHE_MIN_SIZE (100 * 1024)
+#define BOLD_WEIGHT 700
+
+extern css_fixed nscss_screen_dpi;
+
extern unsigned long atari_plot_flags;
extern int atari_plot_vdi_handle;
@@ -123,50 +189,66 @@ ft_new_face(const char *option, const char *resname, const char
*fontfile)
newf = font_faces[FONT_FACE_DEFAULT]; /* use default */
}
return newf;
-}
-
-static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
-{
- int selected_face = FONT_FACE_DEFAULT;
-
- switch (fstyle->family) {
-/*
- case PLOT_FONT_FAMILY_CURSIVE:
- break;
- case PLOT_FONT_FAMILY_FANTASY:
- break;
-*/
- case PLOT_FONT_FAMILY_SERIF:
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SERIF;
-
- break;
-
- case PLOT_FONT_FAMILY_MONOSPACE:
- selected_face = FONT_FACE_MONOSPACE;
- break;
-
- case PLOT_FONT_FAMILY_SANS_SERIF:
- default:
- if ((fstyle->flags & FONTF_ITALIC) || (fstyle->flags & FONTF_OBLIQUE)) {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF_ITALIC;
- } else {
- if (fstyle->weight >= 700)
- selected_face = FONT_FACE_SANS_SERIF_BOLD;
- else
- selected_face = FONT_FACE_SANS_SERIF;
- }
- }
-
- srec->face_id = (FTC_FaceID)font_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
- srec->pixel = 0;
- srec->x_res = srec->y_res = 72;
+}
+
+static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
+{
+ int selected_face = FONT_FACE_DEFAULT;
+
+ switch (fstyle->family) {
+
+ case PLOT_FONT_FAMILY_SERIF:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SERIF;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_MONOSPACE:
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_MONOSPACE_BOLD;
+ } else {
+ selected_face = FONT_FACE_MONOSPACE;
+ }
+ break;
+
+ case PLOT_FONT_FAMILY_CURSIVE:
+ selected_face = FONT_FACE_CURSIVE;
+ break;
+
+ case PLOT_FONT_FAMILY_FANTASY:
+ selected_face = FONT_FACE_FANTASY;
+ break;
+
+ case PLOT_FONT_FAMILY_SANS_SERIF:
+ default:
+ if ((fstyle->flags & FONTF_ITALIC) ||
+ (fstyle->flags & FONTF_OBLIQUE)) {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF_ITALIC;
+ }
+ } else {
+ if (fstyle->weight >= BOLD_WEIGHT) {
+ selected_face = FONT_FACE_SANS_SERIF_BOLD;
+ } else {
+ selected_face = FONT_FACE_SANS_SERIF;
+ }
+ }
+ }
+
+ srec->face_id = (FTC_FaceID)font_faces[selected_face];
+
+ srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->pixel = 0;
+
+ /* calculate x/y resolution, when nscss_screen_dpi isn't available */
+ /* 72 is an good value. */
+ /* TODO: because nscss_screen_dpi is to large, calculate that value */
+ /* by VDI values. */
+ srec->x_res = srec->y_res = 72; // FIXTOINT(nscss_screen_dpi);
}
static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
@@ -192,13 +274,13 @@ static FT_Glyph ft_getglyph(const plot_font_style_t *fstyle,
uint32_t ucs4)
}
-
/* initialise font handling */
static bool ft_font_init(void)
{
FT_Error error;
FT_ULong max_cache_size;
- FT_UInt max_faces = 6;
+ FT_UInt max_faces = 6;
+ int i;
/* freetype library initialise */
error = FT_Init_FreeType( &library );
@@ -206,8 +288,12 @@ static bool ft_font_init(void)
LOG(("Freetype could not initialised (code %d)\n", error));
return false;
}
-
- max_cache_size = 2 * 1024 *1024; /* 2MB should be enough */
+
+ /* set the Glyph cache size up */
+ max_cache_size = CACHE_SIZE * 1024;
+ if (max_cache_size < CACHE_MIN_SIZE) {
+ max_cache_size = CACHE_MIN_SIZE;
+ }
/* cache manager initialise */
error = FTC_Manager_New(library,
@@ -225,64 +311,83 @@ static bool ft_font_init(void)
error = FTC_CMapCache_New(ft_cmanager, &ft_cmap_cache);
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
-
+
+ /* Optain font faces */
+
+
+ /* Default font, Sans Serif */
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
nsoption_charp(atari_face_sans_serif),
- "fonts/ss.ttf",
- DEJAVU_PATH"DejaVuSans.ttf"
+ FONT_RESOURCE_PATH "ss.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
LOG(("Could not find default font (code %d)\n", error));
- FTC_Manager_Done(ft_cmanager );
+ FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
}
-
+
+ /* Sans Serif Bold*/
font_faces[FONT_FACE_SANS_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_bold),
- "fonts/ssb.ttf",
- DEJAVU_PATH"DejaVuSans-Bold.ttf");
-
+ FONT_RESOURCE_PATH "ssb.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD);
+
+ /* Sans Serif Italic */
font_faces[FONT_FACE_SANS_SERIF_ITALIC] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic),
- "fonts/ssi.ttf",
- DEJAVU_PATH"DejaVuSans-Oblique.ttf");
-
+ FONT_RESOURCE_PATH "ssi.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_OBLIQUE);
+
+ /* Sans Serif Italic Bold */
font_faces[FONT_FACE_SANS_SERIF_ITALIC_BOLD] =
ft_new_face(nsoption_charp(atari_face_sans_serif_italic_bold),
- "fonts/ssib.ttf",
- DEJAVU_PATH"DejaVuSans-BoldOblique.ttf");
-
+ FONT_RESOURCE_PATH "ssib.ttf",
+ FONT_PKG_PATH FONT_FILE_SANS_BOLD_OBLIQUE);
+
+ /* Monospaced */
font_faces[FONT_FACE_MONOSPACE] =
ft_new_face(nsoption_charp(atari_face_monospace),
- "fonts/mono.ttf",
- DEJAVU_PATH"DejaVuSansMono.ttf");
-
+ FONT_RESOURCE_PATH "mono.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO);
+
+ /* Mospaced Bold */
font_faces[FONT_FACE_MONOSPACE_BOLD] =
ft_new_face(nsoption_charp(atari_face_monospace_bold),
- "fonts/monob.ttf",
- DEJAVU_PATH"DejaVuSansMono-Bold.ttf");
-
+ FONT_RESOURCE_PATH "monob.ttf",
+ FONT_PKG_PATH FONT_FILE_MONO_BOLD);
+
+ /* Serif */
font_faces[FONT_FACE_SERIF] =
ft_new_face(nsoption_charp(atari_face_serif),
- "fonts/s.ttf",
- DEJAVU_PATH"DejaVuSerif.ttf");
-
+ FONT_RESOURCE_PATH "s.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF);
+
+ /* Serif Bold */
font_faces[FONT_FACE_SERIF_BOLD] =
ft_new_face(nsoption_charp(atari_face_serif_bold),
- "fonts/sb.ttf",
- DEJAVU_PATH"DejaVuSerif-Bold.ttf");
-
+ FONT_RESOURCE_PATH "sb.ttf",
+ FONT_PKG_PATH FONT_FILE_SERIF_BOLD);
+
+ /* Cursive */
font_faces[FONT_FACE_CURSIVE] =
ft_new_face(nsoption_charp(atari_face_cursive),
- "fonts/cursive.ttf",
- DEJAVU_PATH"DejaVuSansMono-Oblique.ttf");
-
+ FONT_RESOURCE_PATH "cursive.ttf",
+ FONT_PKG_PATH FONT_FILE_OBLIQUE);
+
+ /* Fantasy */
font_faces[FONT_FACE_FANTASY] =
ft_new_face(nsoption_charp(atari_face_fantasy),
- "fonts/fantasy.ttf",
- DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
+ FONT_RESOURCE_PATH "fantasy.ttf",
+ FONT_PKG_PATH FONT_FILE_FANTASY);
+
+ for (i=1; i<FONT_FACE_COUNT; i++) {
+ if (font_faces[i] == NULL){
+ font_faces[i] = font_faces[FONT_FACE_SANS_SERIF];
+ }
+ }
return true;
}
diff --git a/atari/plot/font_freetype.h b/atari/plot/font_freetype.h
index bca6d99..1e64ebc 100755
--- a/atari/plot/font_freetype.h
+++ b/atari/plot/font_freetype.h
@@ -48,4 +48,4 @@ struct font_desc {
/* extern int ft_load_type; */
int ctor_font_plotter_freetype( FONT_PLOTTER self );
-#endif
\ No newline at end of file
+#endif
diff --git a/atari/plot/fontplot.c b/atari/plot/fontplot.c
index ba4e267..b80965b 100644
--- a/atari/plot/fontplot.c
+++ b/atari/plot/fontplot.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2010 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include "atari/plot/fontplot.h"
const struct s_font_driver_table_entry font_driver_table[] =
diff --git a/atari/redrawslots.h b/atari/redrawslots.h
index ae4b77f..d1f0fc2 100644
--- a/atari/redrawslots.h
+++ b/atari/redrawslots.h
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+
#ifndef ATARI_REDRAW_SLOTS_H
#define ATARI_REDRAW_SLOTS_H
diff --git a/atari/save.h b/atari/save.h
index 00852d0..0775723 100644
--- a/atari/save.h
+++ b/atari/save.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#ifndef NSATARI_SAVE_H
#define NSATARI_SAVE_H
diff --git a/atari/schedule.h b/atari/schedule.h
index 0ca3f91..e21b759 100755
--- a/atari/schedule.h
+++ b/atari/schedule.h
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Vincent Sanders <vince(a)simtec.co.uk>
+ * 2012 Ole Loots <ole(a)monochrom.net>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
diff --git a/atari/search.c b/atari/search.c
index 4d6f239..b5e2fdd 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
@@ -9,6 +27,7 @@
#include "desktop/gui.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/search.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -30,7 +49,7 @@ static void nsatari_search_add_recent(const char *string, void *p);
void nsatari_search_set_forward_state(bool active, void *p);
void nsatari_search_set_back_state(bool active, void *p);
-static struct search_callbacks nsatari_search_callbacks = {
+static struct gui_search_callbacks nsatari_search_callbacks = {
nsatari_search_set_forward_state,
nsatari_search_set_back_state,
nsatari_search_set_status,
@@ -238,34 +257,34 @@ void search_destroy( struct gui_window * gw )
SEARCH_FORM_SESSION open_browser_search( struct gui_window * gw )
{
char * title;
- SEARCH_FORM_SESSION sfs;
+ SEARCH_FORM_SESSION sfs;
GRECT pos, treesize;
OBJECT * tree = get_tree(SEARCH);
if( tree == NULL ){
return( NULL );
- }
+ }
sfs = calloc(1, sizeof(struct s_search_form_session));
if( sfs == NULL )
return( NULL );
-
+
title = (char*)messages_get("FindTextNS");
if( title == NULL )
title = (char*)"Find text ...";
- search_destroy( gw );
-
- /* setup dipslay position: right corner */
- treesize.g_x = 0;
- treesize.g_y = 0;
- treesize.g_w = tree->ob_width;
- treesize.g_h = tree->ob_height;
- wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
- pos.g_x = app.w - pos.g_w;
- pos.g_y = app.h - pos.g_h;
-
+ search_destroy( gw );
+
+ /* setup dipslay position: right corner */
+ treesize.g_x = 0;
+ treesize.g_y = 0;
+ treesize.g_w = tree->ob_width;
+ treesize.g_h = tree->ob_height;
+ wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
+ pos.g_x = app.w - pos.g_w;
+ pos.g_y = app.h - pos.g_h;
+
- current = sfs;
+ current = sfs;
sfs->bw = gw->browser->bw;
sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
NULL, title,
diff --git a/atari/search.h b/atari/search.h
index 7521004..7913803 100644
--- a/atari/search.h
+++ b/atari/search.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#ifndef NS_ATARI_SEARCH_H
#define NS_ATARI_SEARCH_H
@@ -21,4 +39,4 @@ typedef struct s_search_form_session * SEARCH_FORM_SESSION;
SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw);
void search_destroy( struct gui_window * gw );
-#endif
\ No newline at end of file
+#endif
diff --git a/atari/settings.c b/atari/settings.c
index b2a4baf..0192a97 100644
--- a/atari/settings.c
+++ b/atari/settings.c
@@ -1,3 +1,21 @@
+/*
+ * Copyright 2012 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -228,7 +246,7 @@ static colour color_popup(int x, int y, colour current)
#define GRID_ROWS 9
#define GRID_COLS 27
colour retval = current;
- int boxwidth=6, boxheight=8;
+ int boxwidth=6, boxheight=8;
struct bitmap *palette_img;
MFDB bg, screen;
GRECT bgarea = {x, y, GRID_COLS*boxwidth+4, GRID_ROWS*boxheight+4};
@@ -250,23 +268,23 @@ static colour color_popup(int x, int y, colour current)
.stroke_width = 2,
.fill_type = PLOT_OP_TYPE_NONE,
.fill_colour = 0
- };
-
+ };
+
/* create a palette array (web colors): */
for (r=0; r<6; r++) {
for (g=0; g<6; g++) {
for (b=0; b<6; b++) {
- palette[i] = ((web_std_colors[b]<<16)
- | (web_std_colors[g]<<8)
- | web_std_colors[r]);
+ palette[i] = ((web_std_colors[b]<<16)
+ | (web_std_colors[g]<<8)
+ | web_std_colors[r]);
i++;
}
}
}
-
+
/* setup the gray color values: */
int z = 0;
- colour grays[15] = {0x111111, 0x222222, 0x333333, 0x444444,
+ colour grays[15] = {0x111111, 0x222222, 0x333333, 0x444444,
0x555555, 0x666666, 0x777777, 0x888888,
0x999999, 0x999999, 0xAAAAAA, 0xBBBBBB,
0xCCCCCC, 0xDDDDDD, 0xEEEEEE};
@@ -277,19 +295,19 @@ static colour color_popup(int x, int y, colour current)
palette[i] = 0x000000;
z++;
}
-
+
/* hide the mouse */
v_hide_c (app.graf.handle);
-
- plot_set_dimensions(x, y,
+
+ plot_set_dimensions(x, y,
(GRID_COLS*boxwidth)+4, (GRID_ROWS*boxheight)+4);
plot_lock();
- // store background:
+ // store background:
short pxy[8];
init_mfdb(app.nplanes, bgarea.g_w, bgarea.g_h, 0, &bg);
init_mfdb(0, bgarea.g_w, bgarea.g_h, 0, &screen);
-
+
pxy[0] = bgarea.g_x;
pxy[1] = bgarea.g_y;
pxy[2] = bgarea.g_x + bgarea.g_w - 1;
@@ -303,31 +321,31 @@ static colour color_popup(int x, int y, colour current)
vro_cpyfm (app.graf.handle, S_ONLY, pxy, &screen, &bg);
/*
- plot_rectangle(x+1, y+1, x+(GRID_COLS*boxwidth)+3,
+ plot_rectangle(x+1, y+1, x+(GRID_COLS*boxwidth)+3,
y+(GRID_ROWS*boxheight)+3, &outline);
-
+
plot_line(x, y, x+(GRID_COLS*boxwidth)+2, y+(GRID_ROWS*boxheight)+2,
&outline);
*/
plot_line(x, y, x+(GRID_COLS*boxwidth)+2, y,
&outline);
- plot_line(x, y+(GRID_ROWS*boxheight)+2, x+(GRID_COLS*boxwidth)+2,
+ plot_line(x, y+(GRID_ROWS*boxheight)+2, x+(GRID_COLS*boxwidth)+2,
y+(GRID_ROWS*boxheight)+2,
&outline);
/* draw a 27*8 grid: */
for (i=0; i<243; i++){
drawcolour.fill_colour = palette[i];
- plot_rectangle(xpos+2, ypos+2, xpos+boxwidth+2, ypos+boxheight+2,
+ plot_rectangle(xpos+2, ypos+2, xpos+boxwidth+2, ypos+boxheight+2,
&drawcolour);
xpos += boxwidth;
if (xpos >= GRID_COLS*boxwidth) {
xpos = 0;
ypos += boxheight;
- }
+ }
}
-
+
/* restore the mouse */
v_show_c ( app.graf.handle, 1);
@@ -339,7 +357,7 @@ static colour color_popup(int x, int y, colour current)
/* calulate clicked grid coords: */
int row = ((evnt.my-y)/boxheight);
int col = ((evnt.mx-x)/boxwidth);
-
+
if (row >= 0 && row <= GRID_ROWS-1 && col >= 0 && col
<= GRID_COLS-1) {
assert( (GRID_COLS*row)+(col) >= 0 );
assert( (GRID_COLS*row)+(col) < 243 );
@@ -354,7 +372,7 @@ static colour color_popup(int x, int y, colour current)
#undef GRID_COLS
#undef GRID_ROWS
-
+
return(retval);
}
@@ -837,7 +855,7 @@ static void display_settings( void )
snprintf( spare, 255, "%3d", nsoption_int(font_size) );
set_text( CHOICES_EDIT_DEF_FONT_SIZE, spare , 3 );
- set_text(CHOICES_BT_TOOLBAR_ICONSET,
+ set_text(CHOICES_BT_TOOLBAR_ICONSET,
nsoption_charp(atari_image_toolbar_folder), LABEL_ICONSET_MAX_LEN);
tmp_option_atari_toolbar_bg = nsoption_int(atari_toolbar_bg);
diff --git a/atari/toolbar.c b/atari/toolbar.c
index b6dc468..3594d24 100755
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -33,6 +33,7 @@
#include "desktop/history_core.h"
#include "desktop/netsurf.h"
#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
#include "desktop/plotters.h"
diff --git a/beos/Makefile.target b/beos/Makefile.target
index ec8719e..be58be4 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -111,3 +111,27 @@ RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_BEOS)
EXETARGET := NetSurf
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-beos:
+# TODO:HAIKU -- not sure if throbber is needed. being left out for now.
+ mkdir -p $(DESTDIR)$(NETSURF_BEOS_BIN)
+ mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+# mkdir -p $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber
+ @copyattr -d $(EXETARGET) $(DESTDIR)$(NETSURF_BEOS_BIN)NetSurf
+ @cp -vRL beos/res/adblock.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ @cp -vRL beos/res/ca-bundle.txt $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ @cp -vRL beos/res/default.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ @cp -vRL beos/res/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+ @cp -vRL gtk/res/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES)
+# @cp -vRL beos/res/throbber/*.png $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber
+ gzip -9v < beos/res/messages > $(DESTDIR)$(NETSURF_BEOS_RESOURCES)messages
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-beos:
\ No newline at end of file
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 6795efd..4b16022 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -49,15 +49,13 @@ extern "C" {
#include "content/fetchers/resource.h"
#include "content/urldb.h"
#include "desktop/401login.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/cookies.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "desktop/options.h"
-//#include "render/box.h"
#include "render/form.h"
-//#include "render/html.h"
#include "utils/filename.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 8dde6e5..4003b09 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -41,7 +41,7 @@
#include <fs_attr.h>
extern "C" {
#include "content/content.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
@@ -49,10 +49,8 @@ extern "C" {
#include "desktop/options.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
-//#include "render/box.h"
#include "render/font.h"
#include "render/form.h"
-//#include "render/html.h"
#include "utils/messages.h"
#include "utils/schedule.h"
#include "utils/utils.h"
@@ -1316,13 +1314,7 @@ MENUHANDLER(save_box_tree)
struct browser_window *bw;
bw = nsbeos_get_browser_window(gw->top_level);
- if (bw->current_content &&
- bw->current_content->type ==
- CONTENT_HTML) {
- box_dump(fh,
- bw->current_content->data.html.layout,
- 0);
- }
+ browser_window_debug_dump(bw, f);
fclose(fh);
}
diff --git a/beos/window.cpp b/beos/window.cpp
index 89c3d5c..253b5d1 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -23,13 +23,12 @@
extern "C" {
#include "content/urldb.h"
#include "css/utils.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/options.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
#include "render/font.h"
-#include "render/box.h"
#include "utils/log.h"
#include "utils/types.h"
#include "utils/utf8.h"
@@ -1668,9 +1667,19 @@ bool gui_empty_clipboard(void)
return true;
}
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
BString s;
+ BFont font;
+ text_run *run = new text_run;
+
+ nsbeos_style_to_font(font, &fstyle);
+ run->offset = current_selection.Length();
+ run->font = font;
+ run->color = nsbeos_rgb_colour(fstyle->foreground);
+ current_selection_textruns.AddItem(run);
+
s.SetTo(text, length);
current_selection << s;
if (space)
@@ -1711,47 +1720,9 @@ bool gui_commit_clipboard(void)
return true;
}
-static bool copy_handler(const char *text, size_t length, struct box *box,
- void *handle, const char *whitespace_text,
- size_t whitespace_length)
-{
- bool space = false;
- //XXX: handle box->style to StyledEdit / RTF ?
- /* add any whitespace which precedes the text from this box */
- if (whitespace_text) {
- if (!gui_add_to_clipboard(whitespace_text,
- whitespace_length, false)) {
- return false;
- }
- }
-
- // add a text_run for StyledEdit-like text formating
- if (box && box->style) {
- text_run *run = new text_run;
- BFont font;
- plot_font_style_t style;
- font_plot_style_from_css(box->style, &style);
- nsbeos_style_to_font(font, &style);
- run->offset = current_selection.Length();
- run->font = font;
- css_color csscolor;
- if (css_computed_color(box->style, &csscolor) == CSS_COLOR_COLOR) {
- run->color = nsbeos_rgb_colour(nscss_color_to_ns(csscolor));
- }
- current_selection_textruns.AddItem(run);
- space = box->space != 0;
- }
-
- /* add the text from this box */
- if (!gui_add_to_clipboard(text, length, space))
- return false;
-
- return true;
-}
-
bool gui_copy_to_clipboard(struct selection *s)
{
- if (s->defined && selection_traverse(s, copy_handler, NULL))
+ if (s->defined && selection_copy_to_clipboard(s))
gui_commit_clipboard();
return true;
}
diff --git a/cocoa/BookmarksController.m b/cocoa/BookmarksController.m
index 031af6c..e258ca8 100644
--- a/cocoa/BookmarksController.m
+++ b/cocoa/BookmarksController.m
@@ -23,6 +23,7 @@
#import "cocoa/BrowserViewController.h"
#import "cocoa/gui.h"
+#import "desktop/browser_private.h"
#import "desktop/hotlist.h"
#import "desktop/tree.h"
#import "desktop/tree_url_node.h"
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index b1fdbea..203e7b1 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -23,7 +23,7 @@
#import "cocoa/LocalHistoryController.h"
#import "cocoa/BrowserWindowController.h"
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "desktop/history_core.h"
#import "desktop/plotters.h"
#import "desktop/textinput.h"
diff --git a/cocoa/BrowserViewController.m b/cocoa/BrowserViewController.m
index 3ae0210..d94b2ab 100644
--- a/cocoa/BrowserViewController.m
+++ b/cocoa/BrowserViewController.m
@@ -20,7 +20,7 @@
#import "cocoa/BrowserView.h"
#import "cocoa/BrowserWindowController.h"
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "desktop/history_core.h"
#import "desktop/textinput.h"
#import "desktop/options.h"
diff --git a/cocoa/FormSelectMenu.m b/cocoa/FormSelectMenu.m
index cfa4939..3aaeae5 100644
--- a/cocoa/FormSelectMenu.m
+++ b/cocoa/FormSelectMenu.m
@@ -19,6 +19,7 @@
#import "cocoa/FormSelectMenu.h"
#import "cocoa/coordinates.h"
+#import "desktop/browser_private.h"
#import "render/form.h"
@interface FormSelectMenu ()
diff --git a/cocoa/HistoryView.m b/cocoa/HistoryView.m
index 779af5a..31a8e24 100644
--- a/cocoa/HistoryView.m
+++ b/cocoa/HistoryView.m
@@ -23,7 +23,7 @@
#import "cocoa/LocalHistoryController.h"
#import "cocoa/BrowserView.h"
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "desktop/history_core.h"
#import "desktop/plotters.h"
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index b3ababd..635790a 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -187,6 +187,12 @@ endef
$(foreach lang,$(LANGUAGES),$(eval $(call make_lproj,$(lang),$(addprefix
cocoa/res/$(lang).lproj/,$(LOCALIZED_RESOURCES)))))
$(foreach lang,$(LANGUAGES),$(foreach xib,$(S_XIBS),$(eval $(call
compile_xib,$(xib),$(lang)))))
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-cocoa: NetSurf.app
+
NetSurf.app: NetSurf cocoa/Makefile.target $(R_RESOURCES)
NetSurf.app/Contents/Info.plist
$(VQ)echo Assembling NetSurf.app bundle
$(Q)mkdir -p NetSurf.app/Contents/MacOS
@@ -206,6 +212,12 @@ NetSurf.app/Contents/Info.plist: cocoa/res/NetSurf-Info.plist
cocoa/Makefile.tar
-e 's/$${NETSURF_SHORT_VERSION}/$(VERSION_MAJ).$(VERSION_MIN)/' \
< cocoa/res/NetSurf-Info.plist > NetSurf.app/Contents/Info.plist
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-cocoa: NetSurf.dmg
+
NetSurf.tmp.dmg: NetSurf.app
hdiutil create -size 8m -fs HFS+ -volname "NetSurf" $@
hdiutil attach $@
diff --git a/cocoa/PreferencesWindowController.m b/cocoa/PreferencesWindowController.m
index 7038647..2dbc5e0 100644
--- a/cocoa/PreferencesWindowController.m
+++ b/cocoa/PreferencesWindowController.m
@@ -22,7 +22,7 @@
#import "cocoa/gui.h"
#import "cocoa/BrowserViewController.h"
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "content/content.h"
#import "desktop/options.h"
diff --git a/cocoa/SearchWindowController.m b/cocoa/SearchWindowController.m
index 0f5ce85..858ed0e 100644
--- a/cocoa/SearchWindowController.m
+++ b/cocoa/SearchWindowController.m
@@ -26,7 +26,7 @@
static void cocoa_search_set_back( bool active, void *p );
static void cocoa_search_set_forward( bool active, void *p );
-static struct search_callbacks cocoa_search_callbacks = {
+static struct gui_search_callbacks cocoa_search_callbacks = {
.forward_state = cocoa_search_set_forward,
.back_state = cocoa_search_set_back,
.status = NULL,
diff --git a/cocoa/coordinates.h b/cocoa/coordinates.h
index 5d044b0..d137f15 100644
--- a/cocoa/coordinates.h
+++ b/cocoa/coordinates.h
@@ -19,7 +19,7 @@
#ifndef COCOA_COORDINATES_H
#define COCOA_COORDINATES_H
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "render/box.h"
extern CGFloat cocoa_scale_factor;
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 5d4bb01..a76924b 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -27,7 +27,7 @@
#import "desktop/gui.h"
#import "desktop/netsurf.h"
-#import "desktop/browser.h"
+#import "desktop/browser_private.h"
#import "desktop/options.h"
#import "desktop/textinput.h"
#import "desktop/selection.h"
diff --git a/cocoa/selection.m b/cocoa/selection.m
index 587f120..6bba74d 100644
--- a/cocoa/selection.m
+++ b/cocoa/selection.m
@@ -20,8 +20,8 @@
#import "cocoa/BrowserViewController.h"
+#import "desktop/browser_private.h"
#import "desktop/selection.h"
-#import "render/box.h"
static NSMutableString *cocoa_clipboard_string;
@@ -56,7 +56,8 @@ bool gui_empty_clipboard(void)
return true;
}
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
if (nil == cocoa_clipboard_string) return false;
diff --git a/content/content.c b/content/content.c
index f39ba91..b65e110 100644
--- a/content/content.c
+++ b/content/content.c
@@ -59,7 +59,6 @@ const char * const content_status_name[] = {
static nserror content_llcache_callback(llcache_handle *llcache,
const llcache_event *event, void *pw);
static void content_convert(struct content *c);
-static void content_update_status(struct content *c);
/**
@@ -169,7 +168,8 @@ nserror content_llcache_callback(llcache_handle *llcache,
(void) llcache_handle_get_source_data(llcache, &source_size);
- content_set_status(c, messages_get("Processing"), source_size);
+ content_set_status(c, messages_get("Processing"));
+ msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
content_convert(c);
@@ -182,7 +182,8 @@ nserror content_llcache_callback(llcache_handle *llcache,
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
break;
case LLCACHE_EVENT_PROGRESS:
- content_set_status(c, "%s", event->data.msg);
+ content_set_status(c, event->data.msg);
+ msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
break;
}
@@ -207,31 +208,7 @@ bool content_can_reformat(hlcache_handle *h)
}
-/**
- * Updates content with new status.
- *
- * The textual status contained in the content is updated with given string.
- *
- * \param status_message new textual status
- */
-
-void content_set_status(struct content *c, const char *status_message, ...)
-{
- va_list ap;
- int len;
-
- va_start(ap, status_message);
- if ((len = vsnprintf(c->sub_status, sizeof (c->sub_status),
- status_message, ap)) < 0 ||
- (int)sizeof (c->sub_status) <= len)
- c->sub_status[sizeof (c->sub_status) - 1] = '\0';
- va_end(ap);
-
- content_update_status(c);
-}
-
-
-void content_update_status(struct content *c)
+static void content_update_status(struct content *c)
{
if (c->status == CONTENT_STATUS_LOADING ||
c->status == CONTENT_STATUS_READY) {
@@ -245,8 +222,28 @@ void content_update_status(struct content *c)
"%s (%.1fs)", messages_get("Done"),
(float) time / 100);
}
+}
+
+
+/**
+ * Updates content with new status.
+ *
+ * The textual status contained in the content is updated with given string.
+ *
+ * \param status_message new textual status
+ */
+
+void content_set_status(struct content *c, const char *status_message)
+{
+ size_t len = strlen(status_message);
+
+ if (len >= sizeof(c->sub_status)) {
+ len = sizeof(c->sub_status) - 1;
+ }
+ memcpy(c->sub_status, status_message, len);
+ c->sub_status[len] = '\0';
- /* LOG(("%s", c->status_message)); */
+ content_update_status(c);
}
@@ -419,8 +416,14 @@ void content_mouse_track(hlcache_handle *h, struct browser_window
*bw,
struct content *c = hlcache_handle_get_content(h);
assert(c != NULL);
- if (c->handler->mouse_track != NULL)
+ if (c->handler->mouse_track != NULL) {
c->handler->mouse_track(c, bw, mouse, x, y);
+ } else {
+ union content_msg_data msg_data;
+ msg_data.pointer = BROWSER_POINTER_AUTO;
+ content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ }
+
return;
}
@@ -667,22 +670,20 @@ void content_broadcast(struct content *c, content_msg msg,
* \param bw browser window containing the content
* \param page content of type CONTENT_HTML containing c, or 0 if not an
* object within a page
- * \param box box containing c, or 0 if not an object
* \param params object parameters, or 0 if not an object
*
* Calls the open function for the content.
*/
void content_open(hlcache_handle *h, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params)
+ struct content *page, struct object_params *params)
{
struct content *c = hlcache_handle_get_content(h);
assert(c != 0);
LOG(("content %p %s", c,
nsurl_access(llcache_handle_get_url(c->llcache))));
if (c->handler->open != NULL)
- c->handler->open(c, bw, page, box, params);
+ c->handler->open(c, bw, page, params);
}
@@ -761,6 +762,16 @@ bool content_drop_file_at_point(struct hlcache_handle *h,
}
+void content_debug_dump(struct hlcache_handle *h, FILE *f)
+{
+ struct content *c = hlcache_handle_get_content(h);
+ assert(c != 0);
+
+ if (c->handler->debug_dump != NULL)
+ c->handler->debug_dump(c, f);
+}
+
+
void content_add_error(struct content *c, const char *token,
unsigned int line)
{
@@ -788,8 +799,8 @@ content_find_rfc5988_link(hlcache_handle *h, lwc_string *rel)
bool rel_match = false;
while (link != NULL) {
- lwc_string_caseless_isequal(link->rel, rel, &rel_match);
- if (rel_match) {
+ if (lwc_string_caseless_isequal(link->rel, rel,
+ &rel_match) == lwc_error_ok && rel_match) {
break;
}
link = link->next;
diff --git a/content/content.h b/content/content.h
index 98879f8..b07af4f 100644
--- a/content/content.h
+++ b/content/content.h
@@ -27,6 +27,7 @@
#define _NETSURF_CONTENT_CONTENT_H_
#include <stdbool.h>
+#include <stdio.h>
#include <libwapcaplet/libwapcaplet.h>
@@ -40,7 +41,6 @@
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
-struct box;
struct browser_window;
struct content;
struct llcache_handle;
@@ -74,6 +74,11 @@ typedef enum {
CONTENT_MSG_DOWNLOAD, /**< download, not for display */
CONTENT_MSG_LINK, /**< RFC5988 link */
CONTENT_MSG_GETCTX, /**< Javascript context */
+ CONTENT_MSG_SCROLL, /**< Request to scroll content */
+ CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */
+ CONTENT_MSG_SAVELINK, /**< Allow URL to be saved */
+ CONTENT_MSG_POINTER, /**< Wants a specific mouse pointer set */
+ CONTENT_MSG_PASTE /**< Inform that content wants clipboard paste */
} content_msg;
/** RFC5988 metadata link */
@@ -106,15 +111,53 @@ union content_msg_data {
int object_width, object_height;
} redraw;
/** CONTENT_MSG_REFRESH - Minimum delay */
- int delay;
+ int delay;
/** CONTENT_MSG_REFORMAT - Reformat should not cause a redraw */
bool background;
+ /** CONTENT_MSG_STATUS - Status message update. If NULL, the content's
+ * internal status text has been updated, and listener should use
+ * content_get_status_message() */
+ const char *explicit_status_text;
/** CONTENT_MSG_DOWNLOAD - Low-level cache handle */
struct llcache_handle *download;
/** CONTENT_MSG_RFC5988_LINK - rfc5988 link data */
struct content_rfc5988_link *rfc5988_link;
/** CONTENT_MSG_GETCTX - Javascript context */
struct jscontext **jscontext;
+ /** CONTENT_MSG_SCROLL - Part of content to scroll to show */
+ struct {
+ /** if true, scroll to show area given by (x0, y0) and (x1,y1).
+ * if false, scroll point (x0, y0) to top left of viewport */
+ bool area;
+ int x0, y0;
+ int x1, y1;
+ } scroll;
+ /** CONTENT_MSG_DRAGSAVE - Drag save a content */
+ struct {
+ enum {
+ CONTENT_SAVE_ORIG,
+ CONTENT_SAVE_NATIVE,
+ CONTENT_SAVE_COMPLETE,
+ CONTENT_SAVE_SOURCE
+ } type;
+ /** if NULL, save the content generating the message */
+ struct hlcache_handle *content;
+ } dragsave;
+ /** CONTENT_MSG_SAVELINK - Save a URL */
+ struct {
+ const char *url;
+ const char *title;
+ } savelink;
+ /** CONTENT_MSG_POINTER - Mouse pointer to set */
+ browser_pointer_shape pointer;
+ /** CONTENT_MSG_PASTE - Content requests that clipboard is pasted */
+ struct {
+ /* TODO: Get rid of these coords.
+ * browser_window_paste_text doesn't take coords, but
+ * RISC OS front end is doing something different. */
+ int x;
+ int y;
+ } paste;
};
/** parameters to content redraw */
@@ -175,8 +218,7 @@ void content_mouse_action(struct hlcache_handle *h, struct
browser_window *bw,
bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx);
void content_open(struct hlcache_handle *h, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
void content_close(struct hlcache_handle *h);
struct selection *content_get_selection(struct hlcache_handle *h);
void content_get_contextual_content(struct hlcache_handle *h,
@@ -185,6 +227,7 @@ bool content_scroll_at_point(struct hlcache_handle *h,
int x, int y, int scrx, int scry);
bool content_drop_file_at_point(struct hlcache_handle *h,
int x, int y, char *file);
+void content_debug_dump(struct hlcache_handle *h, FILE *f);
struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *c,
lwc_string *rel);
diff --git a/content/content_protected.h b/content/content_protected.h
index ad0b0af..36a053b 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -62,9 +62,7 @@ struct content_handler {
const struct rect *clip,
const struct redraw_context *ctx);
void (*open)(struct content *c, struct browser_window *bw,
- struct content *page,
- struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
void (*close)(struct content *c);
struct selection * (*get_selection)(struct content *c);
void (*get_contextual_content)(struct content *c, int x, int y,
@@ -73,6 +71,7 @@ struct content_handler {
int scrx, int scry);
bool (*drop_file_at_point)(struct content *c, int x, int y,
char *file);
+ void (*debug_dump)(struct content *c, FILE *f);
nserror (*clone)(const struct content *old, struct content **newc);
bool (*matches_quirks)(const struct content *c, bool quirks);
content_type (*type)(void);
@@ -160,7 +159,7 @@ void content_set_ready(struct content *c);
void content_set_done(struct content *c);
void content_set_error(struct content *c);
-void content_set_status(struct content *c, const char *status_message, ...);
+void content_set_status(struct content *c, const char *status_message);
void content_broadcast(struct content *c, content_msg msg,
union content_msg_data data);
void content_add_error(struct content *c, const char *token,
diff --git a/content/fetch.c b/content/fetch.c
index 8c725af..2b16512 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -291,9 +291,15 @@ struct fetch * fetch_start(nsurl *url, nsurl *referer,
*/
bool match1;
bool match2;
- lwc_string_isequal(scheme, ref_scheme, &match);
- lwc_string_isequal(scheme, fetch_https_lwc, &match1);
- lwc_string_isequal(ref_scheme, fetch_http_lwc, &match2);
+ if (lwc_string_isequal(scheme, ref_scheme, &match) != lwc_error_ok) {
+ match = false;
+ }
+ if (lwc_string_isequal(scheme, fetch_https_lwc, &match1) != lwc_error_ok) {
+ match1 = false;
+ }
+ if (lwc_string_isequal(ref_scheme, fetch_http_lwc, &match2) != lwc_error_ok) {
+ match2= false;
+ }
if (match == true || (match1 == true && match2 == true))
fetch->send_referer = true;
}
@@ -306,8 +312,7 @@ struct fetch * fetch_start(nsurl *url, nsurl *referer,
/* Pick the scheme ops */
while (fetcher) {
- lwc_string_isequal(fetcher->scheme_name, scheme, &match);
- if (match == true) {
+ if ((lwc_string_isequal(fetcher->scheme_name, scheme, &match) == lwc_error_ok)
&& (match == true)) {
fetch->ops = fetcher;
break;
}
@@ -542,9 +547,9 @@ bool fetch_can_fetch(const nsurl *url)
lwc_string *scheme = nsurl_get_component(url, NSURL_SCHEME);
while (fetcher != NULL) {
- lwc_string_isequal(fetcher->scheme_name, scheme, &match);
- if (match == true)
+ if (lwc_string_isequal(fetcher->scheme_name, scheme, &match) == lwc_error_ok
&& match == true) {
break;
+ }
fetcher = fetcher->next_fetcher;
}
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 383e3c0..3f8989e 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -280,7 +280,7 @@ static void fetch_data_poll(lwc_string *scheme)
if (c->aborted == false) {
snprintf(header, sizeof header,
- "Content-Length: %zd",
+ "Content-Length: %"SSIZET_FMT,
c->datalen);
msg.type = FETCH_HEADER;
msg.data.header_or_data.buf =
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index e3bb63e..abedaa7 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -34,9 +34,14 @@
#include <limits.h>
#include <stdarg.h>
+#include "utils/config.h"
+
+#ifdef HAVE_MMAP
+#include <sys/mman.h>
+#endif
+
#include <libwapcaplet/libwapcaplet.h>
-#include "utils/config.h"
#include "content/dirlist.h"
#include "content/fetch.h"
#include "content/fetchers/file.h"
@@ -249,13 +254,11 @@ fetch_file_process_error_aborted:
static void fetch_file_process_plain(struct fetch_file_context *ctx,
struct stat *fdstat)
{
+#ifdef HAVE_MMAP
fetch_msg msg;
char *buf;
size_t buf_size;
- ssize_t tot_read = 0;
- ssize_t res;
-
int fd; /**< The file descriptor of the object */
/* Check if we can just return not modified */
@@ -280,13 +283,91 @@ static void fetch_file_process_plain(struct fetch_file_context
*ctx,
buf_size = FETCH_FILE_MAX_BUF_SIZE;
/* allocate the buffer storage */
+ buf = mmap(NULL, buf_size, PROT_READ, MAP_SHARED, fd, 0);
+ if (buf == MAP_FAILED) {
+ msg.type = FETCH_ERROR;
+ msg.data.error = "Unable to map memory for file data buffer";
+ fetch_file_send_callback(&msg, ctx);
+ close(fd);
+ return;
+ }
+
+ /* fetch is going to be successful */
+ fetch_set_http_code(ctx->fetchh, 200);
+
+ /* Any callback can result in the fetch being aborted.
+ * Therefore, we _must_ check for this after _every_ call to
+ * fetch_file_send_callback().
+ */
+
+ /* content type */
+ if (fetch_file_send_header(ctx, "Content-Type: %s",
+ fetch_filetype(ctx->path)))
+ goto fetch_file_process_aborted;
+
+ /* content length */
+ if (fetch_file_send_header(ctx, "Content-Length: %"SSIZET_FMT,
fdstat->st_size))
+ goto fetch_file_process_aborted;
+
+ /* create etag */
+ if (fetch_file_send_header(ctx, "ETag: \"%10" PRId64
"\"",
+ (int64_t) fdstat->st_mtime))
+ goto fetch_file_process_aborted;
+
+
+ msg.type = FETCH_DATA;
+ msg.data.header_or_data.buf = (const uint8_t *) buf;
+ msg.data.header_or_data.len = buf_size;
+ fetch_file_send_callback(&msg, ctx);
+
+ if (ctx->aborted == false) {
+ msg.type = FETCH_FINISHED;
+ fetch_file_send_callback(&msg, ctx);
+ }
+
+fetch_file_process_aborted:
+
+ munmap(buf, buf_size);
+ close(fd);
+#else
+ fetch_msg msg;
+ char *buf;
+ size_t buf_size;
+
+ ssize_t tot_read = 0;
+ ssize_t res;
+
+ FILE *infile;
+
+ /* Check if we can just return not modified */
+ if (ctx->file_etag != 0 && ctx->file_etag == fdstat->st_mtime) {
+ fetch_set_http_code(ctx->fetchh, 304);
+ msg.type = FETCH_NOTMODIFIED;
+ fetch_file_send_callback(&msg, ctx);
+ return;
+ }
+
+ infile = fopen(ctx->path, "rb");
+ if (infile == NULL) {
+ /* process errors as appropriate */
+ fetch_file_process_error(ctx,
+ fetch_file_errno_to_http_code(errno));
+ return;
+ }
+
+ /* set buffer size */
+ buf_size = fdstat->st_size;
+ if (buf_size > FETCH_FILE_MAX_BUF_SIZE)
+ buf_size = FETCH_FILE_MAX_BUF_SIZE;
+
+ /* allocate the buffer storage */
buf = malloc(buf_size);
if (buf == NULL) {
msg.type = FETCH_ERROR;
msg.data.error =
"Unable to allocate memory for file data buffer";
fetch_file_send_callback(&msg, ctx);
- close(fd);
+ fclose(infile);
return;
}
@@ -304,7 +385,7 @@ static void fetch_file_process_plain(struct fetch_file_context *ctx,
goto fetch_file_process_aborted;
/* content length */
- if (fetch_file_send_header(ctx, "Content-Length: %zd", fdstat->st_size))
+ if (fetch_file_send_header(ctx, "Content-Length: %"SSIZET_FMT,
fdstat->st_size))
goto fetch_file_process_aborted;
/* create etag */
@@ -314,21 +395,20 @@ static void fetch_file_process_plain(struct fetch_file_context
*ctx,
/* main data loop */
while (tot_read < fdstat->st_size) {
- res = read(fd, buf, buf_size);
- if (res == -1) {
- msg.type = FETCH_ERROR;
- msg.data.error = "Error reading file";
- fetch_file_send_callback(&msg, ctx);
- goto fetch_file_process_aborted;
- }
-
+ res = fread(buf, 1, buf_size, infile);
if (res == 0) {
- msg.type = FETCH_ERROR;
- msg.data.error = "Unexpected EOF reading file";
- fetch_file_send_callback(&msg, ctx);
- goto fetch_file_process_aborted;
+ if (feof(infile)) {
+ msg.type = FETCH_ERROR;
+ msg.data.error = "Unexpected EOF reading file";
+ fetch_file_send_callback(&msg, ctx);
+ goto fetch_file_process_aborted;
+ } else {
+ msg.type = FETCH_ERROR;
+ msg.data.error = "Error reading file";
+ fetch_file_send_callback(&msg, ctx);
+ goto fetch_file_process_aborted;
+ }
}
-
tot_read += res;
msg.type = FETCH_DATA;
@@ -345,8 +425,9 @@ static void fetch_file_process_plain(struct fetch_file_context *ctx,
fetch_file_process_aborted:
- close(fd);
+ fclose(infile);
free(buf);
+#endif
return;
}
diff --git a/css/select.c b/css/select.c
index fa38b4e..84b8550 100644
--- a/css/select.c
+++ b/css/select.c
@@ -801,8 +801,7 @@ css_error node_has_name(void *pw, void *node,
nscss_select_ctx *ctx = pw;
dom_node *n = node;
- lwc_string_isequal(qname->name, ctx->universal, match);
- if (*match == false) {
+ if (lwc_string_isequal(qname->name, ctx->universal, match) == lwc_error_ok
&& *match == false) {
dom_string *name;
dom_exception err;
diff --git a/desktop/browser.c b/desktop/browser.c
index bd819b4..5175fc4 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -42,7 +42,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/401login.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
#include "desktop/history_core.h"
@@ -419,7 +419,7 @@ browser_drag_type browser_window_get_drag_type(struct browser_window
*bw)
/* exported interface, documented in browser.h */
struct browser_window * browser_window_get_root(struct browser_window *bw)
{
- while (bw && !bw->window && bw->parent) {
+ while (bw && bw->parent) {
bw = bw->parent;
}
return bw;
@@ -549,6 +549,7 @@ void browser_window_get_contextual_content(struct browser_window *bw,
data->link_url = NULL;
data->object = NULL;
data->main = NULL;
+ data->form_features = CTX_FORM_NONE;
browser_window__get_contextual_content(bw, x, y, data);
}
@@ -648,6 +649,13 @@ bool browser_window_drop_file_at_point(struct browser_window *bw,
return false;
}
+/* exported interface, documented in browser.h */
+void browser_window_debug_dump(struct browser_window *bw, FILE *f)
+{
+ if (bw->current_content != NULL)
+ content_debug_dump(bw->current_content, f);
+}
+
/**
* Create and open a new root browser window with the given page.
@@ -1003,6 +1011,9 @@ void browser_window_go_post(struct browser_window *bw, const char
*url,
warn_user("NoMemory", 0);
}
+
+ /* Record time */
+ bw->last_action = wallclock();
}
@@ -1244,7 +1255,7 @@ nserror browser_window_callback(hlcache_handle *c,
/* new content; set scroll_to_top */
browser_window_update(bw, true);
- content_open(c, bw, 0, 0, 0);
+ content_open(c, bw, 0, 0);
browser_window_set_status(bw, content_get_status_message(c));
/* history */
@@ -1323,7 +1334,24 @@ nserror browser_window_callback(hlcache_handle *c,
break;
case CONTENT_MSG_STATUS:
- browser_window_set_status(bw, content_get_status_message(c));
+ if (event->data.explicit_status_text == NULL) {
+ /* Object content's status text updated */
+ const char *status = NULL;
+ if (bw->loading_content != NULL)
+ /* Give preference to any loading content */
+ status = content_get_status_message(
+ bw->loading_content);
+
+ if (status == NULL)
+ status = content_get_status_message(c);
+
+ if (status != NULL)
+ browser_window_set_status(bw, status);
+ } else {
+ /* Object content wants to set explicit message */
+ browser_window_set_status(bw,
+ event->data.explicit_status_text);
+ }
break;
case CONTENT_MSG_REFORMAT:
@@ -1372,18 +1400,22 @@ nserror browser_window_callback(hlcache_handle *c,
if (lwc_intern_string("icon", SLEN("icon"),
&icon_str) == lwc_error_ok) {
- lwc_string_caseless_isequal(
+ if (lwc_string_caseless_isequal(
event->data.rfc5988_link->rel,
- icon_str, &icon_match);
+ icon_str, &icon_match) != lwc_error_ok) {
+ icon_match = false;
+ }
lwc_string_unref(icon_str);
}
if (lwc_intern_string("shortcut icon", SLEN("shortcut icon"),
&shortcut_icon_str) == lwc_error_ok) {
- lwc_string_caseless_isequal(
+ if (lwc_string_caseless_isequal(
event->data.rfc5988_link->rel,
shortcut_icon_str,
- &shortcut_icon_match);
+ &shortcut_icon_match) != lwc_error_ok) {
+ shortcut_icon_match = false;
+ }
lwc_string_unref(shortcut_icon_str);
}
@@ -1407,6 +1439,79 @@ nserror browser_window_callback(hlcache_handle *c,
}
break;
+ case CONTENT_MSG_SCROLL:
+ /* Content wants to be scrolled */
+ if (bw->current_content != c)
+ break;
+
+ if (event->data.scroll.area) {
+ struct rect rect = {
+ .x0 = event->data.scroll.x0,
+ .y0 = event->data.scroll.y0,
+ .x1 = event->data.scroll.x1,
+ .y1 = event->data.scroll.y1
+ };
+ browser_window_scroll_visible(bw, &rect);
+ } else {
+ browser_window_set_scroll(bw,
+ event->data.scroll.x0,
+ event->data.scroll.y0);
+ }
+
+ break;
+
+ case CONTENT_MSG_DRAGSAVE:
+ {
+ /* Content wants drag save of a content */
+ struct browser_window *root = browser_window_get_root(bw);
+ hlcache_handle *save = event->data.dragsave.content;
+
+ if (save == NULL) {
+ save = c;
+ }
+
+ switch(event->data.dragsave.type) {
+ case CONTENT_SAVE_ORIG:
+ gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, save,
+ root->window);
+ break;
+ case CONTENT_SAVE_NATIVE:
+ gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, save,
+ root->window);
+ break;
+ case CONTENT_SAVE_COMPLETE:
+ gui_drag_save_object(GUI_SAVE_COMPLETE, save,
+ root->window);
+ break;
+ case CONTENT_SAVE_SOURCE:
+ gui_drag_save_object(GUI_SAVE_SOURCE, save,
+ root->window);
+ break;
+ }
+ }
+ break;
+
+ case CONTENT_MSG_SAVELINK:
+ {
+ /* Content wants a link to be saved */
+ struct browser_window *root = browser_window_get_root(bw);
+ gui_window_save_link(root->window,
+ event->data.savelink.url,
+ event->data.savelink.title);
+ }
+ break;
+
+ case CONTENT_MSG_POINTER:
+ /* Content wants to have specific mouse pointer */
+ browser_window_set_pointer(bw, event->data.pointer);
+ break;
+
+ case CONTENT_MSG_PASTE:
+ /* Content wants a clipboard paste */
+ gui_paste_from_clipboard(bw->window,
+ event->data.paste.x, event->data.paste.y);
+ break;
+
default:
assert(0);
}
@@ -1854,14 +1959,37 @@ void browser_window_set_status(struct browser_window *bw, const
char *text)
*/
void browser_window_set_pointer(struct browser_window *bw,
- gui_pointer_shape shape)
+ browser_pointer_shape shape)
{
struct browser_window *root = browser_window_get_root(bw);
+ gui_pointer_shape gui_shape;
+ bool loading;
assert(root);
assert(root->window);
- gui_window_set_pointer(root->window, shape);
+ loading = (bw->loading_content != NULL || (bw->current_content &&
+ content_get_status(bw->current_content) ==
+ CONTENT_STATUS_READY));
+
+ if (wallclock() - bw->last_action < 100 && loading) {
+ /* If loading and less than 1 second since last link followed,
+ * force progress indicator pointer */
+ gui_shape = GUI_POINTER_PROGRESS;
+
+ } else if (shape == BROWSER_POINTER_AUTO) {
+ /* Up to browser window to decide */
+ if (loading)
+ gui_shape = GUI_POINTER_PROGRESS;
+ else
+ gui_shape = GUI_POINTER_DEFAULT;
+
+ } else {
+ /* Use what we were told */
+ gui_shape = (gui_pointer_shape)shape;
+ }
+
+ gui_window_set_pointer(root->window, gui_shape);
}
@@ -2334,7 +2462,7 @@ void browser_window_mouse_track(struct browser_window *bw,
{
hlcache_handle *c = bw->current_content;
const char *status = NULL;
- gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
+ browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT;
if (bw->window != NULL && bw->drag_window && bw !=
bw->drag_window) {
/* This is the root browser window and there's an active drag
@@ -2415,7 +2543,7 @@ void browser_window_mouse_track(struct browser_window *bw,
/* Start a scrollbar drag, or continue existing drag */
status = scrollbar_mouse_action(bw->scroll_x, mouse,
scr_x, scr_y);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
if (status != NULL)
browser_window_set_status(bw, status);
@@ -2440,7 +2568,7 @@ void browser_window_mouse_track(struct browser_window *bw,
/* Start a scrollbar drag, or continue existing drag */
status = scrollbar_mouse_action(bw->scroll_y, mouse,
scr_x, scr_y);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
if (status != NULL)
browser_window_set_status(bw, status);
@@ -2486,7 +2614,7 @@ void browser_window_mouse_click(struct browser_window *bw,
{
hlcache_handle *c = bw->current_content;
const char *status = NULL;
- gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
+ browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT;
if (bw->children) {
/* Browser window has children (frames) */
@@ -2534,7 +2662,7 @@ void browser_window_mouse_click(struct browser_window *bw,
scr_y > 0 && scr_y < SCROLLBAR_WIDTH) {
status = scrollbar_mouse_action(bw->scroll_x, mouse,
scr_x, scr_y);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
if (status != NULL)
browser_window_set_status(bw, status);
@@ -2555,7 +2683,7 @@ void browser_window_mouse_click(struct browser_window *bw,
scr_x > 0 && scr_x < SCROLLBAR_WIDTH) {
status = scrollbar_mouse_action(bw->scroll_y, mouse,
scr_x, scr_y);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
if (status != NULL)
browser_window_set_status(bw, status);
@@ -2582,7 +2710,7 @@ void browser_window_mouse_click(struct browser_window *bw,
else if (mouse & (BROWSER_MOUSE_DRAG_1 |
BROWSER_MOUSE_DRAG_2)) {
browser_window_page_drag_start(bw, x, y);
- browser_window_set_pointer(bw, GUI_POINTER_MOVE);
+ browser_window_set_pointer(bw, BROWSER_POINTER_MOVE);
}
break;
}
diff --git a/desktop/browser.h b/desktop/browser.h
index c8af788..d5ad064 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -24,28 +24,20 @@
#ifndef _NETSURF_DESKTOP_BROWSER_H_
#define _NETSURF_DESKTOP_BROWSER_H_
-#include <inttypes.h>
#include <stdbool.h>
-#include <time.h>
#include "content/content.h"
+#include "desktop/frame_types.h"
#include "desktop/gui.h"
#include "desktop/mouse.h"
#include "utils/types.h"
-#include "frame_types.h"
-struct box;
+struct browser_window;
struct hlcache_handle;
-struct form;
-struct form_control;
struct gui_window;
struct history;
struct selection;
-struct browser_window;
-struct url_data;
-struct bitmap;
-struct scroll_msg_data;
struct fetch_multipart_data;
typedef bool (*browser_caret_callback)(struct browser_window *bw, uint32_t key,
@@ -68,144 +60,6 @@ typedef enum {
DRAGGING_OTHER
} browser_drag_type;
-/** Browser window data. */
-struct browser_window {
- /** Page currently displayed, or 0. Must have status READY or DONE. */
- struct hlcache_handle *current_content;
- /** Page being loaded, or 0. */
- struct hlcache_handle *loading_content;
-
- /** Page Favicon */
- struct hlcache_handle *current_favicon;
- /** handle for favicon which we started loading early */
- struct hlcache_handle *loading_favicon;
- /** favicon fetch already failed - prevents infinite error looping */
- bool failed_favicon;
-
- /** Window history structure. */
- struct history *history;
-
- /** Handler for keyboard input, or 0. */
- browser_caret_callback caret_callback;
- /** Handler for pasting text, or 0. */
- browser_paste_callback paste_callback;
- /** Handler for repositioning caret, or 0. */
- browser_move_callback move_callback;
-
- /** User parameters for caret_callback, paste_callback, and
- * move_callback */
- void *caret_p1;
- void *caret_p2;
-
- /** Platform specific window data. */
- struct gui_window *window;
-
- /** Busy indicator is active. */
- bool throbbing;
- /** Add loading_content to the window history when it loads. */
- bool history_add;
-
- /** Fragment identifier for current_content. */
- lwc_string *frag_id;
-
- /** Current drag status. */
- browser_drag_type drag_type;
-
- /** Current drag's browser window, when not in root bw. */
- struct browser_window *drag_window;
-
- /** Mouse position at start of current scroll drag. */
- int drag_start_x;
- int drag_start_y;
- /** Scroll offsets at start of current scroll draw. */
- int drag_start_scroll_x;
- int drag_start_scroll_y;
- /** Frame resize directions for current frame resize drag. */
- unsigned int drag_resize_left : 1;
- unsigned int drag_resize_right : 1;
- unsigned int drag_resize_up : 1;
- unsigned int drag_resize_down : 1;
-
- /** Current fetch is download */
- bool download;
-
- /** Refresh interval (-1 if undefined) */
- int refresh_interval;
-
- /** Window has been resized, and content needs reformatting. */
- bool reformat_pending;
-
- /** Window dimensions */
- int x;
- int y;
- int width;
- int height;
-
- struct scrollbar *scroll_x; /**< Horizontal scroll. */
- struct scrollbar *scroll_y; /**< Vertical scroll. */
-
- /** scale of window contents */
- float scale;
-
- /** Window characteristics */
- enum {
- BROWSER_WINDOW_NORMAL,
- BROWSER_WINDOW_IFRAME,
- BROWSER_WINDOW_FRAME,
- BROWSER_WINDOW_FRAMESET,
- } browser_window_type;
-
- /** frameset characteristics */
- int rows;
- int cols;
-
- /** frame dimensions */
- struct frame_dimension frame_width;
- struct frame_dimension frame_height;
- int margin_width;
- int margin_height;
-
- /** frame name for targetting */
- char *name;
-
- /** frame characteristics */
- bool no_resize;
- frame_scrolling scrolling;
- bool border;
- colour border_colour;
-
- /** iframe parent box */
- struct box *box;
-
- /** [cols * rows] children */
- struct browser_window *children;
- struct browser_window *parent;
-
- /** [iframe_count] iframes */
- int iframe_count;
- struct browser_window *iframes;
-
- /** browser window child of root browser window which has input focus */
- struct browser_window *focus;
-
- /** Last time a link was followed in this window */
- unsigned int last_action;
-
- /** Current selection, or NULL if none */
- struct selection *cur_sel;
-
- /** Current context for free text search, or NULL if none */
- struct search_context *cur_search;
-
- /** current javascript context */
- struct jscontext *jsctx;
-
- /** cache of the currently displayed status text. */
- char *status_text; /**< Current status bar text. */
- int status_text_len; /**< Length of the browser_window::status_text buffer. */
- int status_match; /**< Number of times an idempotent status-set operation was
performed. */
- int status_miss; /**< Number of times status was really updated. */
-};
extern bool browser_reformat_pending;
@@ -269,13 +123,14 @@ bool browser_window_scroll_at_point(struct browser_window *bw,
int x, int y, int scrx, int scry);
/**
- * Drop a file onto a browser window at a particular point.
+ * Drop a file onto a browser window at a particular point, or determine if a
+ * file may be dropped onto the content at given point.
*
* \param bw browser window to look inside
* \param x x-coordinate of point of interest
* \param y y-coordinate of point of interest
- * \param file path to file to be dropped
- * \return true iff file drop has been handled
+ * \param file path to file to be dropped, or NULL to know if drop allowed
+ * \return true iff file drop has been handled, or if drop possible (NULL file)
*/
bool browser_window_drop_file_at_point(struct browser_window *bw,
int x, int y, char *file);
@@ -291,8 +146,6 @@ struct browser_window *browser_window_find_target(
struct browser_window *bw, const char *target,
browser_mouse_state mouse);
-void browser_redraw_box(struct hlcache_handle *c, struct box *box);
-
void browser_select_menu_callback(void *client_data,
int x, int y, int width, int height);
@@ -301,7 +154,7 @@ void browser_window_redraw_rect(struct browser_window *bw, int x, int
y,
void browser_window_set_status(struct browser_window *bw, const char *text);
void browser_window_set_pointer(struct browser_window *bw,
- gui_pointer_shape shape);
+ browser_pointer_shape shape);
void browser_window_page_drag_start(struct browser_window *bw, int x, int y);
bool browser_window_back_available(struct browser_window *bw);
@@ -458,6 +311,15 @@ void browser_window_set_selection(struct browser_window *bw,
struct selection *browser_window_get_selection(struct browser_window *bw);
+/**
+ * Dump debug info concerning the browser window's contents to file
+ *
+ * \param bw The browser window
+ * \param bw The file to dump to
+ */
+void browser_window_debug_dump(struct browser_window *bw, FILE *f);
+
+
/* In platform specific hotlist.c. */
void hotlist_visited(struct hlcache_handle *c);
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
new file mode 100644
index 0000000..91372ac
--- /dev/null
+++ b/desktop/browser_private.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2003 Phil Mellor <monkeyson(a)users.sourceforge.net>
+ * Copyright 2006 James Bursa <bursa(a)users.sourceforge.net>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Browser window private structure.
+ */
+
+#ifndef _NETSURF_DESKTOP_BROWSER_PRIVATE_H_
+#define _NETSURF_DESKTOP_BROWSER_PRIVATE_H_
+
+#include <stdbool.h>
+
+#include "desktop/browser.h"
+
+
+struct box;
+struct hlcache_handle;
+struct gui_window;
+struct history;
+struct selection;
+
+/** Browser window data. */
+struct browser_window {
+ /** Page currently displayed, or 0. Must have status READY or DONE. */
+ struct hlcache_handle *current_content;
+ /** Page being loaded, or 0. */
+ struct hlcache_handle *loading_content;
+
+ /** Page Favicon */
+ struct hlcache_handle *current_favicon;
+ /** handle for favicon which we started loading early */
+ struct hlcache_handle *loading_favicon;
+ /** favicon fetch already failed - prevents infinite error looping */
+ bool failed_favicon;
+
+ /** Window history structure. */
+ struct history *history;
+
+ /** Handler for keyboard input, or 0. */
+ browser_caret_callback caret_callback;
+ /** Handler for pasting text, or 0. */
+ browser_paste_callback paste_callback;
+ /** Handler for repositioning caret, or 0. */
+ browser_move_callback move_callback;
+
+ /** User parameters for caret_callback, paste_callback, and
+ * move_callback */
+ void *caret_p1;
+ void *caret_p2;
+
+ /** Platform specific window data. */
+ struct gui_window *window;
+
+ /** Busy indicator is active. */
+ bool throbbing;
+ /** Add loading_content to the window history when it loads. */
+ bool history_add;
+
+ /** Fragment identifier for current_content. */
+ lwc_string *frag_id;
+
+ /** Current drag status. */
+ browser_drag_type drag_type;
+
+ /** Current drag's browser window, when not in root bw. */
+ struct browser_window *drag_window;
+
+ /** Mouse position at start of current scroll drag. */
+ int drag_start_x;
+ int drag_start_y;
+ /** Scroll offsets at start of current scroll draw. */
+ int drag_start_scroll_x;
+ int drag_start_scroll_y;
+ /** Frame resize directions for current frame resize drag. */
+ unsigned int drag_resize_left : 1;
+ unsigned int drag_resize_right : 1;
+ unsigned int drag_resize_up : 1;
+ unsigned int drag_resize_down : 1;
+
+ /** Current fetch is download */
+ bool download;
+
+ /** Refresh interval (-1 if undefined) */
+ int refresh_interval;
+
+ /** Window has been resized, and content needs reformatting. */
+ bool reformat_pending;
+
+ /** Window dimensions */
+ int x;
+ int y;
+ int width;
+ int height;
+
+ struct scrollbar *scroll_x; /**< Horizontal scroll. */
+ struct scrollbar *scroll_y; /**< Vertical scroll. */
+
+ /** scale of window contents */
+ float scale;
+
+ /** Window characteristics */
+ enum {
+ BROWSER_WINDOW_NORMAL,
+ BROWSER_WINDOW_IFRAME,
+ BROWSER_WINDOW_FRAME,
+ BROWSER_WINDOW_FRAMESET,
+ } browser_window_type;
+
+ /** frameset characteristics */
+ int rows;
+ int cols;
+
+ /** frame dimensions */
+ struct frame_dimension frame_width;
+ struct frame_dimension frame_height;
+ int margin_width;
+ int margin_height;
+
+ /** frame name for targetting */
+ char *name;
+
+ /** frame characteristics */
+ bool no_resize;
+ frame_scrolling scrolling;
+ bool border;
+ colour border_colour;
+
+ /** iframe parent box */
+ struct box *box;
+
+ /** [cols * rows] children */
+ struct browser_window *children;
+ struct browser_window *parent;
+
+ /** [iframe_count] iframes */
+ int iframe_count;
+ struct browser_window *iframes;
+
+ /** browser window child of root browser window which has input focus */
+ struct browser_window *focus;
+
+ /** Last time a link was followed in this window */
+ unsigned int last_action;
+
+ /** Current selection, or NULL if none */
+ struct selection *cur_sel;
+
+ /** Current context for free text search, or NULL if none */
+ struct search_context *cur_search;
+
+ /** current javascript context */
+ struct jscontext *jsctx;
+
+ /** cache of the currently displayed status text. */
+ char *status_text; /**< Current status bar text. */
+ int status_text_len; /**< Length of the browser_window::status_text buffer. */
+ int status_match; /**< Number of times an idempotent status-set operation was
performed. */
+ int status_miss; /**< Number of times status was really updated. */
+};
+
+#endif
diff --git a/desktop/frame_types.h b/desktop/frame_types.h
index a9ba0b8..f193d03 100644
--- a/desktop/frame_types.h
+++ b/desktop/frame_types.h
@@ -40,7 +40,6 @@ typedef enum {
/* Handy struct names */
struct content_html_iframe;
-struct scrollbar_msg_data;
struct content_html_frames;
#endif
diff --git a/desktop/frames.c b/desktop/frames.c
index c5934cd..cc2cabf 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -30,7 +30,7 @@
#include <math.h>
#include "utils/config.h"
#include "content/hlcache.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/frames.h"
#include "desktop/history_core.h"
#include "desktop/gui.h"
@@ -59,9 +59,6 @@ void browser_window_scroll_callback(void *client_data,
struct browser_window *bw = client_data;
switch(scrollbar_data->msg) {
- case SCROLLBAR_MSG_REDRAW:
- /* TODO: Is this needed? */
- break;
case SCROLLBAR_MSG_MOVED:
if (bw->browser_window_type == BROWSER_WINDOW_IFRAME) {
html_redraw_a_box(bw->parent->current_content, bw->box);
@@ -94,7 +91,7 @@ void browser_window_scroll_callback(void *client_data,
case SCROLLBAR_MSG_SCROLL_FINISHED:
browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
- browser_window_set_pointer(bw, GUI_POINTER_DEFAULT);
+ browser_window_set_pointer(bw, BROWSER_POINTER_DEFAULT);
break;
}
}
@@ -291,7 +288,8 @@ void browser_window_recalculate_iframes(struct browser_window *bw)
*/
void browser_window_create_frameset(struct browser_window *bw,
- struct content_html_frames *frameset) {
+ struct content_html_frames *frameset)
+{
int row, col, index;
struct content_html_frames *frame;
struct browser_window *window;
@@ -404,7 +402,8 @@ void browser_window_create_frameset(struct browser_window *bw,
* \param bw The browser window to reposition framesets for
*/
-void browser_window_recalculate_frameset(struct browser_window *bw) {
+void browser_window_recalculate_frameset(struct browser_window *bw)
+{
int widths[bw->cols][bw->rows];
int heights[bw->cols][bw->rows];
int bw_width, bw_height;
@@ -639,7 +638,8 @@ void browser_window_recalculate_frameset(struct browser_window *bw) {
* \param bw The browser window to resize
*/
-void browser_window_resize_frame(struct browser_window *bw, int x, int y) {
+void browser_window_resize_frame(struct browser_window *bw, int x, int y)
+{
struct browser_window *parent;
struct browser_window *sibling;
int col = -1, row = -1, i;
@@ -682,7 +682,8 @@ void browser_window_resize_frame(struct browser_window *bw, int x, int
y) {
bool browser_window_resolve_frame_dimension(struct browser_window *bw,
struct browser_window *sibling,
- int x, int y, bool width, bool height) {
+ int x, int y, bool width, bool height)
+{
int bw_dimension, sibling_dimension;
int bw_pixels, sibling_pixels;
struct frame_dimension *bw_d, *sibling_d;
@@ -797,10 +798,10 @@ bool browser_window_resolve_frame_dimension(struct browser_window
*bw,
}
-bool browser_window_resize_frames(struct browser_window *bw,
+static bool browser_window_resize_frames(struct browser_window *bw,
browser_mouse_state mouse, int x, int y,
- gui_pointer_shape *pointer, const char **status,
- bool *action) {
+ browser_pointer_shape *pointer)
+{
struct browser_window *parent;
bool left, right, up, down;
int i, resize_margin;
@@ -851,13 +852,21 @@ bool browser_window_resize_frames(struct browser_window *bw,
/* check the sibling frames can be resized */
if (left)
- left &= !parent->children[row * parent->cols + (col - 1)].no_resize;
+ left &= !parent->children[row *
+ parent->cols + (col - 1)].
+ no_resize;
if (right)
- right &= !parent->children[row * parent->cols + (col + 1)].no_resize;
+ right &= !parent->children[row *
+ parent->cols + (col + 1)].
+ no_resize;
if (up)
- up &= !parent->children[(row - 1) * parent->cols + col].no_resize;
+ up &= !parent->children[(row - 1) *
+ parent->cols + col].
+ no_resize;
if (down)
- down &= !parent->children[(row + 1) * parent->cols + col].no_resize;
+ down &= !parent->children[(row + 1) *
+ parent->cols + col].
+ no_resize;
/* can't have opposite directions simultaneously */
if (up)
@@ -869,22 +878,22 @@ bool browser_window_resize_frames(struct browser_window *bw,
if (left || right || up || down) {
if (left) {
if (down)
- *pointer = GUI_POINTER_LD;
+ *pointer = BROWSER_POINTER_LD;
else if (up)
- *pointer = GUI_POINTER_LU;
+ *pointer = BROWSER_POINTER_LU;
else
- *pointer = GUI_POINTER_LEFT;
+ *pointer = BROWSER_POINTER_LEFT;
} else if (right) {
if (down)
- *pointer = GUI_POINTER_RD;
+ *pointer = BROWSER_POINTER_RD;
else if (up)
- *pointer = GUI_POINTER_RU;
+ *pointer = BROWSER_POINTER_RU;
else
- *pointer = GUI_POINTER_RIGHT;
+ *pointer = BROWSER_POINTER_RIGHT;
} else if (up) {
- *pointer = GUI_POINTER_UP;
+ *pointer = BROWSER_POINTER_UP;
} else {
- *pointer = GUI_POINTER_DOWN;
+ *pointer = BROWSER_POINTER_DOWN;
}
if (mouse & (BROWSER_MOUSE_DRAG_1 |
BROWSER_MOUSE_DRAG_2)) {
@@ -899,9 +908,6 @@ bool browser_window_resize_frames(struct browser_window *bw,
bw->drag_resize_right = right;
bw->drag_resize_up = up;
bw->drag_resize_down = down;
-
- *status = messages_get("FrameDrag");
- *action = true;
}
return true;
}
@@ -910,14 +916,28 @@ bool browser_window_resize_frames(struct browser_window *bw,
if (bw->children) {
for (i = 0; i < (bw->cols * bw->rows); i++)
if (browser_window_resize_frames(&bw->children[i],
- mouse, x, y, pointer, status, action))
+ mouse, x, y, pointer))
return true;
}
if (bw->iframes) {
for (i = 0; i < bw->iframe_count; i++)
if (browser_window_resize_frames(&bw->iframes[i],
- mouse, x, y, pointer, status, action))
+ mouse, x, y, pointer))
return true;
}
return false;
}
+
+
+bool browser_window_frame_resize_start(struct browser_window *bw,
+ browser_mouse_state mouse, int x, int y,
+ browser_pointer_shape *pointer)
+{
+ struct browser_window *root = browser_window_get_root(bw);
+ int offx, offy;
+
+ browser_window_get_position(bw, true, &offx, &offy);
+
+ return browser_window_resize_frames(root, mouse,
+ x + offx, y + offy, pointer);
+}
diff --git a/desktop/frames.h b/desktop/frames.h
index 11fbcea..d5aca07 100644
--- a/desktop/frames.h
+++ b/desktop/frames.h
@@ -24,8 +24,8 @@
#define _NETSURF_DESKTOP_FRAMES_H_
#include "desktop/browser.h"
-#include "desktop/gui.h"
+struct scrollbar_msg_data;
void browser_window_create_iframes(struct browser_window *bw,
struct content_html_iframe *iframe);
@@ -33,9 +33,9 @@ void browser_window_recalculate_iframes(struct browser_window *bw);
void browser_window_create_frameset(struct browser_window *bw,
struct content_html_frames *frameset);
void browser_window_recalculate_frameset(struct browser_window *bw);
-bool browser_window_resize_frames(struct browser_window *bw,
+bool browser_window_frame_resize_start(struct browser_window *bw,
browser_mouse_state mouse, int x, int y,
- gui_pointer_shape *pointer, const char **status, bool *action);
+ browser_pointer_shape *pointer);
void browser_window_resize_frame(struct browser_window *bw, int x, int y);
void browser_window_scroll_callback(void *client_data,
diff --git a/desktop/gui.h b/desktop/gui.h
index 85f1015..aa3fc81 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -53,23 +53,15 @@ struct browser_window;
struct selection;
struct form_control;
-typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET,
- GUI_POINTER_MENU, GUI_POINTER_UP, GUI_POINTER_DOWN,
- GUI_POINTER_LEFT, GUI_POINTER_RIGHT, GUI_POINTER_RU,
- GUI_POINTER_LD, GUI_POINTER_LU, GUI_POINTER_RD,
- GUI_POINTER_CROSS, GUI_POINTER_MOVE, GUI_POINTER_WAIT,
- GUI_POINTER_HELP, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED,
- GUI_POINTER_PROGRESS } gui_pointer_shape;
-
#include <stdbool.h>
#include <libwapcaplet/libwapcaplet.h>
#include <libcss/libcss.h>
#include "utils/config.h"
-#include "content/content.h"
#include "content/hlcache.h"
#include "desktop/download.h"
+#include "desktop/mouse.h"
#include "desktop/search.h"
#include "utils/errors.h"
@@ -129,7 +121,8 @@ void gui_clear_selection(struct gui_window *g);
void gui_paste_from_clipboard(struct gui_window *g, int x, int y);
bool gui_empty_clipboard(void);
-bool gui_add_to_clipboard(const char *text, size_t length, bool space);
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle);
bool gui_commit_clipboard(void);
bool gui_copy_to_clipboard(struct selection *s);
diff --git a/desktop/mouse.h b/desktop/mouse.h
index 84af82f..42603a6 100644
--- a/desktop/mouse.h
+++ b/desktop/mouse.h
@@ -63,6 +63,40 @@ typedef enum {
* (eg. Alt) */
} browser_mouse_state;
+
+typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET,
+ GUI_POINTER_MENU, GUI_POINTER_UP, GUI_POINTER_DOWN,
+ GUI_POINTER_LEFT, GUI_POINTER_RIGHT, GUI_POINTER_RU,
+ GUI_POINTER_LD, GUI_POINTER_LU, GUI_POINTER_RD,
+ GUI_POINTER_CROSS, GUI_POINTER_MOVE, GUI_POINTER_WAIT,
+ GUI_POINTER_HELP, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED,
+ GUI_POINTER_PROGRESS } gui_pointer_shape;
+
+/** Mouse pointer type */
+typedef enum {
+ BROWSER_POINTER_DEFAULT = GUI_POINTER_DEFAULT,
+ BROWSER_POINTER_POINT = GUI_POINTER_POINT,
+ BROWSER_POINTER_CARET = GUI_POINTER_CARET,
+ BROWSER_POINTER_MENU = GUI_POINTER_MENU,
+ BROWSER_POINTER_UP = GUI_POINTER_UP,
+ BROWSER_POINTER_DOWN = GUI_POINTER_DOWN,
+ BROWSER_POINTER_LEFT = GUI_POINTER_LEFT,
+ BROWSER_POINTER_RIGHT = GUI_POINTER_RIGHT,
+ BROWSER_POINTER_RU = GUI_POINTER_RU,
+ BROWSER_POINTER_LD = GUI_POINTER_LD,
+ BROWSER_POINTER_LU = GUI_POINTER_LU,
+ BROWSER_POINTER_RD = GUI_POINTER_RD,
+ BROWSER_POINTER_CROSS = GUI_POINTER_CROSS,
+ BROWSER_POINTER_MOVE = GUI_POINTER_MOVE,
+ BROWSER_POINTER_WAIT = GUI_POINTER_WAIT,
+ BROWSER_POINTER_HELP = GUI_POINTER_HELP,
+ BROWSER_POINTER_NO_DROP = GUI_POINTER_NO_DROP,
+ BROWSER_POINTER_NOT_ALLOWED = GUI_POINTER_NOT_ALLOWED,
+ BROWSER_POINTER_PROGRESS = GUI_POINTER_PROGRESS,
+ BROWSER_POINTER_AUTO
+} browser_pointer_shape;
+
+
void browser_mouse_state_dump(browser_mouse_state mouse);
#endif
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index ac4c399..7768be2 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -427,16 +427,6 @@ void scrollbar_set(struct scrollbar *s, int value, bool bar_pos)
msg.msg = SCROLLBAR_MSG_MOVED;
msg.scroll_offset = s->offset;
s->client_callback(s->client_data, &msg);
-
- msg.msg = SCROLLBAR_MSG_REDRAW;
- msg.x0 = s->horizontal ? SCROLLBAR_WIDTH - 1 : 0;
- msg.y0 = s->horizontal ? 0 : SCROLLBAR_WIDTH - 1;
- msg.x1 = (s->horizontal ? s->length - SCROLLBAR_WIDTH + 1 :
- SCROLLBAR_WIDTH);
- msg.y1 = (s->horizontal ? SCROLLBAR_WIDTH :
- s->length - SCROLLBAR_WIDTH + 1);
-
- s->client_callback(s->client_data, &msg);
}
@@ -498,16 +488,6 @@ bool scrollbar_scroll(struct scrollbar *s, int change)
msg.scroll_offset = s->offset;
s->client_callback(s->client_data, &msg);
- msg.msg = SCROLLBAR_MSG_REDRAW;
- msg.x0 = s->horizontal ? SCROLLBAR_WIDTH - 1 : 0;
- msg.y0 = s->horizontal ? 0 : SCROLLBAR_WIDTH - 1;
- msg.x1 = (s->horizontal ? s->length - SCROLLBAR_WIDTH + 1 :
- SCROLLBAR_WIDTH);
- msg.y1 = (s->horizontal ? SCROLLBAR_WIDTH :
- s->length - SCROLLBAR_WIDTH + 1);
-
- s->client_callback(s->client_data, &msg);
-
return true;
}
diff --git a/desktop/scrollbar.h b/desktop/scrollbar.h
index 4bd9a17..2ce4a15 100644
--- a/desktop/scrollbar.h
+++ b/desktop/scrollbar.h
@@ -39,7 +39,6 @@
struct scrollbar;
typedef enum {
- SCROLLBAR_MSG_REDRAW, /* the scrollbar requests a redraw */
SCROLLBAR_MSG_MOVED, /* the scroll value has changed */
SCROLLBAR_MSG_SCROLL_START, /* a scrollbar drag has started, all
* mouse events should be passed to
@@ -47,7 +46,6 @@ typedef enum {
* coordinates
*/
SCROLLBAR_MSG_SCROLL_FINISHED, /* cancel the above */
-
} scrollbar_msg;
struct scrollbar_msg_data {
diff --git a/desktop/search.c b/desktop/search.c
index 257c7e8..29d28bd 100644
--- a/desktop/search.c
+++ b/desktop/search.c
@@ -28,7 +28,7 @@
#include <dom/dom.h>
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/options.h"
#include "desktop/search.h"
@@ -44,11 +44,26 @@
#include "utils/utils.h"
+/* callback informing us that a search context is nolonger valid */
+static void browser_window_search_invalidate(struct search_context *context,
+ void *p)
+{
+ struct browser_window *bw = p;
+ assert(bw != NULL);
+
+ if (bw->cur_search != NULL && bw->cur_search == context) {
+ /* The browser's current search is the one being invalidated */
+ bw->cur_search = NULL;
+ }
+}
+
bool browser_window_search_create_context(struct browser_window *bw,
- struct search_callbacks *callbacks, void *p)
+ struct gui_search_callbacks *gui_callbacks, void *gui_p)
{
+ struct search_callbacks callbacks;
assert(bw != NULL);
+ assert(gui_callbacks != NULL);
if (bw->cur_search != NULL)
search_destroy_context(bw->cur_search);
@@ -57,8 +72,11 @@ bool browser_window_search_create_context(struct browser_window *bw,
if (!bw->current_content)
return false;
- bw->cur_search = search_create_context(bw->current_content,
- callbacks, p);
+ callbacks.gui = gui_callbacks;
+ callbacks.gui_p = gui_p;
+ callbacks.invalidate = browser_window_search_invalidate;
+ callbacks.p = bw;
+ bw->cur_search = search_create_context(bw->current_content, callbacks);
if (bw->cur_search == NULL)
return false;
@@ -82,16 +100,17 @@ void browser_window_search_destroy_context(struct browser_window
*bw)
* non-NULL, creates a new search_context in case of a new search
* \param bw the browser_window the search refers to
* \param callbacks the callbacks to modify appearance according to results
- * \param p a pointer returned to the callbacks
+ * \param gui_p a pointer returned to the callbacks
* \return true for success
*/
bool browser_window_search_verify_new(struct browser_window *bw,
- struct search_callbacks *callbacks, void *p)
+ struct gui_search_callbacks *gui_callbacks, void *gui_p)
{
if (bw == NULL)
return false;
if (bw->cur_search == NULL)
- return browser_window_search_create_context(bw, callbacks, p);
+ return browser_window_search_create_context(bw,
+ gui_callbacks, gui_p);
return true;
}
diff --git a/desktop/search.h b/desktop/search.h
index f774f73..e178138 100644
--- a/desktop/search.h
+++ b/desktop/search.h
@@ -22,8 +22,6 @@
#include <ctype.h>
#include <string.h>
-struct search_context;
-
typedef enum {
SEARCH_FLAG_CASE_SENSITIVE = (1 << 0),
SEARCH_FLAG_FORWARDS = (1 << 1),
@@ -33,54 +31,54 @@ typedef enum {
/**
* Change the displayed search status.
* \param found search pattern matched in text
- * \param p the pointer sent to search_step() / search_create_context()
+ * \param p gui private data pointer provided with search callbacks
*/
-typedef void (*search_status_callback)(bool found, void *p);
+typedef void (*gui_search_status)(bool found, void *p);
/**
* display hourglass while searching
* \param active start/stop indicator
- * \param p the pointer sent to search_step() / search_create_context()
+ * \param p gui private data pointer provided with search callbacks
*/
-typedef void (*search_hourglass_callback)(bool active, void *p);
+typedef void (*gui_search_hourglass)(bool active, void *p);
/**
* add search string to recent searches list
* front has full liberty how to implement the bare notification;
* core gives no guarantee of the integrity of the const char *
* \param string search pattern
- * \param p the pointer sent to search_step() / search_create_context()
+ * \param p gui private data pointer provided with search callbacks
*/
-typedef void (*search_add_recent_callback)(const char *string, void *p);
+typedef void (*gui_search_add_recent)(const char *string, void *p);
/**
* activate search forwards button in gui
* \param active activate/inactivate
- * \param p the pointer sent to search_step() / search_create_context()
+ * \param p gui private data pointer provided with search callbacks
*/
-typedef void (*search_forward_state_callback)(bool active, void *p);
+typedef void (*gui_search_forward_state)(bool active, void *p);
/**
* activate search back button in gui
* \param active activate/inactivate
- * \param p the pointer sent to search_step() / search_create_context()
+ * \param p gui private data pointer provided with search callbacks
*/
-typedef void (*search_back_state_callback)(bool active, void *p);
+typedef void (*gui_search_back_state)(bool active, void *p);
-struct search_callbacks {
- search_forward_state_callback forward_state;
- search_back_state_callback back_state;
- search_status_callback status;
- search_hourglass_callback hourglass;
- search_add_recent_callback add_recent;
+struct gui_search_callbacks {
+ gui_search_forward_state forward_state;
+ gui_search_back_state back_state;
+ gui_search_status status;
+ gui_search_hourglass hourglass;
+ gui_search_add_recent add_recent;
};
bool browser_window_search_create_context(struct browser_window *bw,
- struct search_callbacks *callbacks, void *p);
+ struct gui_search_callbacks *gui_callbacks, void *gui_p);
void browser_window_search_destroy_context(struct browser_window *bw);
bool browser_window_search_verify_new(struct browser_window *bw,
- struct search_callbacks *callbacks, void *p);
+ struct gui_search_callbacks *gui_callbacks, void *gui_p);
void browser_window_search_step(struct browser_window *bw,
search_flags_t flags, const char *string);
void browser_window_search_show_all(bool all, struct browser_window *bw);
diff --git a/desktop/selection.c b/desktop/selection.c
index 6679be6..5633b18 100644
--- a/desktop/selection.c
+++ b/desktop/selection.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <dom/dom.h>
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/mouse.h"
#include "desktop/plotters.h"
@@ -72,6 +73,18 @@ struct rdw_info {
struct rect r;
};
+struct selection_string {
+ char *buffer;
+ size_t buffer_len;
+ size_t length;
+};
+
+
+typedef bool (*seln_traverse_handler)(const char *text, size_t length,
+ struct box *box, void *handle, const char *whitespace_text,
+ size_t whitespace_length);
+
+
static bool redraw_handler(const char *text, size_t length, struct box *box,
void *handle, const char *whitespace_text,
size_t whitespace_length);
@@ -612,8 +625,8 @@ bool traverse_tree(struct box *box, unsigned start_idx, unsigned
end_idx,
* \return false iff traversal abandoned part-way through
*/
-bool selection_traverse(struct selection *s, seln_traverse_handler handler,
- void *handle)
+static bool selection_traverse(struct selection *s,
+ seln_traverse_handler handler, void *handle)
{
save_text_whitespace before = WHITESPACE_NONE;
bool first = true;
@@ -743,22 +756,36 @@ void selection_redraw(struct selection *s, unsigned start_idx,
unsigned end_idx)
* \return true iff successful and traversal should continue
*/
-static bool selection_copy_handler(const char *text, size_t length,
+static bool selection_copy_clip_handler(const char *text, size_t length,
struct box *box, void *handle, const char *whitespace_text,
size_t whitespace_length)
{
- bool add_space = box != NULL ? box->space != 0 : false;
+ bool add_space = false;
+ plot_font_style_t style = *plot_style_font;
/* add any whitespace which precedes the text from this box */
if (whitespace_text != NULL && whitespace_length > 0) {
if (!gui_add_to_clipboard(whitespace_text,
- whitespace_length, false)) {
+ whitespace_length, false, &style)) {
return false;
}
}
+ if (box != NULL) {
+ /* HTML */
+ add_space = (box->space != 0);
+
+ if (box->style != NULL) {
+ /* Override default font style */
+ font_plot_style_from_css(box->style, &style);
+ } else {
+ /* If there's no style, there must be no text */
+ assert(box->text == NULL);
+ }
+ }
+
/* add the text from this box */
- if (!gui_add_to_clipboard(text, length, add_space))
+ if (!gui_add_to_clipboard(text, length, add_space, &style))
return false;
return true;
@@ -774,7 +801,115 @@ static bool selection_copy_handler(const char *text, size_t length,
bool selection_copy_to_clipboard(struct selection *s)
{
- return selection_traverse(s, selection_copy_handler, NULL);
+ return selection_traverse(s, selection_copy_clip_handler, NULL);
+}
+
+
+/**
+ * Append text to selection string.
+ *
+ * \param text text to be added
+ * \param length length of text in bytes
+ * \param space indicates whether a trailing space should be appended
+ * \param sel_string string to append to, may be resized
+ * \return true iff successful
+ */
+
+static bool selection_string_append(const char *text, size_t length, bool space,
+ struct selection_string *sel_string)
+{
+ size_t new_length = sel_string->length + length + (space ? 1 : 0) + 1;
+
+ if (new_length > sel_string->buffer_len) {
+ size_t new_alloc = new_length + (new_length / 4);
+ char *new_buff;
+
+ new_buff = realloc(sel_string->buffer, new_alloc);
+ if (new_buff == NULL)
+ return false;
+
+ sel_string->buffer = new_buff;
+ sel_string->buffer_len = new_alloc;
+ }
+
+ memcpy(sel_string->buffer + sel_string->length, text, length);
+ sel_string->length += length;
+
+ if (space)
+ sel_string->buffer[sel_string->length++] = ' ';
+
+ sel_string->buffer[sel_string->length] = '\0';
+
+ return true;
+}
+
+
+/**
+ * Selection traversal routine for appending text to a string
+ *
+ * \param text pointer to text being added, or NULL for newline
+ * \param length length of text to be appended (bytes)
+ * \param box pointer to text box, or NULL if from textplain
+ * \param handle selection string to append to
+ * \param whitespace_text whitespace to place before text for formatting
+ * may be NULL
+ * \param whitespace_length length of whitespace_text
+ * \return true iff successful and traversal should continue
+ */
+
+static bool selection_copy_handler(const char *text, size_t length,
+ struct box *box, void *handle, const char *whitespace_text,
+ size_t whitespace_length)
+{
+ bool add_space = false;
+
+ /* add any whitespace which precedes the text from this box */
+ if (whitespace_text != NULL && whitespace_length > 0) {
+ if (!selection_string_append(whitespace_text,
+ whitespace_length, false, handle)) {
+ return false;
+ }
+ }
+
+ if (box != NULL) {
+ /* HTML */
+ add_space = (box->space != 0);
+ }
+
+ /* add the text from this box */
+ if (!selection_string_append(text, length, add_space, handle))
+ return false;
+
+ return true;
+}
+
+
+/**
+ * Get copy of selection as string
+ *
+ * \param s selection
+ * \return string of selected text, or NULL. Ownership passed to caller.
+ */
+
+char * selection_get_copy(struct selection *s)
+{
+ struct selection_string sel_string = {
+ .buffer = NULL,
+ .buffer_len = 0,
+ .length = 0
+ };
+
+ if (s == NULL || !s->defined)
+ return NULL;
+
+ if (!selection_traverse(s, selection_copy_handler, &sel_string)) {
+ if (sel_string.buffer != NULL) {
+ free(sel_string.buffer);
+ }
+ return NULL;
+ }
+
+ return sel_string.buffer;
}
diff --git a/desktop/selection.h b/desktop/selection.h
index 16b002a..aebb169 100644
--- a/desktop/selection.h
+++ b/desktop/selection.h
@@ -23,7 +23,8 @@
#ifndef _NETSURF_DESKTOP_SELECTION_H_
#define _NETSURF_DESKTOP_SELECTION_H_
-#include "desktop/browser.h"
+#include <stdbool.h>
+#include "desktop/mouse.h"
struct box;
@@ -55,11 +56,6 @@ struct selection
};
-typedef bool (*seln_traverse_handler)(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text,
- size_t whitespace_length);
-
-
struct selection *selection_create(struct content *c, bool is_html);
void selection_prepare(struct selection *s, struct content *c, bool is_html);
void selection_destroy(struct selection *s);
@@ -96,14 +92,12 @@ void selection_track(struct selection *s, browser_mouse_state mouse,
unsigned idx);
bool selection_copy_to_clipboard(struct selection *s);
+char * selection_get_copy(struct selection *s);
/** Handles completion of a drag operation */
/* void selection_drag_end(struct selection *s); */
#define selection_drag_end(s) ((s)->drag_state = DRAG_NONE)
-bool selection_traverse(struct selection *s, seln_traverse_handler handler,
- void *handle);
-
bool selection_highlighted(const struct selection *s,
unsigned start, unsigned end,
unsigned *start_idx, unsigned *end_idx);
diff --git a/desktop/textinput.c b/desktop/textinput.c
index 36011be..8efc719 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <dom/dom.h>
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/mouse.h"
#include "desktop/scrollbar.h"
diff --git a/desktop/tree_url_node.h b/desktop/tree_url_node.h
index 15243e9..1fa89cd 100644
--- a/desktop/tree_url_node.h
+++ b/desktop/tree_url_node.h
@@ -27,6 +27,8 @@
#include "desktop/tree.h"
+struct url_data;
+
void tree_url_node_init(const char *folder_icon_name);
void tree_url_node_cleanup(void);
struct node *tree_create_URL_node(struct tree *tree,
diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target
index 37341ee..8cca120 100644
--- a/framebuffer/Makefile.target
+++ b/framebuffer/Makefile.target
@@ -21,7 +21,7 @@ NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
CFLAGS += -Dnsframebuffer
#resource path
-CFLAGS +=
'-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))"'
+CFLAGS += '-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH)"'
# compile time font locations
CFLAGS += '-DNETSURF_FB_FONTPATH="$(NETSURF_FB_FONTPATH)"'
@@ -154,4 +154,20 @@ S_FRAMEBUFFER := $(addprefix framebuffer/,$(S_FRAMEBUFFER))
$(addprefix framebuf
# Note this is deliberately *not* expanded here as common and image
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES)
-EXETARGET := nsfb$(SUBTARGET)
+EXETARGET := nsfb
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-framebuffer:
+ mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
+ mkdir -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
+ @cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf$(SUBTARGET)
+ @for F in default.css messages; do cp -vL framebuffer/res/$$F
$(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-framebuffer:
diff --git a/framebuffer/clipboard.c b/framebuffer/clipboard.c
index d534cfe..7503303 100644
--- a/framebuffer/clipboard.c
+++ b/framebuffer/clipboard.c
@@ -23,6 +23,8 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>
+#include "desktop/browser.h"
+#include "desktop/gui.h"
#include "desktop/selection.h"
#include "framebuffer/gui.h"
#include "utils/log.h"
@@ -69,7 +71,8 @@ bool gui_empty_clipboard(void)
* \return true iff successful
*/
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
size_t new_length = gui_clipboard.length + length + (space ? 1 : 0) + 1;
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index 67f9306..3ace28a 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -218,8 +218,8 @@ fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
switch (event->type) {
case NSFB_EVENT_KEY_DOWN:
case NSFB_EVENT_KEY_UP:
- if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
- (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
+ if ((event->value.keycode >= NSFB_KEY_MOUSE_1) &&
+ (event->value.keycode <= NSFB_KEY_MOUSE_5)) {
fbtk_click(root, event);
} else {
fbtk_input(root, event);
diff --git a/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index 581fd9a..c2279a1 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -396,7 +396,8 @@ FT_Glyph fb_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
fb_face = (fb_faceid_t *)srec.face_id;
- glyph_index = FTC_CMapCache_Lookup(ft_cmap_cache, srec.face_id, fb_face->cidx,
ucs4);
+ glyph_index = FTC_CMapCache_Lookup(ft_cmap_cache, srec.face_id,
+ fb_face->cidx, ucs4);
error = FTC_ImageCache_LookupScaler(ft_image_cache,
&srec,
@@ -406,6 +407,8 @@ FT_Glyph fb_getglyph(const plot_font_style_t *fstyle, uint32_t ucs4)
glyph_index,
&glyph,
NULL);
+ if (error != 0)
+ return NULL;
return glyph;
}
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index dfbaa26..e33df38 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -31,6 +31,7 @@
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/mouse.h"
#include "desktop/plotters.h"
@@ -529,7 +530,7 @@ main(int argc, char** argv)
setbuf(stderr, NULL);
- respaths =
fb_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"NETSURF_FB_RESPATH":./framebuffer/res:"NETSURF_FB_FONTPATH);
+ respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
options = filepath_find(respaths, "Choices");
messages = filepath_find(respaths, "messages");
diff --git a/framebuffer/localhistory.c b/framebuffer/localhistory.c
index 4b329a8..f6c24a1 100644
--- a/framebuffer/localhistory.c
+++ b/framebuffer/localhistory.c
@@ -31,6 +31,7 @@
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "desktop/netsurf.h"
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index 488b849..3934d13 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -1,3 +1,8 @@
+#
+# Makefile for NetSurf GTK target
+#
+# This file is part of NetSurf
+#
# ----------------------------------------------------------------------------
# GTK flag setup (using pkg-config)
# ----------------------------------------------------------------------------
@@ -13,23 +18,22 @@ NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP
-NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0
NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0
+NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO
-# add a line similar to below for each optional pkg-configed lib here
+# add a line similar to below for each optional lib here
+# note: webp lacks pkg-config file
+$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
+$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
+$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG))
$(eval $(call pkg_config_find_and_add,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,Sprite))
-$(eval $(call pkg_config_find_and_add,BMP,libnsbmp,BMP))
-$(eval $(call pkg_config_find_and_add,GIF,libnsgif,GIF))
-$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
-$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
+$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call pkg_config_find_and_add,MOZJS,mozjs185,JavaScript))
$(eval $(call pkg_config_find_and_add,JS,mozilla-js,JavaScript))
-
-# no pkg-config for this library
-$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
+$(eval $(call pkg_config_find_and_add,VIDEO,gstreamer-0.10,Video))
ifeq ($(NETSURF_USE_MOZJS),YES)
NETSURF_USE_JS:=YES
@@ -119,3 +123,43 @@ S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_PIXBUF) $(S_GTK)
EXETARGET := nsgtk
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-gtk:
+ mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber
+ mkdir -p $(DESTDIR)$(NETSURF_GTK_RESOURCES)icons
+ mkdir -p $(DESTDIR)$(NETSURF_GTK_BIN)
+ @cp $< $(DESTDIR)$(NETSURF_GTK_BIN)netsurf
+ @cp -RL gtk/res/adblock.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/arrow_down_8x32.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/ca-bundle.txt $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/default.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/default.ico $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/favicon.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/gtkdefault.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/icons/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/internal.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/languages $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/license $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/netsurf.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/netsurf.xpm $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/netsurf-16x16.xpm $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/quirks.css $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/themelist $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/throbber/*.png $(DESTDIR)$(NETSURF_GTK_RESOURCES)throbber
+ @cp -RL gtk/res/toolbarIndices $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @cp -RL gtk/res/SearchEngines $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @tar cf - --exclude .svn -C gtk/res themes | tar xf - -C
$(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @# Install translations
+ @tar cf - --exclude .svn -C gtk/res C de en fr it nl | tar xf - -C
$(DESTDIR)$(NETSURF_GTK_RESOURCES)
+ @# Install glade templates
+ @cp -v gtk/res/*.gtk*.ui $(DESTDIR)$(NETSURF_GTK_RESOURCES)
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-gtk:
diff --git a/gtk/dialogs/options.c b/gtk/dialogs/options.c
index 1d095af..a449e6f 100644
--- a/gtk/dialogs/options.c
+++ b/gtk/dialogs/options.c
@@ -26,6 +26,7 @@
#include <math.h>
#include <gtk/gtk.h>
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "desktop/print.h"
#include "desktop/searchweb.h"
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index ad2ee2c..0804dff 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -30,6 +30,7 @@
#include "gtk/gui.h"
#include "gtk/print.h"
#include "gtk/selection.h"
+#include "desktop/browser_private.h"
#include "desktop/netsurf.h"
#include "desktop/print.h"
#include "desktop/options.h"
diff --git a/gtk/gui.c b/gtk/gui.c
index 1e23d07..222c982 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -45,7 +45,7 @@
#include "content/fetchers/resource.h"
#include "content/hlcache.h"
#include "content/urldb.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/cookies.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
@@ -71,7 +71,6 @@
#include "gtk/window.h"
#include "gtk/schedule.h"
-#include "render/box.h"
#include "render/form.h"
#include "utils/filepath.h"
#include "utils/log.h"
diff --git a/gtk/plotters.c b/gtk/plotters.c
index 2f2b111..3af55b9 100644
--- a/gtk/plotters.c
+++ b/gtk/plotters.c
@@ -404,19 +404,16 @@ static bool nsgtk_plot_bitmap(int x, int y, int width, int height,
bool repeat_x = (flags & BITMAPF_REPEAT_X);
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
- if (!(repeat_x || repeat_y)) {
- /* Not repeating at all, so just pass it on */
- return nsgtk_plot_pixbuf(x, y, width, height, bitmap, bg);
- }
-
- width = bitmap_get_width(bitmap);
- height = bitmap_get_height(bitmap);
-
/* Bail early if we can */
if (width == 0 || height == 0)
/* Nothing to plot */
return true;
+ if (!(repeat_x || repeat_y)) {
+ /* Not repeating at all, so just pass it on */
+ return nsgtk_plot_pixbuf(x, y, width, height, bitmap, bg);
+ }
+
if (y > cliprect.y) {
doneheight = (cliprect.y - height) + ((y - cliprect.y) % height);
} else {
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 990444e..f6f6d98 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -33,7 +33,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "css/utils.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/hotlist.h"
#include "desktop/gui.h"
@@ -76,7 +76,6 @@
#include "gtk/compat.h"
#include "gtk/gdk.h"
#include "image/ico.h"
-#include "render/box.h"
#include "render/font.h"
#include "render/form.h"
#include "render/html.h"
@@ -163,7 +162,7 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
-static struct contextual_content current_menu_ctx = { NULL, NULL, NULL };
+static struct contextual_content current_menu_ctx;
/**
@@ -1232,13 +1231,7 @@ MULTIHANDLER(saveboxtree)
struct browser_window *bw;
bw = nsgtk_get_browser_window(g->top_level);
- if (bw->current_content &&
- content_get_type(bw->current_content) ==
- CONTENT_HTML) {
- box_dump(fh,
- html_get_box_tree(bw->current_content),
- 0);
- }
+ browser_window_debug_dump(bw, fh);
fclose(fh);
}
diff --git a/gtk/search.c b/gtk/search.c
index 1c002d5..37b7397 100644
--- a/gtk/search.c
+++ b/gtk/search.c
@@ -32,13 +32,11 @@
#include "utils/config.h"
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "desktop/search.h"
#include "desktop/searchweb.h"
#include "desktop/selection.h"
-#include "render/box.h"
-#include "render/html.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
@@ -47,7 +45,7 @@ static void nsgtk_search_set_status(bool found, void *p);
static void nsgtk_search_set_hourglass(bool active, void *p);
static void nsgtk_search_add_recent(const char *string, void *p);
-static struct search_callbacks nsgtk_search_callbacks = {
+static struct gui_search_callbacks nsgtk_search_callbacks = {
nsgtk_search_set_forward_state,
nsgtk_search_set_back_state,
nsgtk_search_set_status,
diff --git a/gtk/selection.c b/gtk/selection.c
index 1493567..fd0b7c8 100644
--- a/gtk/selection.c
+++ b/gtk/selection.c
@@ -31,12 +31,13 @@ static GString *current_selection = NULL;
static GtkClipboard *clipboard;
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
/* add the text from this box */
- current_selection = g_string_append_len (current_selection,
+ current_selection = g_string_append_len(current_selection,
text, length);
- if (space) g_string_append (current_selection, " ");
+ if (space) g_string_append(current_selection, " ");
return true;
}
@@ -45,7 +46,7 @@ bool gui_copy_to_clipboard(struct selection *s)
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
if (s->defined && selection_copy_to_clipboard(s))
gui_commit_clipboard();
- return TRUE;
+ return true;
}
void gui_start_selection(struct gui_window *g)
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index 0e5ef4e..9c89ee0 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -18,6 +18,7 @@
#include <gtk/gtk.h>
+#include "desktop/browser_private.h"
#include "desktop/searchweb.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/gtk/window.c b/gtk/window.c
index 5d37842..8a3a085 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -28,7 +28,7 @@
#include "content/hlcache.h"
#include "gtk/window.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/mouse.h"
#include "desktop/options.h"
#include "desktop/searchweb.h"
@@ -59,7 +59,6 @@ struct gui_window {
/** mouse state and events. */
struct {
struct gui_window *gui;
- struct box *box;
gdouble pressed_x;
gdouble pressed_y;
diff --git a/image/image_cache.c b/image/image_cache.c
index 5e62fe0..50961b1 100644
--- a/image/image_cache.c
+++ b/image/image_cache.c
@@ -575,15 +575,15 @@ case chr : \
slen++;
break;
- FMTCHR('a', "zd", params.limit);
- FMTCHR('b', "zd", params.hysteresis);
- FMTCHR('c', "zd", total_bitmap_size);
+ FMTCHR('a', SSIZET_FMT, params.limit);
+ FMTCHR('b', SSIZET_FMT, params.hysteresis);
+ FMTCHR('c', SSIZET_FMT, total_bitmap_size);
FMTCHR('d', "d", bitmap_count);
FMTCHR('e', "d", current_age / 1000);
- FMTCHR('f', "zd", max_bitmap_size);
+ FMTCHR('f', SSIZET_FMT, max_bitmap_size);
FMTCHR('g', "d", max_bitmap_size_count);
FMTCHR('h', "d", max_bitmap_count);
- FMTCHR('i', "zd", max_bitmap_count_size);
+ FMTCHR('i', SSIZET_FMT, max_bitmap_count_size);
case 'j':
@@ -710,7 +710,7 @@ int image_cache_snentryf(char *string, size_t size, unsigned int
entryn,
if (centry->bitmap != NULL) {
slen += snprintf(string + slen,
size - slen,
- "%zd",
+ "%"SSIZET_FMT,
centry->bitmap_size);
} else {
slen += snprintf(string + slen,
diff --git a/image/jpeg.c b/image/jpeg.c
index 92443bd..27d79bb 100644
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -245,14 +245,16 @@ jpeg_cache_convert(struct content *c)
rowstride = bitmap_get_rowstride(bitmap);
do {
JSAMPROW scanlines[1];
-#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
- int i;
scanlines[0] = (JSAMPROW) (pixels +
rowstride * cinfo.output_scanline);
jpeg_read_scanlines(&cinfo, scanlines, 1);
- /* expand to RGBA */
+#if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4
+{
+ /* Missmatch between configured libjpeg pixel format and
+ * NetSurf pixel format. Convert to RGBA */
+ int i;
for (i = width - 1; 0 <= i; i--) {
int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED];
int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN];
@@ -262,11 +264,7 @@ jpeg_cache_convert(struct content *c)
scanlines[0][i * 4 + 2] = b;
scanlines[0][i * 4 + 3] = 0xff;
}
-#else
- scanlines[0] = (JSAMPROW) (pixels +
- rowstride * cinfo.output_scanline);
- jpeg_read_scanlines(&cinfo, scanlines, 1);
-
+}
#endif
} while (cinfo.output_scanline != cinfo.output_height);
bitmap_modified(bitmap);
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index d7a462c..ac877c6 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -29,6 +29,8 @@
#include "mozjs/jsapi.h"
#endif
+#include "render/html_internal.h"
+
#if JS_VERSION <= 180
#include <string.h>
@@ -94,6 +96,9 @@ JSObject * js_ComputeThis(JSContext *cx, JSObject *thisp, void *argv);
#define JSAPI_PS(name, tinyid, flags) \
{ #name , tinyid , flags , jsapi_property_##name##_get , jsapi_property_##name##_set }
+#define JSAPI_PS_RO(name, tinyid, flags) \
+ { #name , tinyid , flags | JSPROP_READONLY, jsapi_property_##name##_get , NULL }
+
#define JSAPI_PS_END { NULL, 0, 0, NULL, NULL }
static inline JSObject *
@@ -157,7 +162,15 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
jsapi_property_##name##_set \
}
-#define JSAPI_PS_END { NULL, 0,0,NULL,NULL }
+#define JSAPI_PS_RO(name, tinyid, flags) { \
+ #name , \
+ tinyid , \
+ flags | JSPROP_READONLY, \
+ jsapi_property_##name##_get , \
+ NULL \
+ }
+
+#define JSAPI_PS_END { NULL, 0, 0, NULL, NULL }
#define JSString_to_char(injsstring, outchar, outlen) \
@@ -169,10 +182,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#endif
-typedef struct dom_element dom_element;
-struct html_content;
-//typedef struct html_content html_content;
-
/** Create a new javascript window object
*
* @param cx The javascript context.
diff --git a/javascript/jsapi/console.c b/javascript/jsapi/console.c
index 6a3cc18..6a6d7d3 100644
--- a/javascript/jsapi/console.c
+++ b/javascript/jsapi/console.c
@@ -16,10 +16,11 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include "javascript/jsapi.h"
#include "utils/log.h"
+#include "javascript/jsapi.h"
+
static JSBool JSAPI_NATIVE(debug, JSContext *cx, uintN argc, jsval *vp)
{
JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
diff --git a/javascript/jsapi/document.c b/javascript/jsapi/document.c
index 77de4e0..2d3bde4 100644
--- a/javascript/jsapi/document.c
+++ b/javascript/jsapi/document.c
@@ -16,19 +16,9 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include <dom/dom.h>
-
-
-#include "javascript/jsapi.h"
-#include "utils/config.h"
-#include "render/html_internal.h"
-#include "utils/log.h"
/* IDL
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-document
-CAUTION - write, writeln are not part of the DOM they come from:
-http://www.w3.org/TR/html5/apis-in-html-documents.html#document.write
-
interface Document : Node {
readonly attribute DOMImplementation implementation;
readonly attribute DOMString URL;
@@ -70,29 +60,7 @@ interface Document : Node {
*/
-static void jsfinalize_document(JSContext *cx, JSObject *obj);
-
-struct jsclass_document_priv {
- struct html_content *htmlc;
- dom_document *node;
-};
-
-static JSClass jsclass_document =
-{
- "document",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_StrictPropertyStub,
- JS_EnumerateStub,
- JS_ResolveStub,
- JS_ConvertStub,
- jsfinalize_document,
- JSCLASS_NO_OPTIONAL_MEMBERS
-};
-
-#define JSCLASS_NAME document
+#include "jsclass.h"
#include "node.c"
@@ -105,7 +73,7 @@ static JSBool JSAPI_NATIVE(getElementById, JSContext *cx, uintN argc,
jsval *vp)
dom_element *idelement;
struct jsclass_document_priv *document;
- document = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &jsclass_document,
NULL);
+ document = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
if (document == NULL) {
return JS_FALSE;
}
@@ -133,88 +101,10 @@ static JSBool JSAPI_NATIVE(getElementById, JSContext *cx, uintN
argc, jsval *vp)
return JS_TRUE;
}
-static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
-{
- JSString* u16_txt;
- char *txt;
- unsigned long length;
- struct jsclass_document_priv *document;
-
- document = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &jsclass_document,
NULL);
- if (document == NULL) {
- return JS_FALSE;
- }
-
- if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt)) {
- return JS_FALSE;
- }
-
- JSString_to_char(u16_txt, txt, length);
-
- LOG(("content %p parser %p writing %s",
- document->htmlc, document->htmlc->parser, txt));
- if (document->htmlc->parser != NULL) {
- dom_hubbub_parser_insert_chunk(document->htmlc->parser, (uint8_t *)txt, length);
- }
- JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
-
- return JS_TRUE;
-}
-
-static JSFunctionSpec jsfunctions_document[] = {
- JSAPI_FS_NODE,
- JSAPI_FS(write, 1, 0),
- JSAPI_FS(getElementById, 1, 0),
- JSAPI_FS_END
-};
-
-
-
-static void jsfinalize_document(JSContext *cx, JSObject *obj)
-{
- struct jsclass_document_priv *document;
-
- document = JS_GetInstancePrivate(cx, obj, &jsclass_document, NULL);
- if (document != NULL) {
- free(document);
- }
-}
-
-JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, struct html_content
*htmlc)
-{
- /* create document object and return it */
- JSObject *jsdocument;
- struct jsclass_document_priv *document;
+#define JSAPI_FS_DOCUMENT \
+ JSAPI_FS_NODE, \
+ JSAPI_FS(getElementById, 1, 0) \
- document = malloc(sizeof(document));
- if (document == NULL) {
- return NULL;
- }
- document->htmlc = htmlc;
- document->node = htmlc->document;
-
- jsdocument = JS_InitClass(cx,
- parent,
- NULL,
- &jsclass_document,
- NULL,
- 0,
- NULL,
- jsfunctions_document,
- NULL,
- NULL);
- if (jsdocument == NULL) {
- free(document);
- return NULL;
- }
- LOG(("setting document private to %p", document));
- /* private pointer to browsing context */
- if (JS_SetPrivate(cx, jsdocument, document) != JS_TRUE) {
- LOG(("failed to set document private"));
- free(document);
- return NULL;
- }
-
- return jsdocument;
-}
+#define JSAPI_PS_DOCUMENT \
+ JSAPI_PS_NODE
diff --git a/javascript/jsapi/element.c b/javascript/jsapi/element.c
index 7878393..d301321 100644
--- a/javascript/jsapi/element.c
+++ b/javascript/jsapi/element.c
@@ -16,18 +16,9 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include <dom/dom.h>
-
-
-#include "javascript/jsapi.h"
-#include "utils/config.h"
-#include "render/html_internal.h"
-#include "utils/log.h"
/* IDL
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element
-CAUTION - innerHTML etc. are not part of the DOM they come from:
-http://html5.org/specs/dom-parsing.html#extensions-to-the-element-interface
interface Element : Node {
readonly attribute DOMString? namespaceURI;
@@ -70,88 +61,39 @@ interface Element : Node {
};
*/
-static void jsfinalize_element(JSContext *cx, JSObject *obj);
+#include "jsclass.h"
-struct jsclass_document_priv {
- struct html_content *htmlc;
- dom_element *node;
-};
+#include "node.c"
-static JSClass jsclass_element =
+static JSBool JSAPI_NATIVE(getAttribute, JSContext *cx, uintN argc, jsval *vp)
{
- "Element",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_PropertyStub,
- JS_StrictPropertyStub,
- JS_EnumerateStub,
- JS_ResolveStub,
- JS_ConvertStub,
- jsfinalize_element,
- JSCLASS_NO_OPTIONAL_MEMBERS
-};
-
-#define JSCLASS_NAME element
+ struct JSCLASS_TYPE *priv;
-#include "node.c"
+ priv = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
+ if (priv == NULL)
+ return JS_FALSE;
-static void jsfinalize_element(JSContext *cx, JSObject *obj)
-{
- struct jsclass_document_priv *element;
- element = JS_GetInstancePrivate(cx, obj, &jsclass_element, NULL);
- if (element != NULL) {
- free(element);
- }
-}
+ JSAPI_SET_RVAL(cx, vp, JSVAL_NULL);
+ return JS_TRUE;
+}
-static JSFunctionSpec jsfunctions_element[] = {
- JSAPI_FS_NODE,
- JSAPI_FS_END
-};
+#define JSAPI_FS_ELEMENT \
+ JSAPI_FS_NODE, \
+ JSAPI_FS(getAttribute, 0, 0)
+static JSBool JSAPI_PROPERTYGET(id, JSContext *cx, JSObject *obj, jsval *vp)
+{
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
+ return JS_TRUE;
+}
-JSObject *
-jsapi_new_element(JSContext *cx,
- JSObject *parent,
- struct html_content *htmlc,
- dom_element *domelement)
+static JSBool JSAPI_PROPERTYSET(id, JSContext *cx, JSObject *obj, jsval *vp)
{
- /* create element object and return it */
- JSObject *jselement;
- struct jsclass_document_priv *element;
-
- element = malloc(sizeof(element));
- if (element == NULL) {
- return NULL;
- }
- element->htmlc = htmlc;
- element->node = domelement;
-
- jselement = JS_InitClass(cx,
- parent,
- NULL,
- &jsclass_element,
- NULL,
- 0,
- NULL,
- jsfunctions_element,
- NULL,
- NULL);
- if (jselement == NULL) {
- free(element);
- return NULL;
- }
-
- LOG(("setting private to %p", element));
- /* private pointer to browsing context */
- if (JS_SetPrivate(cx, jselement, element) != JS_TRUE) {
- LOG(("failed to set private"));
- free(element);
- return NULL;
- }
-
- return jselement;
+ return JS_FALSE;
}
+
+#define JSAPI_PS_ELEMENT \
+ JSAPI_PS_NODE, \
+ JSAPI_PS(id, 0, JSPROP_ENUMERATE | JSPROP_SHARED)
diff --git a/javascript/jsapi/eventtarget.c b/javascript/jsapi/eventtarget.c
index fc6f6f6..e2ab6a9 100644
--- a/javascript/jsapi/eventtarget.c
+++ b/javascript/jsapi/eventtarget.c
@@ -26,19 +26,7 @@ interface EventTarget {
};
*/
-
-#ifndef JSCLASS_NAME
-#error "The class name must be defined"
-#endif
-
-#ifndef JSCLASS_TYPE
-#define CLASS jsclass
-#define PRIVATE priv
-#define EXPAND(a,b) PASTE(a,b)
-#define PASTE(x,y) x##_##y
-#define JSCLASS_OBJECT EXPAND(CLASS,JSCLASS_NAME)
-#define JSCLASS_TYPE EXPAND(JSCLASS_OBJECT,PRIVATE)
-#endif
+#include "jsclass.h"
static JSBool JSAPI_NATIVE(addEventListener, JSContext *cx, uintN argc, jsval *vp)
{
diff --git a/javascript/jsapi/htmldocument.c b/javascript/jsapi/htmldocument.c
new file mode 100644
index 0000000..260f368
--- /dev/null
+++ b/javascript/jsapi/htmldocument.c
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+#include <dom/dom.h>
+
+#include "utils/config.h"
+#include "utils/log.h"
+
+#include "javascript/jsapi.h"
+
+/* IDL
http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
+
+[OverrideBuiltins]
+partial interface Document {
+ // resource metadata management
+ [PutForwards=href] readonly attribute Location? location;
+ attribute DOMString domain;
+ readonly attribute DOMString referrer;
+ attribute DOMString cookie;
+ readonly attribute DOMString lastModified;
+ readonly attribute DOMString readyState;
+
+ // DOM tree accessors
+ getter object (DOMString name);
+ attribute DOMString title;
+ attribute DOMString dir;
+ attribute HTMLElement? body;
+ readonly attribute HTMLHeadElement? head;
+ readonly attribute HTMLCollection images;
+ readonly attribute HTMLCollection embeds;
+ readonly attribute HTMLCollection plugins;
+ readonly attribute HTMLCollection links;
+ readonly attribute HTMLCollection forms;
+ readonly attribute HTMLCollection scripts;
+ NodeList getElementsByName(DOMString elementName);
+ NodeList getItems(optional DOMString typeNames); // microdata
+ readonly attribute DOMElementMap cssElementMap;
+
+ // dynamic markup insertion
+ Document open(optional DOMString type, optional DOMString replace);
+ WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean
replace);
+ void close();
+ void write(DOMString... text);
+ void writeln(DOMString... text);
+
+ // user interaction
+ readonly attribute WindowProxy? defaultView;
+ readonly attribute Element? activeElement;
+ boolean hasFocus();
+ attribute DOMString designMode;
+ boolean execCommand(DOMString commandId);
+ boolean execCommand(DOMString commandId, boolean showUI);
+ boolean execCommand(DOMString commandId, boolean showUI, DOMString value);
+ boolean queryCommandEnabled(DOMString commandId);
+ boolean queryCommandIndeterm(DOMString commandId);
+ boolean queryCommandState(DOMString commandId);
+ boolean queryCommandSupported(DOMString commandId);
+ DOMString queryCommandValue(DOMString commandId);
+ readonly attribute HTMLCollection commands;
+
+ // event handler IDL attributes
+ attribute EventHandler onabort;
+ attribute EventHandler onblur;
+ attribute EventHandler oncancel;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onchange;
+ attribute EventHandler onclick;
+ attribute EventHandler onclose;
+ attribute EventHandler oncontextmenu;
+ attribute EventHandler oncuechange;
+ attribute EventHandler ondblclick;
+ attribute EventHandler ondrag;
+ attribute EventHandler ondragend;
+ attribute EventHandler ondragenter;
+ attribute EventHandler ondragleave;
+ attribute EventHandler ondragover;
+ attribute EventHandler ondragstart;
+ attribute EventHandler ondrop;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler onemptied;
+ attribute EventHandler onended;
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onfocus;
+ attribute EventHandler oninput;
+ attribute EventHandler oninvalid;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
+ attribute EventHandler onload;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadstart;
+ attribute EventHandler onmousedown;
+ attribute EventHandler onmousemove;
+ attribute EventHandler onmouseout;
+ attribute EventHandler onmouseover;
+ attribute EventHandler onmouseup;
+ attribute EventHandler onmousewheel;
+ attribute EventHandler onpause;
+ attribute EventHandler onplay;
+ attribute EventHandler onplaying;
+ attribute EventHandler onprogress;
+ attribute EventHandler onratechange;
+ attribute EventHandler onreset;
+ attribute EventHandler onscroll;
+ attribute EventHandler onseeked;
+ attribute EventHandler onseeking;
+ attribute EventHandler onselect;
+ attribute EventHandler onshow;
+ attribute EventHandler onstalled;
+ attribute EventHandler onsubmit;
+ attribute EventHandler onsuspend;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler onvolumechange;
+ attribute EventHandler onwaiting;
+
+ // special event handler IDL attributes that only apply to Document objects
+ [LenientThis] attribute EventHandler onreadystatechange;
+};
+
+ */
+
+static void jsfinalize_document(JSContext *cx, JSObject *obj);
+static JSBool jsresove_node(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject
**objp);
+
+struct jsclass_document_priv {
+ struct html_content *htmlc;
+ dom_document *node;
+};
+
+
+#define JSCLASS_NAME document
+
+#include "jsclass.h"
+
+static JSClass JSCLASS_OBJECT =
+{
+ "document",
+ JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE,
+ JS_PropertyStub,
+ JS_PropertyStub,
+ JS_PropertyStub,
+ JS_StrictPropertyStub,
+ JS_EnumerateStub,
+ (JSResolveOp)jsresove_node,
+ JS_ConvertStub,
+ jsfinalize_document,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+};
+
+#include "document.c"
+
+static JSBool jsresove_node(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject
**objp)
+{
+ *objp = NULL;
+ return JS_TRUE;
+}
+
+static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
+{
+ JSString* u16_txt;
+ char *txt;
+ unsigned long length;
+ struct jsclass_document_priv *document;
+
+ document = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
+ if (document == NULL) {
+ return JS_FALSE;
+ }
+
+ if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt)) {
+ return JS_FALSE;
+ }
+
+ JSString_to_char(u16_txt, txt, length);
+
+ LOG(("content %p parser %p writing %s",
+ document->htmlc, document->htmlc->parser, txt));
+ if (document->htmlc->parser != NULL) {
+ dom_hubbub_parser_insert_chunk(document->htmlc->parser, (uint8_t *)txt, length);
+ }
+ JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
+
+ return JS_TRUE;
+}
+
+static JSFunctionSpec jsfunctions_document[] = {
+ JSAPI_FS_DOCUMENT,
+ JSAPI_FS(write, 1, 0),
+ JSAPI_FS_END
+};
+
+static JSPropertySpec jsproperties_document[] =
+{
+ JSAPI_PS_DOCUMENT,
+ JSAPI_PS_END
+};
+
+static void jsfinalize_document(JSContext *cx, JSObject *obj)
+{
+ struct jsclass_document_priv *document;
+
+ document = JS_GetInstancePrivate(cx, obj, &JSCLASS_OBJECT, NULL);
+ if (document != NULL) {
+ free(document);
+ }
+}
+
+JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, struct html_content
*htmlc)
+{
+ /* create document object and return it */
+ JSObject *jsdocument;
+ struct jsclass_document_priv *document;
+
+ document = malloc(sizeof(document));
+ if (document == NULL) {
+ return NULL;
+ }
+ document->htmlc = htmlc;
+ document->node = htmlc->document;
+
+ jsdocument = JS_InitClass(cx,
+ parent,
+ NULL,
+ &JSCLASS_OBJECT,
+ NULL,
+ 0,
+ jsproperties_document,
+ jsfunctions_document,
+ NULL,
+ NULL);
+ if (jsdocument == NULL) {
+ free(document);
+ return NULL;
+ }
+
+ LOG(("setting document private to %p", document));
+ /* private pointer to browsing context */
+ if (JS_SetPrivate(cx, jsdocument, document) != JS_TRUE) {
+ LOG(("failed to set document private"));
+ free(document);
+ return NULL;
+ }
+
+ return jsdocument;
+}
diff --git a/javascript/jsapi/htmlelement.c b/javascript/jsapi/htmlelement.c
new file mode 100644
index 0000000..a7846ba
--- /dev/null
+++ b/javascript/jsapi/htmlelement.c
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+#include <dom/dom.h>
+
+#include "utils/config.h"
+#include "utils/log.h"
+#include "render/html_internal.h"
+
+#include "javascript/jsapi.h"
+
+/* IDL
http://www.whatwg.org/specs/web-apps/current-work/#elements-in-the-dom
+
+CAUTION - innerHTML and outerHTML etc. are part of the DOM parsing
+ specification but more can be found in:
+http://html5.org/specs/dom-parsing.html#extensions-to-the-element-interface
+
+interface HTMLElement : Element {
+ // metadata attributes
+ attribute DOMString title;
+ attribute DOMString lang;
+ attribute boolean translate;
+ attribute DOMString dir;
+ readonly attribute DOMStringMap dataset;
+
+ // microdata
+ attribute boolean itemScope;
+ [PutForwards=value] readonly attribute DOMSettableTokenList itemType;
+ attribute DOMString itemId;
+ [PutForwards=value] readonly attribute DOMSettableTokenList itemRef;
+ [PutForwards=value] readonly attribute DOMSettableTokenList itemProp;
+ readonly attribute HTMLPropertiesCollection properties;
+ attribute any itemValue;
+
+ // user interaction
+ attribute boolean hidden;
+ void click();
+ attribute long tabIndex;
+ void focus();
+ void blur();
+ attribute DOMString accessKey;
+ readonly attribute DOMString accessKeyLabel;
+ attribute boolean draggable;
+ [PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
+ attribute DOMString contentEditable;
+ readonly attribute boolean isContentEditable;
+ attribute HTMLMenuElement? contextMenu;
+ attribute boolean spellcheck;
+
+ // command API
+ readonly attribute DOMString? commandType;
+ readonly attribute DOMString? commandLabel;
+ readonly attribute DOMString? commandIcon;
+ readonly attribute boolean? commandHidden;
+ readonly attribute boolean? commandDisabled;
+ readonly attribute boolean? commandChecked;
+
+ // styling
+ readonly attribute CSSStyleDeclaration style;
+
+ // event handler IDL attributes
+ attribute EventHandler onabort;
+ attribute EventHandler onblur;
+ attribute EventHandler oncancel;
+ attribute EventHandler oncanplay;
+ attribute EventHandler oncanplaythrough;
+ attribute EventHandler onchange;
+ attribute EventHandler onclick;
+ attribute EventHandler onclose;
+ attribute EventHandler oncontextmenu;
+ attribute EventHandler oncuechange;
+ attribute EventHandler ondblclick;
+ attribute EventHandler ondrag;
+ attribute EventHandler ondragend;
+ attribute EventHandler ondragenter;
+ attribute EventHandler ondragleave;
+ attribute EventHandler ondragover;
+ attribute EventHandler ondragstart;
+ attribute EventHandler ondrop;
+ attribute EventHandler ondurationchange;
+ attribute EventHandler onemptied;
+ attribute EventHandler onended;
+ attribute OnErrorEventHandler onerror;
+ attribute EventHandler onfocus;
+ attribute EventHandler oninput;
+ attribute EventHandler oninvalid;
+ attribute EventHandler onkeydown;
+ attribute EventHandler onkeypress;
+ attribute EventHandler onkeyup;
+ attribute EventHandler onload;
+ attribute EventHandler onloadeddata;
+ attribute EventHandler onloadedmetadata;
+ attribute EventHandler onloadstart;
+ attribute EventHandler onmousedown;
+ attribute EventHandler onmousemove;
+ attribute EventHandler onmouseout;
+ attribute EventHandler onmouseover;
+ attribute EventHandler onmouseup;
+ attribute EventHandler onmousewheel;
+ attribute EventHandler onpause;
+ attribute EventHandler onplay;
+ attribute EventHandler onplaying;
+ attribute EventHandler onprogress;
+ attribute EventHandler onratechange;
+ attribute EventHandler onreset;
+ attribute EventHandler onscroll;
+ attribute EventHandler onseeked;
+ attribute EventHandler onseeking;
+ attribute EventHandler onselect;
+ attribute EventHandler onshow;
+ attribute EventHandler onstalled;
+ attribute EventHandler onsubmit;
+ attribute EventHandler onsuspend;
+ attribute EventHandler ontimeupdate;
+ attribute EventHandler onvolumechange;
+ attribute EventHandler onwaiting;
+};
+
+*/
+
+static void jsfinalize_element(JSContext *cx, JSObject *obj);
+
+struct jsclass_document_priv {
+ struct html_content *htmlc;
+ dom_element *node;
+};
+
+#define JSCLASS_NAME htmlelement
+
+#include "jsclass.h"
+
+static JSClass JSCLASS_OBJECT =
+{
+ "HTMLElement",
+ JSCLASS_HAS_PRIVATE,
+ JS_PropertyStub,
+ JS_PropertyStub,
+ JS_PropertyStub,
+ JS_StrictPropertyStub,
+ JS_EnumerateStub,
+ JS_ResolveStub,
+ JS_ConvertStub,
+ jsfinalize_element,
+ JSCLASS_NO_OPTIONAL_MEMBERS
+};
+
+#include "element.c"
+
+static void jsfinalize_element(JSContext *cx, JSObject *obj)
+{
+ struct jsclass_document_priv *element;
+ element = JS_GetInstancePrivate(cx, obj, &JSCLASS_OBJECT, NULL);
+ if (element != NULL) {
+ free(element);
+ }
+}
+
+
+
+static JSFunctionSpec jsfunctions_element[] = {
+ JSAPI_FS_ELEMENT,
+ JSAPI_FS_END
+};
+
+
+
+
+static JSPropertySpec jsproperties_element[] =
+{
+ JSAPI_PS_ELEMENT,
+ JSAPI_PS_END
+};
+
+JSObject *
+jsapi_new_element(JSContext *cx,
+ JSObject *parent,
+ struct html_content *htmlc,
+ dom_element *domelement)
+{
+ /* create element object and return it */
+ JSObject *jselement;
+ struct jsclass_document_priv *element;
+
+ element = malloc(sizeof(element));
+ if (element == NULL) {
+ return NULL;
+ }
+ element->htmlc = htmlc;
+ element->node = domelement;
+
+ jselement = JS_InitClass(cx,
+ parent,
+ NULL,
+ &JSCLASS_OBJECT,
+ NULL,
+ 0,
+ jsproperties_element,
+ jsfunctions_element,
+ NULL,
+ NULL);
+ if (jselement == NULL) {
+ free(element);
+ return NULL;
+ }
+
+ LOG(("setting private to %p", element));
+ /* private pointer to browsing context */
+ if (JS_SetPrivate(cx, jselement, element) != JS_TRUE) {
+ LOG(("failed to set private"));
+ free(element);
+ return NULL;
+ }
+
+ return jselement;
+}
diff --git a/javascript/none.c b/javascript/jsapi/jsclass.h
similarity index 61%
copy from javascript/none.c
copy to javascript/jsapi/jsclass.h
index e5cfb0d..30b926a 100644
--- a/javascript/none.c
+++ b/javascript/jsapi/jsclass.h
@@ -17,37 +17,23 @@
*/
/** \file
- * Dummy implementation of javascript engine functions.
+ * jsapi pseudo class glue.
*/
-#include "content/content.h"
+#ifndef _NETSURF_JAVASCRIPT_JSAPI_JSCLASS_H_
+#define _NETSURF_JAVASCRIPT_JSAPI_JSCLASS_H_
-#include "javascript/js.h"
-#include "utils/log.h"
+#ifndef JSCLASS_NAME
+#error "The class name must be defined"
+#endif
-void js_initialise(void)
-{
-}
+#ifndef JSCLASS_TYPE
+#define CLASS jsclass
+#define PRIVATE priv
+#define EXPAND(a,b) PASTE(a,b)
+#define PASTE(x,y) x##_##y
+#define JSCLASS_OBJECT EXPAND(CLASS,JSCLASS_NAME)
+#define JSCLASS_TYPE EXPAND(JSCLASS_OBJECT,PRIVATE)
+#endif
-void js_finalise(void)
-{
-}
-
-jscontext *js_newcontext(void)
-{
- return NULL;
-}
-
-void js_destroycontext(jscontext *ctx)
-{
-}
-
-jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
-{
- return NULL;
-}
-
-bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
-{
- return true;
-}
+#endif
diff --git a/javascript/jsapi/navigator.c b/javascript/jsapi/navigator.c
index daddc1d..88fc535 100644
--- a/javascript/jsapi/navigator.c
+++ b/javascript/jsapi/navigator.c
@@ -17,8 +17,7 @@
*/
#include <assert.h>
-
-#include "javascript/jsapi.h"
+#include <stdlib.h>
#include "desktop/netsurf.h"
#include "desktop/options.h"
@@ -28,6 +27,8 @@
#include "utils/log.h"
#include "utils/utsname.h"
+#include "javascript/jsapi.h"
+
/*
* navigator properties for netsurf
*
diff --git a/javascript/jsapi/node.c b/javascript/jsapi/node.c
index ecb3200..b8c0737 100644
--- a/javascript/jsapi/node.c
+++ b/javascript/jsapi/node.c
@@ -18,6 +18,7 @@
/* IDL
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node
+
interface Node : EventTarget {
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2; // historical
@@ -73,20 +74,9 @@ interface Node : EventTarget {
};
*/
-#include "eventtarget.c"
-
-#ifndef JSCLASS_NAME
-#error "The class name must be defined"
-#endif
+#include "jsclass.h"
-#ifndef JSCLASS_TYPE
-#define CLASS jsclass
-#define PRIVATE priv
-#define EXPAND(a,b) PASTE(a,b)
-#define PASTE(x,y) x##_##y
-#define JSCLASS_OBJECT EXPAND(CLASS,JSCLASS_NAME)
-#define JSCLASS_TYPE EXPAND(JSCLASS_OBJECT,PRIVATE)
-#endif
+#include "eventtarget.c"
static JSBool JSAPI_NATIVE(hasChildNodes, JSContext *cx, uintN argc, jsval *vp)
{
@@ -270,8 +260,7 @@ static JSBool JSAPI_NATIVE(isDefaultNamespace, JSContext *cx, uintN
argc, jsval
return JS_TRUE;
}
-
-#define JSAPI_FS_NODE \
+#define JSAPI_FS_NODE \
JSAPI_FS_EVENTTARGET, \
JSAPI_FS(hasChildNodes, 0, 0), \
JSAPI_FS(compareDocumentPosition, 0, 0), \
@@ -286,3 +275,25 @@ static JSBool JSAPI_NATIVE(isDefaultNamespace, JSContext *cx, uintN
argc, jsval
JSAPI_FS(lookupPrefix, 0, 0), \
JSAPI_FS(lookupNamespaceURI, 0, 0), \
JSAPI_FS(isDefaultNamespace, 0, 0)
+
+
+static JSBool JSAPI_PROPERTYGET(nodeType, JSContext *cx, JSObject *obj, jsval *vp)
+{
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
+ return JS_TRUE;
+}
+
+static JSBool JSAPI_PROPERTYGET(textContent, JSContext *cx, JSObject *obj, jsval *vp)
+{
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
+ return JS_TRUE;
+}
+
+static JSBool JSAPI_PROPERTYSET(textContent, JSContext *cx, JSObject *obj, jsval *vp)
+{
+ return JS_FALSE;
+}
+
+#define JSAPI_PS_NODE \
+ JSAPI_PS_RO(nodeType, 0, JSPROP_ENUMERATE | JSPROP_SHARED), \
+ JSAPI_PS(textContent, 0, JSPROP_ENUMERATE | JSPROP_SHARED)
diff --git a/javascript/jsapi/window.c b/javascript/jsapi/window.c
index 0b7673b..72d3837 100644
--- a/javascript/jsapi/window.c
+++ b/javascript/jsapi/window.c
@@ -16,11 +16,10 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include "javascript/jsapi.h"
-
-#include "content/content.h"
#include "utils/log.h"
+#include "javascript/jsapi.h"
+
/* IDL
[NamedPropertiesObject]
@@ -249,27 +248,16 @@ static JSBool JSAPI_PROPERTYGET(window, JSContext *cx, JSObject
*obj, jsval *vp)
return JS_TRUE;
}
-static JSBool JSAPI_PROPERTYSET(window, JSContext *cx, JSObject *obj, jsval *vp)
-{
- return JS_FALSE;
-}
-
static JSBool JSAPI_PROPERTYGET(self, JSContext *cx, JSObject *obj, jsval *vp)
{
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
return JS_TRUE;
}
-static JSBool JSAPI_PROPERTYSET(self, JSContext *cx, JSObject *obj, jsval *vp)
-{
- return JS_FALSE;
-}
-
-
static JSPropertySpec jsproperties_window[] =
{
- JSAPI_PS(window, 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_SHARED),
- JSAPI_PS(self, 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_SHARED),
+ JSAPI_PS_RO(window, 0, JSPROP_ENUMERATE | JSPROP_SHARED),
+ JSAPI_PS_RO(self, 0, JSPROP_ENUMERATE | JSPROP_SHARED),
JSAPI_PS_END
};
diff --git a/monkey/Makefile.target b/monkey/Makefile.target
index a60c1d7..b72734f 100644
--- a/monkey/Makefile.target
+++ b/monkey/Makefile.target
@@ -1,3 +1,8 @@
+#
+# Makefile for NetSurf monkey target
+#
+# This file is part of NetSurf
+
# ----------------------------------------------------------------------------
# Monkey flag setup (using pkg-config)
# ----------------------------------------------------------------------------
@@ -36,7 +41,7 @@
$(shell $(PKG_CONFIG) --cflags openssl) \
$(shell xml2-config --cflags)
- MONKEYLDFLAGS := $(shell $(PKG_CONFIG) --cflags --libs glib-2.0 lcms)
+ MONKEYLDFLAGS := -lm $(shell $(PKG_CONFIG) --cflags --libs glib-2.0 lcms)
CFLAGS += $(MONKEYCFLAGS) -Werror
LDFLAGS += $(MONKEYLDFLAGS)
@@ -65,3 +70,15 @@ S_MONKEY := $(addprefix monkey/,$(S_MONKEY))
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_PDF) $(S_MONKEY)
EXETARGET := nsmonkey
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-monkey:
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-monkey:
diff --git a/monkey/browser.c b/monkey/browser.c
index 265821c..ddea086 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -21,7 +21,7 @@
#include <stdio.h>
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/gui.h"
#include "utils/ring.h"
#include "utils/log.h"
@@ -339,7 +339,8 @@ gui_empty_clipboard(void)
}
bool
-gui_add_to_clipboard(const char *text, size_t length, bool space)
+gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
return true;
}
diff --git a/render/box.c b/render/box.c
index ff74478..f731558 100644
--- a/render/box.c
+++ b/render/box.c
@@ -350,7 +350,6 @@ void box_bounds(struct box *box, struct rect *r)
* to position of returned box, if any
* \param box_y position of box, in global document coordinates, updated
* to position of returned box, if any
- * \param content updated to content of object that returned box is in, if any
* \return box at given point, or 0 if none found
*
* To find all the boxes in the hierarchy at a certain point, use code like
@@ -358,17 +357,15 @@ void box_bounds(struct box *box, struct rect *r)
* \code
* struct box *box = top_of_document_to_search;
* int box_x = 0, box_y = 0;
- * struct content *content = document_to_search;
*
- * while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
+ * while ((box = box_at_point(box, x, y, &box_x, &box_y))) {
* // process box
* }
* \endcode
*/
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y,
- hlcache_handle **content)
+ int *box_x, int *box_y)
{
int bx = *box_x, by = *box_y;
struct box *child, *sibling;
@@ -376,21 +373,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
assert(box);
- /* drill into HTML objects */
- if (box->object != NULL) {
- struct box *layout;
-
- if (content_get_type(box->object) == CONTENT_HTML &&
- (layout = html_get_box_tree(box->object)) !=
- NULL) {
- *content = box->object;
- box = layout;
- } else {
- goto siblings;
- }
- }
-
- /* consider floats second, since they will often overlap other boxes */
+ /* consider floats first, since they will often overlap other boxes */
for (child = box->float_children; child; child = child->next_float) {
if (box_contains_point(child, x - bx, y - by, &physically)) {
*box_x = bx + child->x -
@@ -401,8 +384,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -420,8 +402,7 @@ non_float_children:
if (physically)
return child;
else
- return box_at_point(child, x, y, box_x, box_y,
- content);
+ return box_at_point(child, x, y, box_x, box_y);
}
}
@@ -435,7 +416,6 @@ non_float_children:
}
}
-siblings:
/* siblings and siblings of ancestors */
while (box) {
if (box_is_float(box)) {
@@ -457,8 +437,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
/* ascend to float's parent */
@@ -489,8 +468,7 @@ siblings:
else
return box_at_point(sibling,
x, y,
- box_x, box_y,
- content);
+ box_x, box_y);
}
}
box = box->parent;
@@ -560,66 +538,6 @@ bool box_contains_point(struct box *box, int x, int y, bool
*physically)
/**
- * Find the box containing an object at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_object_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *object_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->object)
- object_box = box;
- }
-
- return object_box;
-}
-
-
-/**
- * Find the box containing an href at the given coordinates, if any.
- *
- * \param h content to search, must have type CONTENT_HTML
- * \param x coordinates in document units
- * \param y coordinates in document units
- */
-
-struct box *box_href_at_point(hlcache_handle *h, int x, int y)
-{
- struct box *box;
- int box_x = 0, box_y = 0;
- hlcache_handle *content = h;
- struct box *href_box = 0;
-
- box = html_get_box_tree(h);
-
- while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
- if (box->style && css_computed_visibility(box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->href)
- href_box = box;
- }
-
- return href_box;
-}
-
-
-/**
* Check whether box is nearer mouse coordinates than current nearest box
*
* \param box box to test
diff --git a/render/box.h b/render/box.h
index 492cd83..6b1d28d 100644
--- a/render/box.h
+++ b/render/box.h
@@ -90,11 +90,12 @@
#include <stdbool.h>
#include <stdio.h>
-#include "desktop/browser.h"
#include "css/css.h"
+#include "utils/nsurl.h"
#include "utils/types.h"
struct box;
+struct browser_window;
struct column;
struct object_params;
struct object_param;
@@ -323,9 +324,7 @@ void box_free_box(struct box *box);
void box_bounds(struct box *box, struct rect *r);
void box_coords(struct box *box, int *x, int *y);
struct box *box_at_point(struct box *box, const int x, const int y,
- int *box_x, int *box_y, struct hlcache_handle **content);
-struct box *box_object_at_point(struct hlcache_handle *h, int x, int y);
-struct box *box_href_at_point(struct hlcache_handle *h, int x, int y);
+ int *box_x, int *box_y);
struct box *box_pick_text_box(struct html_content *html,
int x, int y, int dir, int *dx, int *dy);
struct box *box_find_by_id(struct box *box, lwc_string *id);
diff --git a/render/box_construct.c b/render/box_construct.c
index e103d44..fe0cc2a 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1852,7 +1852,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
err = dom_element_get_attribute(n, kstr_data, &data);
if (err == DOM_NO_ERR && data != NULL) {
if (box_extract_link(dom_string_data(data), params->codebase,
- ¶ms->data)) {
+ ¶ms->data) == false) {
dom_string_unref(data);
return false;
}
diff --git a/render/box_normalise.c b/render/box_normalise.c
index 19a1cbc..8428b84 100644
--- a/render/box_normalise.c
+++ b/render/box_normalise.c
@@ -25,6 +25,7 @@
#include <assert.h>
#include <stdbool.h>
+#include <string.h>
#include "css/css.h"
#include "css/select.h"
#include "render/box.h"
diff --git a/render/form.c b/render/form.c
index c828d81..f0596b3 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1121,6 +1121,84 @@ bool form_clip_inside_select_menu(struct form_control *control,
float scale,
return false;
}
+
+/**
+ * Process a selection from a form select menu.
+ *
+ * \param bw browser window with menu
+ * \param control form control with menu
+ * \param item index of item selected from the menu
+ */
+
+static void form__select_process_selection(html_content *html,
+ struct form_control *control, int item)
+{
+ struct box *inline_box;
+ struct form_option *o;
+ int count;
+
+ assert(control != NULL);
+ assert(html != NULL);
+
+ /** \todo Even though the form code is effectively part of the html
+ * content handler, poking around inside contents is not good */
+
+ inline_box = control->box->children->children;
+
+ for (count = 0, o = control->data.select.items;
+ o != NULL;
+ count++, o = o->next) {
+ if (!control->data.select.multiple)
+ o->selected = false;
+ if (count == item) {
+ if (control->data.select.multiple) {
+ if (o->selected) {
+ o->selected = false;
+ control->data.select.num_selected--;
+ } else {
+ o->selected = true;
+ control->data.select.num_selected++;
+ }
+ } else {
+ o->selected = true;
+ }
+ }
+ if (o->selected)
+ control->data.select.current = o;
+ }
+
+ talloc_free(inline_box->text);
+ inline_box->text = 0;
+ if (control->data.select.num_selected == 0)
+ inline_box->text = talloc_strdup(html,
+ messages_get("Form_None"));
+ else if (control->data.select.num_selected == 1)
+ inline_box->text = talloc_strdup(html,
+ control->data.select.current->text);
+ else
+ inline_box->text = talloc_strdup(html,
+ messages_get("Form_Many"));
+ if (!inline_box->text) {
+ warn_user("NoMemory", 0);
+ inline_box->length = 0;
+ } else
+ inline_box->length = strlen(inline_box->text);
+ inline_box->width = control->box->width;
+
+ html__redraw_a_box(html, control->box);
+}
+
+
+void form_select_process_selection(hlcache_handle *h,
+ struct form_control *control, int item)
+{
+ assert(h != NULL);
+
+ form__select_process_selection(
+ (html_content *)hlcache_handle_get_content(h),
+ control, item);
+}
+
/**
* Handle a click on the area of the currently opened select menu.
*
@@ -1153,9 +1231,7 @@ void form_select_menu_clicked(struct form_control *control, int x,
int y)
}
if (option != NULL) {
- /* TODO: going via the bw to get a hlcache_handle is nasty */
- form_select_process_selection(html->bw->current_content,
- control, i);
+ form__select_process_selection(html, control, i);
}
menu->callback(menu->client_data, 0, 0, menu->width, menu->height);
@@ -1272,18 +1348,10 @@ void form_select_menu_scroll_callback(void *client_data,
html_content *html = (html_content *)menu->c;
switch (scrollbar_data->msg) {
- case SCROLLBAR_MSG_REDRAW:
- menu->callback(menu->client_data,
- menu->width -
- SCROLLBAR_WIDTH + scrollbar_data->x0,
- scrollbar_data->y0,
- scrollbar_data->x1 - scrollbar_data->x0,
- scrollbar_data->y1 - scrollbar_data->y0);
- break;
case SCROLLBAR_MSG_MOVED:
menu->callback(menu->client_data,
0, 0,
- menu->width - SCROLLBAR_WIDTH,
+ menu->width,
menu->height);
break;
case SCROLLBAR_MSG_SCROLL_START:
@@ -1326,75 +1394,6 @@ void form_select_get_dimensions(struct form_control *control,
*height = control->data.select.menu->height;
}
-
-/**
- * Process a selection from a form select menu.
- *
- * \param bw browser window with menu
- * \param control form control with menu
- * \param item index of item selected from the menu
- */
-
-void form_select_process_selection(hlcache_handle *h,
- struct form_control *control, int item)
-{
- struct box *inline_box;
- struct form_option *o;
- int count;
- struct content *current_content;
-
- assert(control != NULL);
- assert(h != NULL);
-
- /** \todo Even though the form code is effectively part of the html
- * content handler, poking around inside contents is not good */
- current_content = hlcache_handle_get_content(h);
-
- inline_box = control->box->children->children;
-
- for (count = 0, o = control->data.select.items;
- o != NULL;
- count++, o = o->next) {
- if (!control->data.select.multiple)
- o->selected = false;
- if (count == item) {
- if (control->data.select.multiple) {
- if (o->selected) {
- o->selected = false;
- control->data.select.num_selected--;
- } else {
- o->selected = true;
- control->data.select.num_selected++;
- }
- } else {
- o->selected = true;
- }
- }
- if (o->selected)
- control->data.select.current = o;
- }
-
- talloc_free(inline_box->text);
- inline_box->text = 0;
- if (control->data.select.num_selected == 0)
- inline_box->text = talloc_strdup(current_content,
- messages_get("Form_None"));
- else if (control->data.select.num_selected == 1)
- inline_box->text = talloc_strdup(current_content,
- control->data.select.current->text);
- else
- inline_box->text = talloc_strdup(current_content,
- messages_get("Form_Many"));
- if (!inline_box->text) {
- warn_user("NoMemory", 0);
- inline_box->length = 0;
- } else
- inline_box->length = strlen(inline_box->text);
- inline_box->width = control->box->width;
-
- html_redraw_a_box(h, control->box);
-}
-
/**
* Callback for the core select menu.
*/
@@ -1424,12 +1423,12 @@ void form_select_menu_callback(void *client_data,
* \param radio form control of type GADGET_RADIO
*/
-void form_radio_set(hlcache_handle *content,
+void form_radio_set(html_content *html,
struct form_control *radio)
{
struct form_control *control;
- assert(content);
+ assert(html);
assert(radio);
if (!radio->form)
return;
@@ -1448,12 +1447,12 @@ void form_radio_set(hlcache_handle *content,
if (control->selected) {
control->selected = false;
- html_redraw_a_box(content, control->box);
+ html__redraw_a_box(html, control->box);
}
}
radio->selected = true;
- html_redraw_a_box(content, radio->box);
+ html__redraw_a_box(html, radio->box);
}
@@ -1461,7 +1460,7 @@ void form_radio_set(hlcache_handle *content,
* Collect controls and submit a form.
*/
-void form_submit(hlcache_handle *h, struct browser_window *target,
+void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button)
{
char *data = NULL, *url = NULL;
@@ -1508,8 +1507,7 @@ void form_submit(hlcache_handle *h, struct browser_window *target,
url_destroy_components(&components);
- browser_window_go(target, url, nsurl_access(hlcache_handle_get_url(h)),
- true);
+ browser_window_go(target, url, nsurl_access(page_url), true);
break;
case method_POST_URLENC:
@@ -1521,14 +1519,12 @@ void form_submit(hlcache_handle *h, struct browser_window
*target,
}
browser_window_go_post(target, form->action, data, 0,
- true, nsurl_access(hlcache_handle_get_url(h)),
- false, true, 0);
+ true, nsurl_access(page_url), false, true, 0);
break;
case method_POST_MULTIPART:
- browser_window_go_post(target, form->action, 0,
- success, true, nsurl_access(hlcache_handle_get_url(h)),
- false, true, 0);
+ browser_window_go_post(target, form->action, 0, success,
+ true, nsurl_access(page_url), false, true, 0);
break;
}
diff --git a/render/form.h b/render/form.h
index e2f9f63..c769dc9 100644
--- a/render/form.h
+++ b/render/form.h
@@ -33,6 +33,7 @@ struct box;
struct form_control;
struct form_option;
struct form_select_menu;
+struct html_content;
/** Form submit method. */
typedef enum {
@@ -173,8 +174,8 @@ void form_select_get_dimensions(struct form_control *control,
int *width, int *height);
void form_select_process_selection(hlcache_handle *h,
struct form_control *control, int item);
-void form_submit(struct hlcache_handle *h, struct browser_window *target,
+void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button);
-void form_radio_set(struct hlcache_handle *content, struct form_control *radio);
+void form_radio_set(struct html_content *html, struct form_control *radio);
#endif
diff --git a/render/html.c b/render/html.c
index 3ee85b4..a4725ca 100644
--- a/render/html.c
+++ b/render/html.c
@@ -32,7 +32,6 @@
#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/hlcache.h"
-#include "desktop/browser.h"
#include "desktop/options.h"
#include "desktop/selection.h"
#include "desktop/scrollbar.h"
@@ -241,6 +240,7 @@ void html_finish_conversion(html_content *c)
/* convert xml tree to box tree */
LOG(("XML to box (%p)", c));
content_set_status(&c->base, messages_get("Processing"));
+ msg_data.explicit_status_text = NULL;
content_broadcast(&c->base, CONTENT_MSG_STATUS, msg_data);
exc = dom_document_get_document_element(c->document, (void *) &html);
@@ -294,7 +294,6 @@ html_create_html_data(html_content *c, const http_parameter *params)
c->frameset = NULL;
c->iframe = NULL;
c->page = NULL;
- c->box = NULL;
c->font_func = &nsfont;
c->scrollbar = NULL;
c->scripts_count = 0;
@@ -1120,7 +1119,6 @@ html_object_callback(hlcache_handle *object,
if (c->base.status != CONTENT_STATUS_LOADING && c->bw != NULL)
content_open(object,
c->bw, &c->base,
- box,
box->object_params);
break;
@@ -1169,14 +1167,22 @@ html_object_callback(hlcache_handle *object,
LOG(("%d fetches active", c->base.active));
content_add_error(&c->base, "?", 0);
- html_set_status(c, event->data.error);
- content_broadcast(&c->base, CONTENT_MSG_STATUS, event->data);
html_object_failed(box, c, o->background);
break;
case CONTENT_MSG_STATUS:
- html_set_status(c, content_get_status_message(object));
- /* content_broadcast(&c->base, CONTENT_MSG_STATUS, 0); */
+ if (event->data.explicit_status_text == NULL) {
+ /* Object content's status text updated */
+ union content_msg_data data;
+ data.explicit_status_text =
+ content_get_status_message(object);
+ html_set_status(c, data.explicit_status_text);
+ content_broadcast(&c->base, CONTENT_MSG_STATUS, data);
+ } else {
+ /* Object content wants to set explicit message */
+ content_broadcast(&c->base, CONTENT_MSG_STATUS,
+ event->data);
+ }
break;
case CONTENT_MSG_REFORMAT:
@@ -1226,7 +1232,37 @@ html_object_callback(hlcache_handle *object,
break;
case CONTENT_MSG_LINK:
- /* Don't care about favicons */
+ /* Don't care about favicons that aren't on top level content */
+ break;
+
+ case CONTENT_MSG_SCROLL:
+ if (box->scroll_x != NULL)
+ scrollbar_set(box->scroll_x, event->data.scroll.x0,
+ false);
+ if (box->scroll_y != NULL)
+ scrollbar_set(box->scroll_y, event->data.scroll.y0,
+ false);
+ break;
+
+ case CONTENT_MSG_DRAGSAVE:
+ {
+ union content_msg_data msg_data;
+ if (event->data.dragsave.content == NULL)
+ msg_data.dragsave.content = object;
+ else
+ msg_data.dragsave.content =
+ event->data.dragsave.content;
+
+ content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data);
+ }
+ break;
+
+ case CONTENT_MSG_SAVELINK:
+ case CONTENT_MSG_POINTER:
+ case CONTENT_MSG_PASTE:
+ /* These messages are for browser window layer.
+ * we're not interested, so pass them on. */
+ content_broadcast(&c->base, event->type, event->data);
break;
default:
@@ -1398,9 +1434,17 @@ html_convert_css_callback(hlcache_handle *css,
break;
case CONTENT_MSG_STATUS:
- html_set_status(parent, content_get_status_message(css));
- content_broadcast(&parent->base, CONTENT_MSG_STATUS,
- event->data);
+ if (event->data.explicit_status_text == NULL) {
+ /* Object content's status text updated */
+ html_set_status(parent,
+ content_get_status_message(css));
+ content_broadcast(&parent->base, CONTENT_MSG_STATUS,
+ event->data);
+ } else {
+ /* Object content wants to set explicit message */
+ content_broadcast(&parent->base, CONTENT_MSG_STATUS,
+ event->data);
+ }
break;
default:
@@ -2338,13 +2382,13 @@ void html_redraw_a_box(hlcache_handle *h, struct box *box)
* \param box box to redraw
*/
-void html__redraw_a_box(struct content *c, struct box *box)
+void html__redraw_a_box(struct html_content *html, struct box *box)
{
int x, y;
box_coords(box, &x, &y);
- content__request_redraw(c, x, y,
+ content__request_redraw((struct content *)html, x, y,
box->padding[LEFT] + box->width + box->padding[RIGHT],
box->padding[TOP] + box->height + box->padding[BOTTOM]);
}
@@ -2501,7 +2545,7 @@ static nserror html_clone(const struct content *old, struct content
**newc)
void html_set_status(html_content *c, const char *extra)
{
- content_set_status(&c->base, "%s", extra);
+ content_set_status(&c->base, extra);
}
@@ -2513,7 +2557,6 @@ static void
html_open(struct content *c,
struct browser_window *bw,
struct content *page,
- struct box *box,
struct object_params *params)
{
html_content *html = (html_content *) c;
@@ -2521,7 +2564,6 @@ html_open(struct content *c,
html->bw = bw;
html->page = (html_content *) page;
- html->box = box;
/* text selection */
selection_init(&html->sel, html->layout);
@@ -2537,7 +2579,6 @@ html_open(struct content *c,
content_open(object->content,
bw, c,
- object->box,
object->box->object_params);
}
}
@@ -2607,10 +2648,8 @@ html_get_contextual_content(struct content *c,
struct box *box = html->layout;
struct box *next;
int box_x = 0, box_y = 0;
- hlcache_handle *containing_content = NULL;
- while ((next = box_at_point(box, x, y, &box_x, &box_y,
- &containing_content)) != NULL) {
+ while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
box = next;
if (box->style && css_computed_visibility(box->style) ==
@@ -2622,6 +2661,10 @@ html_get_contextual_content(struct content *c,
x - box_x, y - box_y, data);
if (box->object)
+ content_get_contextual_content(box->object,
+ x - box_x, y - box_y, data);
+
+ if (box->object)
data->object = box->object;
if (box->href)
@@ -2633,6 +2676,23 @@ html_get_contextual_content(struct content *c,
box->usemap, box_x, box_y, x, y,
&target));
}
+ if (box->gadget) {
+ switch (box->gadget->type) {
+ case GADGET_TEXTBOX:
+ case GADGET_TEXTAREA:
+ case GADGET_PASSWORD:
+ data->form_features = CTX_FORM_TEXT;
+ break;
+
+ case GADGET_FILE:
+ data->form_features = CTX_FORM_FILE;
+ break;
+
+ default:
+ data->form_features = CTX_FORM_NONE;
+ break;
+ }
+ }
}
}
@@ -2655,13 +2715,11 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx,
int scry)
struct box *box = html->layout;
struct box *next;
int box_x = 0, box_y = 0;
- hlcache_handle *containing_content = NULL;
bool handled_scroll = false;
/* TODO: invert order; visit deepest box first */
- while ((next = box_at_point(box, x, y, &box_x, &box_y,
- &containing_content)) != NULL) {
+ while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
box = next;
if (box->style && css_computed_visibility(box->style) ==
@@ -2673,6 +2731,12 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int
scry)
x - box_x, y - box_y, scrx, scry) == true)
return true;
+ /* Pass into object */
+ if (box->object != NULL && content_scroll_at_point(
+ box->object, x - box_x, y - box_y,
+ scrx, scry) == true)
+ return true;
+
/* Handle box scrollbars */
if (box->scroll_y && scrollbar_scroll(box->scroll_y, scry))
handled_scroll = true;
@@ -2689,13 +2753,14 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx,
int scry)
/**
- * Drop a file onto a content at a particular point.
+ * Drop a file onto a content at a particular point, or determine if a file
+ * may be dropped onto the content at given point.
*
* \param c html content to look inside
* \param x x-coordinate of point of interest
* \param y y-coordinate of point of interest
- * \param file path to file to be dropped
- * \return true iff file drop has been handled
+ * \param file path to file to be dropped, or NULL to know if drop allowed
+ * \return true iff file drop has been handled, or if drop possible (NULL file)
*/
static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
{
@@ -2706,11 +2771,9 @@ static bool html_drop_file_at_point(struct content *c, int x, int
y, char *file)
struct box *file_box = NULL;
struct box *text_box = NULL;
int box_x = 0, box_y = 0;
- hlcache_handle *containing_content = NULL;
/* Scan box tree for boxes that can handle drop */
- while ((next = box_at_point(box, x, y, &box_x, &box_y,
- &containing_content)) != NULL) {
+ while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
box = next;
if (box->style && css_computed_visibility(box->style) ==
@@ -2721,6 +2784,10 @@ static bool html_drop_file_at_point(struct content *c, int x, int
y, char *file)
return browser_window_drop_file_at_point(box->iframe,
x - box_x, y - box_y, file);
+ if (box->object && content_drop_file_at_point(box->object,
+ x - box_x, y - box_y, file) == true)
+ return true;
+
if (box->gadget) {
switch (box->gadget->type) {
case GADGET_FILE:
@@ -2743,6 +2810,10 @@ static bool html_drop_file_at_point(struct content *c, int x, int
y, char *file)
/* No box capable of handling drop */
return false;
+ if (file == NULL)
+ /* There is a box capable of handling drop here */
+ return true;
+
/* Handle the drop */
if (file_box) {
/* File dropped on file input */
@@ -2764,10 +2835,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int
y, char *file)
file_box->gadget->value = utf8_fn;
/* Redraw box. */
- if (containing_content == NULL)
- html__redraw_a_box(c, file_box);
- else
- html_redraw_a_box(containing_content, file_box);
+ html__redraw_a_box(html, file_box);
} else if (html->bw != NULL) {
/* File dropped on text input */
@@ -2850,6 +2918,23 @@ static bool html_drop_file_at_point(struct content *c, int x, int
y, char *file)
/**
+ * Dump debug info concerning the html_content
+ *
+ * \param bw The browser window
+ * \param bw The file to dump to
+ */
+static void html_debug_dump(struct content *c, FILE *f)
+{
+ html_content *html = (html_content *) c;
+
+ assert(html != NULL);
+ assert(html->layout != NULL);
+
+ box_dump(f, html->layout, 0);
+}
+
+
+/**
* Set an HTML content's search context
*
* \param c content of type html
@@ -3177,6 +3262,7 @@ static const content_handler html_content_handler = {
.get_contextual_content = html_get_contextual_content,
.scroll_at_point = html_scroll_at_point,
.drop_file_at_point = html_drop_file_at_point,
+ .debug_dump = html_debug_dump,
.clone = html_clone,
.type = html_content_type,
.no_share = true,
diff --git a/render/html.h b/render/html.h
index dcbc1a3..e11fc76 100644
--- a/render/html.h
+++ b/render/html.h
@@ -48,6 +48,7 @@ struct object_params;
struct plotters;
struct scrollbar;
struct scrollbar_msg_data;
+struct search_context;
/**
* Container for stylesheets used by an HTML document
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 190952c..2b6bc9a 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -46,9 +46,135 @@
#include "utils/utils.h"
-static gui_pointer_shape get_pointer_shape(struct browser_window *bw,
- struct box *box, bool imagemap);
-static void html_box_drag_start(struct box *box, int x, int y);
+/**
+ * Get pointer shape for given box
+ *
+ * \param box box in question
+ * \param imagemap whether an imagemap applies to the box
+ */
+
+static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
+{
+ browser_pointer_shape pointer;
+ css_computed_style *style;
+ enum css_cursor_e cursor;
+ lwc_string **cursor_uris;
+
+ if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT)
+ style = box->children->style;
+ else
+ style = box->style;
+
+ if (style == NULL)
+ return BROWSER_POINTER_DEFAULT;
+
+ cursor = css_computed_cursor(style, &cursor_uris);
+
+ switch (cursor) {
+ case CSS_CURSOR_AUTO:
+ if (box->href || (box->gadget &&
+ (box->gadget->type == GADGET_IMAGE ||
+ box->gadget->type == GADGET_SUBMIT)) ||
+ imagemap) {
+ /* link */
+ pointer = BROWSER_POINTER_POINT;
+ } else if (box->gadget &&
+ (box->gadget->type == GADGET_TEXTBOX ||
+ box->gadget->type == GADGET_PASSWORD ||
+ box->gadget->type == GADGET_TEXTAREA)) {
+ /* text input */
+ pointer = BROWSER_POINTER_CARET;
+ } else {
+ /* html content doesn't mind */
+ pointer = BROWSER_POINTER_AUTO;
+ }
+ break;
+ case CSS_CURSOR_CROSSHAIR:
+ pointer = BROWSER_POINTER_CROSS;
+ break;
+ case CSS_CURSOR_POINTER:
+ pointer = BROWSER_POINTER_POINT;
+ break;
+ case CSS_CURSOR_MOVE:
+ pointer = BROWSER_POINTER_MOVE;
+ break;
+ case CSS_CURSOR_E_RESIZE:
+ pointer = BROWSER_POINTER_RIGHT;
+ break;
+ case CSS_CURSOR_W_RESIZE:
+ pointer = BROWSER_POINTER_LEFT;
+ break;
+ case CSS_CURSOR_N_RESIZE:
+ pointer = BROWSER_POINTER_UP;
+ break;
+ case CSS_CURSOR_S_RESIZE:
+ pointer = BROWSER_POINTER_DOWN;
+ break;
+ case CSS_CURSOR_NE_RESIZE:
+ pointer = BROWSER_POINTER_RU;
+ break;
+ case CSS_CURSOR_SW_RESIZE:
+ pointer = BROWSER_POINTER_LD;
+ break;
+ case CSS_CURSOR_SE_RESIZE:
+ pointer = BROWSER_POINTER_RD;
+ break;
+ case CSS_CURSOR_NW_RESIZE:
+ pointer = BROWSER_POINTER_LU;
+ break;
+ case CSS_CURSOR_TEXT:
+ pointer = BROWSER_POINTER_CARET;
+ break;
+ case CSS_CURSOR_WAIT:
+ pointer = BROWSER_POINTER_WAIT;
+ break;
+ case CSS_CURSOR_PROGRESS:
+ pointer = BROWSER_POINTER_PROGRESS;
+ break;
+ case CSS_CURSOR_HELP:
+ pointer = BROWSER_POINTER_HELP;
+ break;
+ default:
+ pointer = BROWSER_POINTER_DEFAULT;
+ break;
+ }
+
+ return pointer;
+}
+
+
+/**
+ * Start drag scrolling the contents of a box
+ *
+ * \param box the box to be scrolled
+ * \param x x ordinate of initial mouse position
+ * \param y y ordinate
+ */
+
+static void html_box_drag_start(struct box *box, int x, int y)
+{
+ int box_x, box_y;
+ int scroll_mouse_x, scroll_mouse_y;
+
+ box_coords(box, &box_x, &box_y);
+
+ if (box->scroll_x != NULL) {
+ scroll_mouse_x = x - box_x ;
+ scroll_mouse_y = y - (box_y + box->padding[TOP] +
+ box->height + box->padding[BOTTOM] -
+ SCROLLBAR_WIDTH);
+ scrollbar_start_content_drag(box->scroll_x,
+ scroll_mouse_x, scroll_mouse_y);
+ } else if (box->scroll_y != NULL) {
+ scroll_mouse_x = x - (box_x + box->padding[LEFT] +
+ box->width + box->padding[RIGHT] -
+ SCROLLBAR_WIDTH);
+ scroll_mouse_y = y - box_y;
+
+ scrollbar_start_content_drag(box->scroll_y,
+ scroll_mouse_x, scroll_mouse_y);
+ }
+}
/**
@@ -175,20 +301,19 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
const char *target = 0;
char status_buffer[200];
const char *status = 0;
- gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
+ browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT;
bool imagemap = false;
int box_x = 0, box_y = 0;
int gadget_box_x = 0, gadget_box_y = 0;
+ int html_object_pos_x = 0, html_object_pos_y = 0;
int text_box_x = 0;
struct box *url_box = 0;
struct box *gadget_box = 0;
struct box *text_box = 0;
- hlcache_handle *h = bw->current_content;
struct box *box;
- hlcache_handle *content = h;
- hlcache_handle *gadget_content = h;
struct form_control *gadget = 0;
hlcache_handle *object = NULL;
+ struct box *html_object_box = NULL;
struct browser_window *iframe = NULL;
struct box *next_box;
struct box *drag_candidate = NULL;
@@ -197,6 +322,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
int scroll_mouse_x = 0, scroll_mouse_y = 0;
int padding_left, padding_right, padding_top, padding_bottom;
browser_drag_type drag_type = browser_window_get_drag_type(bw);
+ union content_msg_data msg_data;
if (drag_type != DRAGGING_NONE && !mouse &&
html->visible_select_menu != NULL) {
@@ -214,9 +340,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
box->padding[BOTTOM] + box->padding[TOP];
status = form_select_mouse_action(html->visible_select_menu,
mouse, x - box_x, y - box_y);
- if (status != NULL)
- browser_window_set_status(bw, status);
- else {
+ if (status != NULL) {
+ msg_data.explicit_status_text = status;
+ content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ } else {
int width, height;
form_select_get_dimensions(html->visible_select_menu,
&width, &height);
@@ -252,8 +379,9 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = scrollbar_mouse_action(html->scrollbar, mouse,
scroll_mouse_x, scroll_mouse_y);
}
-
- browser_window_set_status(bw, status);
+
+ msg_data.explicit_status_text = status;
+ content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
return;
}
@@ -263,13 +391,13 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
/* search the box tree for a link, imagemap, form control, or
* box with scrollbars */
- box = html_get_box_tree(h);
+ box = html->layout;
/* Consider the margins of the html page now */
box_x = box->margin[LEFT];
box_y = box->margin[TOP];
- while ((next_box = box_at_point(box, x, y, &box_x, &box_y, &content)) !=
+ while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) !=
NULL) {
box = next_box;
@@ -277,8 +405,15 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
CSS_VISIBILITY_HIDDEN)
continue;
- if (box->object)
- object = box->object;
+ if (box->object) {
+ if (content_get_type(box->object) == CONTENT_HTML) {
+ html_object_box = box;
+ html_object_pos_x = box_x;
+ html_object_pos_y = box_y;
+ } else {
+ object = box->object;
+ }
+ }
if (box->iframe)
iframe = box->iframe;
@@ -299,7 +434,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
if (box->gadget) {
- gadget_content = content;
gadget = box->gadget;
gadget_box = box;
gadget_box_x = box_x;
@@ -311,7 +445,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
if (box->title)
title = box->title;
- pointer = get_pointer_shape(bw, box, false);
+ pointer = get_pointer_shape(box, false);
if ((box->scroll_x != NULL || box->scroll_y != NULL) &&
drag_candidate == NULL)
@@ -367,19 +501,19 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
if (scrollbar) {
status = scrollbar_mouse_action(scrollbar, mouse,
scroll_mouse_x, scroll_mouse_y);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
} else if (gadget) {
switch (gadget->type) {
case GADGET_SELECT:
status = messages_get("FormSelect");
- pointer = GUI_POINTER_MENU;
+ pointer = BROWSER_POINTER_MENU;
if (mouse & BROWSER_MOUSE_CLICK_1 &&
nsoption_bool(core_select_menu)) {
html->visible_select_menu = gadget;
form_open_select_menu(c, gadget,
form_select_menu_callback,
c);
- pointer = GUI_POINTER_DEFAULT;
+ pointer = BROWSER_POINTER_DEFAULT;
} else if (mouse & BROWSER_MOUSE_CLICK_1)
gui_create_form_select_menu(bw, gadget);
break;
@@ -387,13 +521,13 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
status = messages_get("FormCheckbox");
if (mouse & BROWSER_MOUSE_CLICK_1) {
gadget->selected = !gadget->selected;
- html_redraw_a_box(gadget_content, gadget_box);
+ html__redraw_a_box(html, gadget_box);
}
break;
case GADGET_RADIO:
status = messages_get("FormRadio");
if (mouse & BROWSER_MOUSE_CLICK_1)
- form_radio_set(gadget_content, gadget);
+ form_radio_set(html, gadget);
break;
case GADGET_IMAGE:
if (mouse & BROWSER_MOUSE_CLICK_1) {
@@ -407,8 +541,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
messages_get("FormSubmit"),
gadget->form->action);
status = status_buffer;
- pointer = get_pointer_shape(bw, gadget_box,
- false);
+ pointer = get_pointer_shape(gadget_box, false);
if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2))
action = ACTION_SUBMIT;
@@ -418,7 +551,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
break;
case GADGET_TEXTAREA:
status = messages_get("FormTextarea");
- pointer = get_pointer_shape(bw, gadget_box, false);
+ pointer = get_pointer_shape(gadget_box, false);
if (mouse & (BROWSER_MOUSE_PRESS_1 |
BROWSER_MOUSE_PRESS_2)) {
@@ -456,8 +589,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
DRAGGING_SELECTION,
NULL);
status = messages_get("Selecting");
- } else
- status = content_get_status_message(h);
+ }
}
else if (mouse & BROWSER_MOUSE_PRESS_1)
selection_clear(&html->sel, true);
@@ -465,7 +597,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
case GADGET_TEXTBOX:
case GADGET_PASSWORD:
status = messages_get("FormTextbox");
- pointer = get_pointer_shape(bw, gadget_box, false);
+ pointer = get_pointer_shape(gadget_box, false);
if ((mouse & BROWSER_MOUSE_PRESS_1) &&
!(mouse & (BROWSER_MOUSE_MOD_1 |
@@ -523,15 +655,18 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
} else if (object && (mouse & BROWSER_MOUSE_MOD_2)) {
- if (mouse & BROWSER_MOUSE_DRAG_2)
- gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, object,
- bw->window);
- else if (mouse & BROWSER_MOUSE_DRAG_1)
- gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, object,
- bw->window);
+ if (mouse & BROWSER_MOUSE_DRAG_2) {
+ msg_data.dragsave.type = CONTENT_SAVE_NATIVE;
+ msg_data.dragsave.content = object;
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+
+ } else if (mouse & BROWSER_MOUSE_DRAG_1) {
+ msg_data.dragsave.type = CONTENT_SAVE_ORIG;
+ msg_data.dragsave.content = object;
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+ }
/* \todo should have a drag-saving object msg */
- status = content_get_status_message(h);
} else if (iframe) {
int pos_x, pos_y;
@@ -550,6 +685,19 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
browser_window_mouse_track(iframe, mouse,
x - pos_x, y - pos_y);
}
+ } else if (html_object_box) {
+ if (mouse & BROWSER_MOUSE_CLICK_1 ||
+ mouse & BROWSER_MOUSE_CLICK_2) {
+ content_mouse_action(html_object_box->object,
+ bw, mouse,
+ x - html_object_pos_x,
+ y - html_object_pos_y);
+ } else {
+ content_mouse_track(html_object_box->object,
+ bw, mouse,
+ x - html_object_pos_x,
+ y - html_object_pos_y);
+ }
} else if (url) {
if (title) {
snprintf(status_buffer, sizeof status_buffer, "%s: %s",
@@ -558,39 +706,42 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
} else
status = nsurl_access(url);
- pointer = get_pointer_shape(bw, url_box, imagemap);
+ pointer = get_pointer_shape(url_box, imagemap);
if (mouse & BROWSER_MOUSE_CLICK_1 &&
mouse & BROWSER_MOUSE_MOD_1) {
/* force download of link */
browser_window_go_post(bw, nsurl_access(url), 0, 0,
- false, nsurl_access(hlcache_handle_get_url(h)),
+ false,
+ nsurl_access(content_get_url(c)),
true, true, 0);
+
} else if (mouse & BROWSER_MOUSE_CLICK_2 &&
mouse & BROWSER_MOUSE_MOD_1) {
- gui_window_save_link(bw->window,
- nsurl_access(url), title);
+ msg_data.savelink.url = nsurl_access(url);
+ msg_data.savelink.title = title;
+ content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data);
+
} else if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2))
action = ACTION_GO;
-
} else {
bool done = false;
/* frame resizing */
- if (bw->parent) {
- struct browser_window *parent;
- for (parent = bw->parent; parent->parent;
- parent = parent->parent);
- browser_window_resize_frames(parent, mouse,
- x + bw->x, y + bw->y,
- &pointer, &status, &done);
+ if (browser_window_frame_resize_start(bw, mouse, x, y,
+ &pointer)) {
+ if (mouse & (BROWSER_MOUSE_DRAG_1 |
+ BROWSER_MOUSE_DRAG_2)) {
+ status = messages_get("FrameDrag");
+ }
+ done = true;
}
/* if clicking in the main page, remove the selection from any
* text areas */
if (!done) {
- struct box *layout = html_get_box_tree(h);
+ struct box *layout = html->layout;
if (mouse && (mouse < BROWSER_MOUSE_MOD_1) &&
selection_root(&html->sel) != layout) {
@@ -621,57 +772,59 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
browser_window_set_drag_type(bw,
DRAGGING_SELECTION,
NULL);
- status =
- messages_get("Selecting");
- } else
- status = content_get_status_message(h);
+ status = messages_get(
+ "Selecting");
+ }
done = true;
}
- }
- else if (mouse & BROWSER_MOUSE_PRESS_1)
+
+ } else if (mouse & BROWSER_MOUSE_PRESS_1)
selection_clear(&html->sel, true);
}
if (!done) {
if (title)
status = title;
- else if (bw->loading_content)
- status = content_get_status_message(
- bw->loading_content);
- else
- status = content_get_status_message(h);
if (mouse & BROWSER_MOUSE_DRAG_1) {
if (mouse & BROWSER_MOUSE_MOD_2) {
- gui_drag_save_object(GUI_SAVE_COMPLETE,
- h, bw->window);
+ msg_data.dragsave.type =
+ CONTENT_SAVE_COMPLETE;
+ msg_data.dragsave.content = NULL;
+ content_broadcast(c,
+ CONTENT_MSG_DRAGSAVE,
+ msg_data);
} else {
- if (drag_candidate == NULL)
+ if (drag_candidate == NULL) {
browser_window_page_drag_start(
bw, x, y);
- else {
+ } else {
html_box_drag_start(
drag_candidate,
x, y);
}
- pointer = GUI_POINTER_MOVE;
+ pointer = BROWSER_POINTER_MOVE;
}
}
else if (mouse & BROWSER_MOUSE_DRAG_2) {
if (mouse & BROWSER_MOUSE_MOD_2) {
- gui_drag_save_object(GUI_SAVE_SOURCE,
- h, bw->window);
+ msg_data.dragsave.type =
+ CONTENT_SAVE_SOURCE;
+ msg_data.dragsave.content = NULL;
+ content_broadcast(c,
+ CONTENT_MSG_DRAGSAVE,
+ msg_data);
} else {
- if (drag_candidate == NULL)
+ if (drag_candidate == NULL) {
browser_window_page_drag_start(
bw, x, y);
- else {
+ } else {
html_box_drag_start(
drag_candidate,
x, y);
}
- pointer = GUI_POINTER_MOVE;
+ pointer = BROWSER_POINTER_MOVE;
}
}
}
@@ -681,29 +834,27 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
}
}
+ if (!iframe && !html_object_box) {
+ msg_data.explicit_status_text = status;
+ content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
- if (action == ACTION_SUBMIT || action == ACTION_GO)
- bw->last_action = wallclock();
-
- if (status != NULL)
- browser_window_set_status(bw, status);
-
- if (!iframe)
- browser_window_set_pointer(bw, pointer);
+ msg_data.pointer = pointer;
+ content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ }
/* deferred actions that can cause this browser_window to be destroyed
* and must therefore be done after set_status/pointer
*/
switch (action) {
case ACTION_SUBMIT:
- form_submit(bw->current_content,
+ form_submit(content_get_url(c),
browser_window_find_target(bw, target, mouse),
gadget->form, gadget);
break;
case ACTION_GO:
browser_window_go(browser_window_find_target(bw, target, mouse),
nsurl_access(url),
- nsurl_access(hlcache_handle_get_url(h)), true);
+ nsurl_access(content_get_url(c)), true);
break;
case ACTION_NONE:
break;
@@ -711,114 +862,6 @@ void html_mouse_action(struct content *c, struct browser_window
*bw,
}
-gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box,
- bool imagemap)
-{
- gui_pointer_shape pointer;
- css_computed_style *style;
- enum css_cursor_e cursor;
- lwc_string **cursor_uris;
- bool loading;
-
- assert(bw);
-
- loading = (bw->loading_content != NULL || (bw->current_content &&
- content_get_status(bw->current_content) ==
- CONTENT_STATUS_READY));
-
- if (wallclock() - bw->last_action < 100 && loading)
- /* If less than 1 second since last link followed, show
- * progress indicating pointer and we're loading something */
- return GUI_POINTER_PROGRESS;
-
- if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT)
- style = box->children->style;
- else
- style = box->style;
-
- if (style == NULL)
- return GUI_POINTER_DEFAULT;
-
- cursor = css_computed_cursor(style, &cursor_uris);
-
- switch (cursor) {
- case CSS_CURSOR_AUTO:
- if (box->href || (box->gadget &&
- (box->gadget->type == GADGET_IMAGE ||
- box->gadget->type == GADGET_SUBMIT)) ||
- imagemap) {
- /* link */
- pointer = GUI_POINTER_POINT;
- } else if (box->gadget &&
- (box->gadget->type == GADGET_TEXTBOX ||
- box->gadget->type == GADGET_PASSWORD ||
- box->gadget->type == GADGET_TEXTAREA)) {
- /* text input */
- pointer = GUI_POINTER_CARET;
- } else {
- /* anything else */
- if (loading) {
- /* loading new content */
- pointer = GUI_POINTER_PROGRESS;
- } else {
- pointer = GUI_POINTER_DEFAULT;
- }
- }
- break;
- case CSS_CURSOR_CROSSHAIR:
- pointer = GUI_POINTER_CROSS;
- break;
- case CSS_CURSOR_POINTER:
- pointer = GUI_POINTER_POINT;
- break;
- case CSS_CURSOR_MOVE:
- pointer = GUI_POINTER_MOVE;
- break;
- case CSS_CURSOR_E_RESIZE:
- pointer = GUI_POINTER_RIGHT;
- break;
- case CSS_CURSOR_W_RESIZE:
- pointer = GUI_POINTER_LEFT;
- break;
- case CSS_CURSOR_N_RESIZE:
- pointer = GUI_POINTER_UP;
- break;
- case CSS_CURSOR_S_RESIZE:
- pointer = GUI_POINTER_DOWN;
- break;
- case CSS_CURSOR_NE_RESIZE:
- pointer = GUI_POINTER_RU;
- break;
- case CSS_CURSOR_SW_RESIZE:
- pointer = GUI_POINTER_LD;
- break;
- case CSS_CURSOR_SE_RESIZE:
- pointer = GUI_POINTER_RD;
- break;
- case CSS_CURSOR_NW_RESIZE:
- pointer = GUI_POINTER_LU;
- break;
- case CSS_CURSOR_TEXT:
- pointer = GUI_POINTER_CARET;
- break;
- case CSS_CURSOR_WAIT:
- pointer = GUI_POINTER_WAIT;
- break;
- case CSS_CURSOR_PROGRESS:
- pointer = GUI_POINTER_PROGRESS;
- break;
- case CSS_CURSOR_HELP:
- pointer = GUI_POINTER_HELP;
- break;
- default:
- pointer = GUI_POINTER_DEFAULT;
- break;
- }
-
- return pointer;
-}
-
-
/**
* Callback for in-page scrollbars.
*/
@@ -828,34 +871,11 @@ void html_overflow_scroll_callback(void *client_data,
struct html_scrollbar_data *data = client_data;
html_content *html = (html_content *)data->c;
struct box *box = data->box;
- int x, y, box_x, box_y, diff_x, diff_y;
+ union content_msg_data msg_data;
switch(scrollbar_data->msg) {
- case SCROLLBAR_MSG_REDRAW:
- diff_x = box->padding[LEFT] + box->width +
- box->padding[RIGHT] - SCROLLBAR_WIDTH;
- diff_y = box->padding[TOP] + box->height +
- box->padding[BOTTOM] - SCROLLBAR_WIDTH;
-
- box_coords(box, &box_x, &box_y);
- if (scrollbar_is_horizontal(
- scrollbar_data->scrollbar)) {
- x = box_x + scrollbar_get_offset(box->scroll_x);
- y = box_y + scrollbar_get_offset(box->scroll_y) +
- diff_y;
- } else {
- x = box_x + scrollbar_get_offset(box->scroll_x) +
- diff_x;
- y = box_y + scrollbar_get_offset(box->scroll_y);
- }
- content__request_redraw((struct content *)html,
- x + scrollbar_data->x0,
- y + scrollbar_data->y0,
- scrollbar_data->x1 - scrollbar_data->x0,
- scrollbar_data->y1 - scrollbar_data->y0);
- break;
case SCROLLBAR_MSG_MOVED:
- html_redraw_a_box(html->bw->current_content, box);
+ html__redraw_a_box(html, box);
break;
case SCROLLBAR_MSG_SCROLL_START:
{
@@ -876,9 +896,10 @@ void html_overflow_scroll_callback(void *client_data,
browser_window_set_drag_type(html->bw,
DRAGGING_NONE, NULL);
-
- browser_window_set_pointer(html->bw,
- GUI_POINTER_DEFAULT);
+
+ msg_data.pointer = BROWSER_POINTER_AUTO;
+ content_broadcast(data->c, CONTENT_MSG_POINTER,
+ msg_data);
break;
}
}
@@ -918,37 +939,3 @@ void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
scroll_mouse_x, scroll_mouse_y);
}
}
-
-
-/**
- * Start drag scrolling the contents of a box
- *
- * \param box the box to be scrolled
- * \param x x ordinate of initial mouse position
- * \param y y ordinate
- */
-
-void html_box_drag_start(struct box *box, int x, int y)
-{
- int box_x, box_y;
- int scroll_mouse_x, scroll_mouse_y;
-
- box_coords(box, &box_x, &box_y);
-
- if (box->scroll_x != NULL) {
- scroll_mouse_x = x - box_x ;
- scroll_mouse_y = y - (box_y + box->padding[TOP] +
- box->height + box->padding[BOTTOM] -
- SCROLLBAR_WIDTH);
- scrollbar_start_content_drag(box->scroll_x,
- scroll_mouse_x, scroll_mouse_y);
- } else if (box->scroll_y != NULL) {
- scroll_mouse_x = x - (box_x + box->padding[LEFT] +
- box->width + box->padding[RIGHT] -
- SCROLLBAR_WIDTH);
- scroll_mouse_y = y - box_y;
-
- scrollbar_start_content_drag(box->scroll_y,
- scroll_mouse_x, scroll_mouse_y);
- }
-}
diff --git a/render/html_internal.h b/render/html_internal.h
index b4e6d2c..9ff0f98 100644
--- a/render/html_internal.h
+++ b/render/html_internal.h
@@ -95,8 +95,6 @@ typedef struct html_content {
/** Content of type CONTENT_HTML containing this, or NULL if not an
* object within a page. */
struct html_content *page;
- /** Box containing this, or NULL if not an object. */
- struct box *box;
/** Scrollbar capturing all mouse events, updated to any active HTML
* scrollbar, or NULL when no scrollbar drags active */
@@ -122,7 +120,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
void html_set_status(html_content *c, const char *extra);
-void html__redraw_a_box(struct content *c, struct box *box);
+void html__redraw_a_box(html_content *html, struct box *box);
struct browser_window *html_get_browser_window(struct content *c);
struct search_context *html_get_search(struct content *c);
diff --git a/render/html_redraw.c b/render/html_redraw.c
index eebd513..c9a163e 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -667,6 +667,11 @@ bool html_redraw_box(const html_content *html, struct box *box,
obj_data.repeat_x = false;
obj_data.repeat_y = false;
+ if (content_get_type(box->object) == CONTENT_HTML) {
+ obj_data.x /= scale;
+ obj_data.y /= scale;
+ }
+
if (!content_redraw(box->object, &obj_data, &r, ctx))
return false;
diff --git a/render/html_script.c b/render/html_script.c
index 44b661d..9edd08c 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -35,6 +35,7 @@
#include "javascript/js.h"
#include "content/content_protected.h"
#include "content/fetch.h"
+#include "content/hlcache.h"
#include "render/html_internal.h"
typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t
size) ;
@@ -188,9 +189,6 @@ convert_script_async_cb(hlcache_handle *script,
break;
case CONTENT_MSG_STATUS:
- html_set_status(parent, content_get_status_message(script));
- content_broadcast(&parent->base, CONTENT_MSG_STATUS,
- event->data);
break;
default:
@@ -248,9 +246,6 @@ convert_script_defer_cb(hlcache_handle *script,
break;
case CONTENT_MSG_STATUS:
- html_set_status(parent, content_get_status_message(script));
- content_broadcast(&parent->base, CONTENT_MSG_STATUS,
- event->data);
break;
default:
@@ -345,9 +340,6 @@ convert_script_sync_cb(hlcache_handle *script,
break;
case CONTENT_MSG_STATUS:
- html_set_status(parent, content_get_status_message(script));
- content_broadcast(&parent->base, CONTENT_MSG_STATUS,
- event->data);
break;
default:
diff --git a/render/search.c b/render/search.c
index b6f64da..d30c43f 100644
--- a/render/search.c
+++ b/render/search.c
@@ -30,7 +30,6 @@
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/browser.h"
#include "desktop/gui.h"
#include "desktop/selection.h"
#include "render/box.h"
@@ -64,62 +63,26 @@ struct list_entry {
};
struct search_context {
+ struct search_callbacks callbacks;
struct content *c;
+ struct list_entry *found;
+ struct list_entry *current; /* first for select all */
char *string;
bool prev_case_sens;
bool newsearch;
bool is_html;
- void *p; /* front-specific data */
- struct search_callbacks *callbacks;
- struct list_entry *found;
- struct list_entry *current; /* first for select all */
};
-static void search_text(const char *string, int string_len,
- struct search_context *context, search_flags_t flags);
-static const char *find_pattern(const char *string, int s_len,
- const char *pattern, int p_len, bool case_sens,
- unsigned int *m_len);
-static bool find_occurrences_html(const char *pattern, int p_len,
- struct box *cur, bool case_sens,
- struct search_context *context);
-static bool find_occurrences_text(const char *pattern, int p_len,
- struct content *c, bool case_sens,
- struct search_context *context);
-static struct list_entry *add_entry(unsigned start_idx, unsigned end_idx,
- struct search_context *context);
-static void free_matches(struct search_context *context);
-
-
-/**
- * Find the browser window that contains the content associated with a search
- *
- * \param search search context
- * \return the browser window, or NULL if none
- */
-static struct browser_window *search_get_browser_window(
- struct search_context *search)
-{
- if (search->c != NULL) {
- if (search->is_html == true) {
- return html_get_browser_window(search->c);
- } else {
- return textplain_get_browser_window(search->c);
- }
- }
- return NULL;
-}
-
/**
* create a search_context
- * \param bw the browser_window the search_context is connected to
+ * \param h the hlcache_handle the search_context is connected to
* \param callbacks the callbacks to modify appearance according to results
* \param p the pointer to send to the callbacks
* \return true for success
*/
struct search_context * search_create_context(hlcache_handle *h,
- struct search_callbacks *callbacks, void *p)
+ struct search_callbacks callbacks)
{
struct search_context *context;
struct list_entry *search_head;
@@ -162,7 +125,6 @@ struct search_context * search_create_context(hlcache_handle *h,
context->c = c;
context->is_html = (content_get_type(h) == CONTENT_HTML) ? true : false;
context->callbacks = callbacks;
- context->p = p;
if (context->is_html) {
html_set_search(context->c, context);
@@ -175,56 +137,11 @@ struct search_context * search_create_context(hlcache_handle *h,
/**
- * Begins/continues the search process
- * Note that this may be called many times for a single search.
- *
- * \param bw the browser_window to search in
- * \param flags the flags forward/back etc
- * \param string the string to match
- */
-
-void search_step(struct search_context *context, search_flags_t flags,
- const char *string)
-{
- int string_len;
- int i = 0;
-
- if ((context == NULL) || (context->callbacks == NULL)) {
- warn_user("SearchError", 0);
- return;
- }
-
-
- if (context->callbacks->add_recent != NULL)
- context->callbacks->add_recent(string, context->p);
-
- string_len = strlen(string);
- for(i = 0; i < string_len; i++)
- if (string[i] != '#' && string[i] != '*') break;
- if (i >= string_len) {
- struct browser_window *bw;
- free_matches(context);
- if (context->callbacks->status != NULL)
- context->callbacks->status(true, context->p);
- if (context->callbacks->back_state != NULL)
- context->callbacks->back_state(false, context->p);
- if (context->callbacks->forward_state != NULL)
- context->callbacks->forward_state(false, context->p);
-
- bw = search_get_browser_window(context);
- if (bw != NULL)
- browser_window_set_scroll(bw, 0, 0);
- return;
- }
- search_text(string, string_len, context, flags);
-}
-
-/**
* Release the memory used by the list of matches,
* deleting selection objects too
*/
-void free_matches(struct search_context *context)
+static void free_matches(struct search_context *context)
{
struct list_entry *a;
struct list_entry *b;
@@ -248,136 +165,6 @@ void free_matches(struct search_context *context)
}
}
-/**
- * Search for a string in the box tree
- *
- * \param string the string to search for
- * \param string_len length of search string
- */
-void search_text(const char *string, int string_len,
- struct search_context *context, search_flags_t flags)
-{
- struct rect bounds;
- struct box *box = NULL;
- struct browser_window *bw;
- bool case_sensitive, forwards, showall;
-
- case_sensitive = ((flags & SEARCH_FLAG_CASE_SENSITIVE) != 0) ?
- true : false;
- forwards = ((flags & SEARCH_FLAG_FORWARDS) != 0) ? true : false;
- showall = ((flags & SEARCH_FLAG_SHOWALL) != 0) ? true : false;
-
- if (context->c == NULL)
- return;
-
- if (context->is_html == true) {
- html_content *html = (html_content *)context->c;
-
- box = html->layout;
-
- if (!box)
- return;
- }
-
- /* LOG(("do_search '%s' - '%s' (%p, %p) %p (%d, %d) %d",
- search_data.string, string, search_data.content, c, search_data.found->next,
- search_data.prev_case_sens, case_sens, forwards)); */
-
- /* check if we need to start a new search or continue an old one */
- if (context->newsearch) {
- bool res;
-
- if (context->string != NULL)
- free(context->string);
- context->current = NULL;
- free_matches(context);
-
- context->string = malloc(string_len + 1);
- if (context->string != NULL) {
- memcpy(context->string, string, string_len);
- context->string[string_len] = '\0';
- }
-
- if ((context->callbacks != NULL) &&
- (context->callbacks->hourglass != NULL))
- context->callbacks->hourglass(true, context->p);
-
- if (context->is_html == true) {
- res = find_occurrences_html(string, string_len,
- box, case_sensitive, context);
- } else {
- res = find_occurrences_text(string, string_len,
- context->c, case_sensitive, context);
- }
-
- if (!res) {
- free_matches(context);
- if ((context->callbacks != NULL) &&
- (context->callbacks->hourglass !=
- NULL))
- context->callbacks->hourglass(false,
- context->p);
- return;
- }
- if ((context->callbacks != NULL) &&
- (context->callbacks->hourglass != NULL))
- context->callbacks->hourglass(false, context->p);
-
- context->prev_case_sens = case_sensitive;
-/* LOG(("%d %p %p (%p, %p)", new, search_data.found->next,
search_data.current,
- search_data.current->prev, search_data.current->next)); */
- /* new search, beginning at the top of the page */
- context->current = context->found->next;
- context->newsearch = false;
- }
- else if (context->current != NULL) {
- /* continued search in the direction specified */
- if (forwards) {
- if (context->current->next)
- context->current = context->current->next;
- }
- else {
- if (context->current->prev)
- context->current = context->current->prev;
- }
- }
-
- if (context->callbacks == NULL)
- return;
- if (context->callbacks->status != NULL)
- context->callbacks->status((context->current != NULL),
- context->p);
- search_show_all(showall, context);
-
- if (context->callbacks->back_state != NULL)
- context->callbacks->back_state((context->current != NULL) &&
- (context->current->prev != NULL),
- context->p);
- if (context->callbacks->forward_state != NULL)
- context->callbacks->forward_state((context->current != NULL) &&
- (context->current->next != NULL), context->p);
-
- if (context->current == NULL)
- return;
-
- if (context->is_html == true) {
- /* get box position and jump to it */
- box_coords(context->current->start_box, &bounds.x0, &bounds.y0);
- /* \todo: move x0 in by correct idx */
- box_coords(context->current->end_box, &bounds.x1, &bounds.y1);
- /* \todo: move x1 in by correct idx */
- bounds.x1 += context->current->end_box->width;
- bounds.y1 += context->current->end_box->height;
- } else {
- textplain_coords_from_range(context->c,
- context->current->start_idx,
- context->current->end_idx, &bounds);
- }
-
- bw = search_get_browser_window(context);
- if (bw != NULL)
- browser_window_scroll_visible(bw, &bounds);
-}
/**
* Find the first occurrence of 'match' in 'string' and return its index
@@ -391,8 +178,9 @@ void search_text(const char *string, int string_len,
* \return pointer to first match, NULL if none
*/
-const char *find_pattern(const char *string, int s_len, const char *pattern,
- int p_len, bool case_sens, unsigned int *m_len)
+static const char *find_pattern(const char *string, int s_len,
+ const char *pattern, int p_len, bool case_sens,
+ unsigned int *m_len)
{
struct { const char *ss, *s, *p; bool first; } context[16];
const char *ep = pattern + p_len;
@@ -494,6 +282,43 @@ const char *find_pattern(const char *string, int s_len, const char
*pattern,
return ss;
}
+
+/**
+ * Add a new entry to the list of matches
+ *
+ * \param start_idx offset of match start within textual representation
+ * \param end_idx offset of match end
+ * \return pointer to added entry, NULL iff failed
+ */
+
+static struct list_entry *add_entry(unsigned start_idx, unsigned end_idx,
+ struct search_context *context)
+{
+ struct list_entry *entry;
+
+ /* found string in box => add to list */
+ entry = calloc(1, sizeof(*entry));
+ if (!entry) {
+ warn_user("NoMemory", 0);
+ return NULL;
+ }
+
+ entry->start_idx = start_idx;
+ entry->end_idx = end_idx;
+ entry->sel = NULL;
+
+ entry->next = 0;
+ entry->prev = context->found->prev;
+ if (context->found->prev == NULL)
+ context->found->next = entry;
+ else
+ context->found->prev->next = entry;
+ context->found->prev = entry;
+
+ return entry;
+}
+
+
/**
* Finds all occurrences of a given string in the html box tree
*
@@ -503,8 +328,9 @@ const char *find_pattern(const char *string, int s_len, const char
*pattern,
* \param case_sens whether to perform a case sensitive search
* \return true on success, false on memory allocation failure
*/
-bool find_occurrences_html(const char *pattern, int p_len, struct box *cur,
- bool case_sens, struct search_context *context)
+static bool find_occurrences_html(const char *pattern, int p_len,
+ struct box *cur, bool case_sens,
+ struct search_context *context)
{
struct box *a;
@@ -552,6 +378,7 @@ bool find_occurrences_html(const char *pattern, int p_len, struct box
*cur,
return true;
}
+
/**
* Finds all occurrences of a given string in a textplain content
*
@@ -562,7 +389,7 @@ bool find_occurrences_html(const char *pattern, int p_len, struct box
*cur,
* \return true on success, false on memory allocation failure
*/
-bool find_occurrences_text(const char *pattern, int p_len,
+static bool find_occurrences_text(const char *pattern, int p_len,
struct content *c, bool case_sens,
struct search_context *context)
{
@@ -602,6 +429,196 @@ bool find_occurrences_text(const char *pattern, int p_len,
return true;
}
+
+/**
+ * Search for a string in the box tree
+ *
+ * \param string the string to search for
+ * \param string_len length of search string
+ */
+static void search_text(const char *string, int string_len,
+ struct search_context *context, search_flags_t flags)
+{
+ struct rect bounds;
+ struct box *box = NULL;
+ union content_msg_data msg_data;
+ bool case_sensitive, forwards, showall;
+
+ case_sensitive = ((flags & SEARCH_FLAG_CASE_SENSITIVE) != 0) ?
+ true : false;
+ forwards = ((flags & SEARCH_FLAG_FORWARDS) != 0) ? true : false;
+ showall = ((flags & SEARCH_FLAG_SHOWALL) != 0) ? true : false;
+
+ if (context->c == NULL)
+ return;
+
+ if (context->is_html == true) {
+ html_content *html = (html_content *)context->c;
+
+ box = html->layout;
+
+ if (!box)
+ return;
+ }
+
+ /* LOG(("do_search '%s' - '%s' (%p, %p) %p (%d, %d) %d",
+ search_data.string, string, search_data.content, c, search_data.found->next,
+ search_data.prev_case_sens, case_sens, forwards)); */
+
+ /* check if we need to start a new search or continue an old one */
+ if (context->newsearch) {
+ bool res;
+
+ if (context->string != NULL)
+ free(context->string);
+ context->current = NULL;
+ free_matches(context);
+
+ context->string = malloc(string_len + 1);
+ if (context->string != NULL) {
+ memcpy(context->string, string, string_len);
+ context->string[string_len] = '\0';
+ }
+
+ if ((context->callbacks.gui != NULL) &&
+ (context->callbacks.gui->hourglass != NULL))
+ context->callbacks.gui->hourglass(true,
+ context->callbacks.gui_p);
+
+ if (context->is_html == true) {
+ res = find_occurrences_html(string, string_len,
+ box, case_sensitive, context);
+ } else {
+ res = find_occurrences_text(string, string_len,
+ context->c, case_sensitive, context);
+ }
+
+ if (!res) {
+ free_matches(context);
+ if ((context->callbacks.gui != NULL) &&
+ (context->callbacks.gui->hourglass !=
+ NULL))
+ context->callbacks.gui->hourglass(false,
+ context->callbacks.gui_p);
+ return;
+ }
+ if ((context->callbacks.gui != NULL) &&
+ (context->callbacks.gui->hourglass != NULL))
+ context->callbacks.gui->hourglass(false,
+ context->callbacks.gui_p);
+
+ context->prev_case_sens = case_sensitive;
+/* LOG(("%d %p %p (%p, %p)", new, search_data.found->next,
search_data.current,
+ search_data.current->prev, search_data.current->next)); */
+ /* new search, beginning at the top of the page */
+ context->current = context->found->next;
+ context->newsearch = false;
+ }
+ else if (context->current != NULL) {
+ /* continued search in the direction specified */
+ if (forwards) {
+ if (context->current->next)
+ context->current = context->current->next;
+ }
+ else {
+ if (context->current->prev)
+ context->current = context->current->prev;
+ }
+ }
+
+ if (context->callbacks.gui == NULL)
+ return;
+ if (context->callbacks.gui->status != NULL)
+ context->callbacks.gui->status((context->current != NULL),
+ context->callbacks.gui_p);
+ search_show_all(showall, context);
+
+ if (context->callbacks.gui->back_state != NULL)
+ context->callbacks.gui->back_state((context->current != NULL) &&
+ (context->current->prev != NULL),
+ context->callbacks.gui_p);
+ if (context->callbacks.gui->forward_state != NULL)
+ context->callbacks.gui->forward_state(
+ (context->current != NULL) &&
+ (context->current->next != NULL),
+ context->callbacks.gui_p);
+
+ if (context->current == NULL)
+ return;
+
+ if (context->is_html == true) {
+ /* get box position and jump to it */
+ box_coords(context->current->start_box, &bounds.x0, &bounds.y0);
+ /* \todo: move x0 in by correct idx */
+ box_coords(context->current->end_box, &bounds.x1, &bounds.y1);
+ /* \todo: move x1 in by correct idx */
+ bounds.x1 += context->current->end_box->width;
+ bounds.y1 += context->current->end_box->height;
+ } else {
+ textplain_coords_from_range(context->c,
+ context->current->start_idx,
+ context->current->end_idx, &bounds);
+ }
+
+ msg_data.scroll.area = true;
+ msg_data.scroll.x0 = bounds.x0;
+ msg_data.scroll.y0 = bounds.y0;
+ msg_data.scroll.x1 = bounds.x1;
+ msg_data.scroll.y1 = bounds.y1;
+ content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data);
+}
+
+
+/**
+ * Begins/continues the search process
+ * Note that this may be called many times for a single search.
+ *
+ * \param bw the browser_window to search in
+ * \param flags the flags forward/back etc
+ * \param string the string to match
+ */
+
+void search_step(struct search_context *context, search_flags_t flags,
+ const char *string)
+{
+ int string_len;
+ int i = 0;
+
+ if ((context == NULL) || (context->callbacks.gui == NULL)) {
+ warn_user("SearchError", 0);
+ return;
+ }
+
+ if (context->callbacks.gui->add_recent != NULL)
+ context->callbacks.gui->add_recent(string,
+ context->callbacks.gui_p);
+
+ string_len = strlen(string);
+ for(i = 0; i < string_len; i++)
+ if (string[i] != '#' && string[i] != '*') break;
+ if (i >= string_len) {
+ union content_msg_data msg_data;
+ free_matches(context);
+ if (context->callbacks.gui->status != NULL)
+ context->callbacks.gui->status(true,
+ context->callbacks.gui_p);
+ if (context->callbacks.gui->back_state != NULL)
+ context->callbacks.gui->back_state(false,
+ context->callbacks.gui_p);
+ if (context->callbacks.gui->forward_state != NULL)
+ context->callbacks.gui->forward_state(false,
+ context->callbacks.gui_p);
+
+ msg_data.scroll.area = false;
+ msg_data.scroll.x0 = 0;
+ msg_data.scroll.y0 = 0;
+ content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data);
+ return;
+ }
+ search_text(string, string_len, context, flags);
+}
+
+
/**
* Determines whether any portion of the given text box should be
* selected because it matches the current search string.
@@ -632,6 +649,7 @@ bool search_term_highlighted(struct content *c,
return false;
}
+
/**
* Specifies whether all matches or just the current match should
* be highlighted in the search text.
@@ -674,40 +692,6 @@ void search_show_all(bool all, struct search_context *context)
}
}
-/**
- * Add a new entry to the list of matches
- *
- * \param start_idx offset of match start within textual representation
- * \param end_idx offset of match end
- * \return pointer to added entry, NULL iff failed
- */
-
-struct list_entry *add_entry(unsigned start_idx, unsigned end_idx,
- struct search_context *context)
-{
- struct list_entry *entry;
-
- /* found string in box => add to list */
- entry = calloc(1, sizeof(*entry));
- if (!entry) {
- warn_user("NoMemory", 0);
- return NULL;
- }
-
- entry->start_idx = start_idx;
- entry->end_idx = end_idx;
- entry->sel = NULL;
-
- entry->next = 0;
- entry->prev = context->found->prev;
- if (context->found->prev == NULL)
- context->found->next = entry;
- else
- context->found->prev->next = entry;
- context->found->prev = entry;
-
- return entry;
-}
/**
* Ends the search process, invalidating all state
@@ -717,25 +701,23 @@ void search_destroy_context(struct search_context *context)
{
assert(context != NULL);
- if (context->c != NULL) {
- struct browser_window *bw = search_get_browser_window(context);
+ if (context->callbacks.invalidate != NULL) {
+ context->callbacks.invalidate(context, context->callbacks.p);
+ }
- /* TODO: don't poke inside bw */
- if (bw->cur_search == context) {
- bw->cur_search = NULL;
- }
+ if (context->c != NULL) {
if (context->is_html)
html_set_search(context->c, NULL);
else
textplain_set_search(context->c, NULL);
}
- if ((context->string != NULL) && (context->callbacks != NULL) &&
- (context->callbacks->add_recent != NULL)) {
- context->callbacks->add_recent(context->string, context->p);
+ if ((context->string != NULL) && (context->callbacks.gui != NULL)
&&
+ (context->callbacks.gui->add_recent != NULL)) {
+ context->callbacks.gui->add_recent(context->string,
+ context->callbacks.gui_p);
free(context->string);
}
free_matches(context);
free(context);
}
-
diff --git a/render/search.h b/render/search.h
index d3abe03..e1f58f2 100644
--- a/render/search.h
+++ b/render/search.h
@@ -26,11 +26,24 @@
struct search_context;
+/**
+ * Called when a search context is destroyed
+ * \param context search context being invalidated
+ * \param p pointer for client data
+ */
+typedef void (*search_invalidate_callback)(struct search_context *context,
+ void *p);
+struct search_callbacks {
+ struct gui_search_callbacks *gui;
+ void *gui_p; /* private gui owned data */
+ search_invalidate_callback invalidate;
+ void *p; /* private client data */
+};
struct search_context * search_create_context(struct hlcache_handle *h,
- struct search_callbacks *callbacks, void *p);
+ struct search_callbacks callbacks);
void search_destroy_context(struct search_context *context);
void search_step(struct search_context *context, search_flags_t flags,
const char * string);
diff --git a/render/textinput.c b/render/textinput.c
index 0e62d1e..98746bc 100644
--- a/render/textinput.c
+++ b/render/textinput.c
@@ -554,8 +554,8 @@ static bool textinput_textarea_cut(struct content *c,
struct box *next = box->next;
if (box->type == BOX_BR) {
- if (clipboard &&
- !gui_add_to_clipboard("\n", 1, false)) {
+ if (clipboard && !gui_add_to_clipboard("\n", 1, false,
+ plot_style_font)) {
gui_commit_clipboard();
return false;
}
@@ -565,7 +565,7 @@ static bool textinput_textarea_cut(struct content *c,
if (clipboard &&
!gui_add_to_clipboard(box->text + start_idx,
box->length - start_idx,
- SPACE_LEN(box))) {
+ SPACE_LEN(box), plot_style_font)) {
gui_commit_clipboard();
return false;
}
@@ -593,7 +593,8 @@ static bool textinput_textarea_cut(struct content *c,
/* and the last box */
if (box) {
if (clipboard && !gui_add_to_clipboard(box->text + start_idx,
- end_idx - start_idx, end_idx > box->length)) {
+ end_idx - start_idx, end_idx > box->length,
+ plot_style_font)) {
success = false;
} else {
if (del) {
@@ -966,7 +967,7 @@ bool textinput_textarea_paste_text(struct browser_window *bw,
textinput_textarea_move_caret,
textarea, c);
- html__redraw_a_box(c, textarea);
+ html__redraw_a_box((html_content *)c, textarea);
}
return success;
@@ -1084,7 +1085,7 @@ static void textinput_input_update_display(struct content *c, struct
box *input,
input, c);
if (dx || redraw)
- html__redraw_a_box(c, input);
+ html__redraw_a_box(html, input);
}
@@ -1307,13 +1308,16 @@ bool textinput_textarea_callback(struct browser_window *bw,
uint32_t key,
break;
case KEY_PASTE:
- gui_paste_from_clipboard(bw->window,
- box_x + inline_container->x +
- text_box->x + pixel_offset,
- box_y + inline_container->y + text_box->y);
+ {
+ union content_msg_data msg_data;
+ msg_data.paste.x = box_x + inline_container->x +
+ text_box->x + pixel_offset;
+ msg_data.paste.y = box_y + inline_container->y + text_box->y;
+ content_broadcast(c, CONTENT_MSG_PASTE, msg_data);
/* screen updated and caret repositioned already */
return true;
+ }
case KEY_CUT_SELECTION:
{
@@ -1598,7 +1602,7 @@ bool textinput_textarea_callback(struct browser_window *bw, uint32_t
key,
textarea, c);
if (scrolled || reflow)
- html__redraw_a_box(c, textarea);
+ html__redraw_a_box(html, textarea);
return true;
}
@@ -1656,7 +1660,7 @@ void textinput_textarea_click(struct content *c, browser_mouse_state
mouse,
textarea, c);
if (scrolled)
- html__redraw_a_box(c, textarea);
+ html__redraw_a_box(html, textarea);
}
@@ -1910,7 +1914,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t
key,
selection_clear(&html->sel, true);
if (form)
- form_submit(bw->current_content, bw, form, 0);
+ form_submit(content_get_url(c), bw, form, 0);
return true;
case KEY_SHIFT_TAB:
@@ -1948,12 +1952,16 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t
key,
break;
case KEY_PASTE:
- gui_paste_from_clipboard(bw->window,
- box_x + input->children->x + text_box->x + pixel_offset,
- box_y + input->children->y + text_box->y);
+ {
+ union content_msg_data msg_data;
+ msg_data.paste.x = box_x + input->children->x + text_box->x +
+ pixel_offset;
+ msg_data.paste.y = box_y + input->children->y + text_box->y;
+ content_broadcast(c, CONTENT_MSG_PASTE, msg_data);
/* screen updated and caret repositioned already */
return true;
+ }
case KEY_CUT_SELECTION:
{
@@ -2121,7 +2129,7 @@ void textinput_input_click(struct content *c, struct box *input,
input, c);
if (dx)
- html__redraw_a_box(c, input);
+ html__redraw_a_box(html, input);
}
diff --git a/render/textplain.c b/render/textplain.c
index 7b0262b..1877f32 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -113,8 +113,7 @@ static void textplain_destroy(struct content *c);
static bool textplain_redraw(struct content *c, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx);
static void textplain_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params);
+ struct content *page, struct object_params *params);
void textplain_close(struct content *c);
struct selection *textplain_get_selection(struct content *c);
struct search_context *textplain_get_search(struct content *c);
@@ -521,8 +520,8 @@ void textplain_reformat(struct content *c, int width, int height)
/* break at last space in line */
i = space;
line[line_count-1].length = (i + 1) - line_start;
- }
- else
+
+ } else
line[line_count-1].length = i - line_start;
}
line[line_count++].start = line_start = i + 1;
@@ -628,7 +627,7 @@ void textplain_mouse_track(struct content *c, struct browser_window
*bw,
{
textplain_content *text = (textplain_content *) c;
- if (bw->drag_type == DRAGGING_SELECTION && !mouse) {
+ if (browser_window_get_drag_type(bw) == DRAGGING_SELECTION && !mouse) {
int dir = -1;
size_t idx;
@@ -641,7 +640,7 @@ void textplain_mouse_track(struct content *c, struct browser_window
*bw,
browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
}
- switch (bw->drag_type) {
+ switch (browser_window_get_drag_type(bw)) {
case DRAGGING_SELECTION: {
int dir = -1;
@@ -675,7 +674,8 @@ void textplain_mouse_action(struct content *c, struct browser_window
*bw,
browser_mouse_state mouse, int x, int y)
{
textplain_content *text = (textplain_content *) c;
- gui_pointer_shape pointer = GUI_POINTER_DEFAULT;
+ browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT;
+ union content_msg_data msg_data;
const char *status = 0;
size_t idx;
int dir = 0;
@@ -686,29 +686,23 @@ void textplain_mouse_action(struct content *c, struct browser_window
*bw,
if (selection_click(&text->sel, mouse, idx)) {
if (selection_dragging(&text->sel)) {
- bw->drag_type = DRAGGING_SELECTION;
+ browser_window_set_drag_type(bw,
+ DRAGGING_SELECTION, NULL);
status = messages_get("Selecting");
}
- else
- status = content__get_status_message(c);
- }
- else {
- if (bw->loading_content)
- status = content_get_status_message(
- bw->loading_content);
- else
- status = content__get_status_message(c);
+ } else {
if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) {
browser_window_page_drag_start(bw, x, y);
- pointer = GUI_POINTER_MOVE;
+ pointer = BROWSER_POINTER_MOVE;
}
}
- if (status != NULL)
- browser_window_set_status(bw, status);
+ msg_data.explicit_status_text = status;
+ content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
- browser_window_set_pointer(bw, pointer);
+ msg_data.pointer = pointer;
+ content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
}
@@ -860,8 +854,7 @@ bool textplain_redraw(struct content *c, struct content_redraw_data
*data,
*/
void textplain_open(struct content *c, struct browser_window *bw,
- struct content *page, struct box *box,
- struct object_params *params)
+ struct content *page, struct object_params *params)
{
textplain_content *text = (textplain_content *) c;
diff --git a/riscos/Makefile.target b/riscos/Makefile.target
index 1fb861e..2dd246a 100644
--- a/riscos/Makefile.target
+++ b/riscos/Makefile.target
@@ -1,4 +1,7 @@
-# RISC OS Target makefile
+#
+# Makefile for NetSurf RISC OS target
+#
+# This file is part of NetSurf
# ----------------------------------------------------------------------------
# RISC OS target setup
@@ -100,3 +103,23 @@ clean-run:
$(VQ)echo " CLEAN: !NetSurf/!Run$(RUNEXT)"
$(Q) $(RM) !NetSurf/!Run$(RUNEXT)
CLEANS += clean-run
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-riscos:
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-riscos: netsurf.zip
+
+netsurf.zip: $(EXETARGET)
+ $(eval $@_TMPDIR := $(shell mktemp -d))
+ $(Q) $(RM) $@
+ rsync --archive --verbose $(CURDIR)/!NetSurf $($@_TMPDIR)
+ mv $($@_TMPDIR)/!NetSurf/ReadMe $($@_TMPDIR)
+ cd $($@_TMPDIR) && /opt/netsurf/arm-unknown-riscos/env/bin/zip -9vr\,
$(CURDIR)/$@ *
+ $(Q) $(RM) -rf $($@_TMPDIR)
diff --git a/riscos/dialog.c b/riscos/dialog.c
index ab53603..1fabbcb 100644
--- a/riscos/dialog.c
+++ b/riscos/dialog.c
@@ -685,11 +685,10 @@ bool ro_gui_dialog_zoom_apply(wimp_w w) {
void ro_gui_dialog_prepare_zoom(struct gui_window *g)
{
char scale_buffer[8];
- sprintf(scale_buffer, "%.0f", g->bw->scale * 100);
+ sprintf(scale_buffer, "%.0f", browser_window_get_scale(g->bw) * 100);
ro_gui_set_icon_string(dialog_zoom, ICON_ZOOM_VALUE, scale_buffer, true);
ro_gui_set_icon_selected_state(dialog_zoom, ICON_ZOOM_FRAMES, true);
- ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES,
- !(g->bw->parent));
+ ro_gui_set_icon_shaded_state(dialog_zoom, ICON_ZOOM_FRAMES, true);
ro_gui_current_zoom_gui = g;
ro_gui_wimp_event_memorise(dialog_zoom);
}
diff --git a/riscos/gui.c b/riscos/gui.c
index e11679b..2926f63 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -65,9 +65,7 @@
#include "desktop/sslcert.h"
#include "desktop/tree.h"
#include "desktop/tree_url_node.h"
-#include "render/box.h"
#include "render/font.h"
-#include "render/html.h"
#include "riscos/content-handlers/artworks.h"
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
@@ -2224,7 +2222,7 @@ void ro_gui_view_source_bounce(wimp_message *message)
* Send the debug dump of a content to a text editor.
*/
-void ro_gui_dump_content(hlcache_handle *c)
+void ro_gui_dump_browser_window(struct browser_window *bw)
{
os_error *error;
@@ -2236,14 +2234,7 @@ void ro_gui_dump_content(hlcache_handle *c)
return;
}
- /* output debug information to file */
- switch (content_get_type(c)) {
- case CONTENT_HTML:
- box_dump(stream, html_get_box_tree(c), 0);
- break;
- default:
- break;
- }
+ browser_window_debug_dump(bw, stream);
fclose(stream);
diff --git a/riscos/gui.h b/riscos/gui.h
index cd70a39..aa9873c 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -116,7 +116,7 @@ extern struct gui_window *ro_gui_current_redraw_gui;
void ro_gui_open_window_request(wimp_open *open);
void ro_gui_screen_size(int *width, int *height);
void ro_gui_view_source(struct hlcache_handle *c);
-void ro_gui_dump_content(struct hlcache_handle *c);
+void ro_gui_dump_browser_window(struct browser_window *bw);
void ro_gui_drag_box_start(wimp_pointer *pointer);
bool ro_gui_prequit(void);
const char *ro_gui_default_language(void);
diff --git a/riscos/history.c b/riscos/history.c
index 00ff5d6..8a3b562 100644
--- a/riscos/history.c
+++ b/riscos/history.c
@@ -30,6 +30,7 @@
#include "desktop/history_core.h"
#include "desktop/plotters.h"
#include "riscos/dialog.h"
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
diff --git a/riscos/menus.c b/riscos/menus.c
index 6f69b75..5500910 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -43,10 +43,7 @@
#include "desktop/netsurf.h"
#include "desktop/selection.h"
#include "desktop/textinput.h"
-#include "render/box.h"
-#include "render/form.h"
#include "riscos/dialog.h"
-#include "render/form.h"
#include "riscos/configure.h"
#include "riscos/cookies.h"
#include "riscos/gui.h"
diff --git a/riscos/print.c b/riscos/print.c
index 46ceb85..05eb8fd 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -32,6 +32,7 @@
#include "utils/config.h"
#include "content/content.h"
#include "content/hlcache.h"
+#include "desktop/browser_private.h"
#include "desktop/options.h"
#include "desktop/plotters.h"
#include "riscos/dialog.h"
diff --git a/riscos/save.c b/riscos/save.c
index f5f4f8e..064b252 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -45,9 +45,7 @@
#include "desktop/selection.h"
#include "desktop/thumbnail.h"
#include "image/bitmap.h"
-#include "render/box.h"
#include "render/form.h"
-#include "render/html.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/menus.h"
@@ -627,40 +625,8 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
g = ro_gui_window_lookup(gui_save_sourcew);
if (g && ro_gui_window_to_window_pos(g, dx, dy, &pos)) {
- hlcache_handle *h = g->bw->current_content;
-
- if (h && content_get_type(h) == CONTENT_HTML) {
- struct box *box = html_get_box_tree(h);
- int box_x, box_y;
-
- /* Consider the margins of the html page now */
- box_x = box->margin[LEFT];
- box_y = box->margin[TOP];
-
- while (!dest_ok && (box = box_at_point(box,
- pos.x, pos.y, &box_x, &box_y,
- &h))) {
- if (box->style &&
- css_computed_visibility(
- box->style) ==
- CSS_VISIBILITY_HIDDEN)
- continue;
-
- if (box->gadget) {
- switch (box->gadget->type) {
- case GADGET_FILE:
- case GADGET_TEXTBOX:
- case GADGET_TEXTAREA:
- case GADGET_PASSWORD:
- dest_ok = true;
- break;
-
- default: /* appease compiler */
- break;
- }
- }
- }
- }
+ dest_ok = browser_window_drop_file_at_point(g->bw,
+ pos.x, pos.y, NULL);
}
if (!dest_ok) {
/* cancel the drag operation */
diff --git a/riscos/search.c b/riscos/search.c
index ea219ba..db87cad 100644
--- a/riscos/search.c
+++ b/riscos/search.c
@@ -32,10 +32,9 @@
#include "content/hlcache.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
+#include "desktop/browser_private.h"
#include "desktop/search.h"
#include "desktop/selection.h"
-#include "render/box.h"
-#include "render/html.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
#include "riscos/wimp.h"
@@ -78,7 +77,7 @@ static void ro_gui_search_set_status(bool found, void *p);
static void ro_gui_search_set_hourglass(bool active, void *p);
static void ro_gui_search_add_recent(const char *string, void *p);
-static struct search_callbacks ro_gui_search_callbacks = {
+static struct gui_search_callbacks ro_gui_search_callbacks = {
ro_gui_search_set_forward_state,
ro_gui_search_set_back_state,
ro_gui_search_set_status,
diff --git a/riscos/textselection.c b/riscos/textselection.c
index 06224a5..96c3e2c 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -229,10 +229,12 @@ void gui_clear_selection(struct gui_window *g)
* \param text text to be added
* \param length length of text in bytes
* \param space indicates whether a trailing space should be appended also
+ * \param fstyle font plot style for text
* \return true iff successful
*/
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
size_t new_length = clip_length + length + (space ? 1 : 0);
@@ -496,8 +498,6 @@ bool ro_gui_save_clipboard(const char *path)
void ro_gui_selection_dragging(wimp_message *message)
{
wimp_full_message_dragging *drag = (wimp_full_message_dragging*)message;
- struct browser_window *bw;
- hlcache_handle *h;
struct gui_window *g;
os_coord pos;
@@ -515,9 +515,6 @@ void ro_gui_selection_dragging(wimp_message *message)
if (!ro_gui_window_to_window_pos(g, drag->pos.x, drag->pos.y, &pos))
return;
- bw = g->bw;
- h = bw->current_content;
-
drag_claimed = false;
}
diff --git a/riscos/window.c b/riscos/window.c
index deae43c..b7fffd6 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -45,7 +45,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "css/css.h"
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/cookies.h"
#include "desktop/scrollbar.h"
#include "desktop/frames.h"
@@ -1993,7 +1993,7 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g,
wimp_key *key,
case IS_WIMP_KEY + wimp_KEY_F9:
/* Dump content for debugging. */
- ro_gui_dump_content(h);
+ ro_gui_dump_browser_window(g->bw);
return true;
case IS_WIMP_KEY + wimp_KEY_CONTROL + wimp_KEY_F9:
diff --git a/test/js/doc-dom1.html b/test/js/doc-dom1.html
new file mode 100644
index 0000000..b7743f4
--- /dev/null
+++ b/test/js/doc-dom1.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>Direct DOM element reference</title>
+<link rel="stylesheet" type="text/css"
href="tst.css">
+</head>
+<body>
+<h1>Direct DOM element reference</h1>
+<p>head</p>
+<script>document.write(document.head.firstElementChild.textContent);</script>
+<p>body</p>
+<script>document.write(document.body.firstElementChild.textContent);</script>
+<p>after</p>
+</body>
+</html>
diff --git a/test/js/doc-dom2.html b/test/js/doc-dom2.html
new file mode 100644
index 0000000..17a916c
--- /dev/null
+++ b/test/js/doc-dom2.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>DOM getElementById</title>
+<link rel="stylesheet" type="text/css"
href="tst.css">
+</head>
+<body>
+<h1 id="heading">Direct DOM element reference</h1>
+<p>Before</p>
+<script>document.write(document.getElementById("heading").textContent);</script>
+<p>Afterwards</p>
+</body>
+</html>
diff --git a/test/js/index.html b/test/js/index.html
index 6bb010c..2768547 100644
--- a/test/js/index.html
+++ b/test/js/index.html
@@ -7,14 +7,20 @@
<h1>Script Tests</h1>
<ul>
<li><a href="assorted.html">Assorted</a></li>
+</ul>
+<h2>Document write tests</h2>
+<ul>
<li><a href="inline-doc-write-simple.html">Simple docuemnt
write</a></li>
<li><a href="inline-doc-write.html">Script within inline
script</a></li>
<li><a href="sync-script.html">External syncronous
script</a></li>
<li><a href="sync-script-err.html">External syncronous script with
missing js file</a></li>
<li><a href="sync-script-css.html">External syncronous script (with
css)</a></li>
<li><a href="inline-innerhtml.html">Inline script innerHtml
test</a></li>
-
-
+</ul>
+<h2>Document write tests</h2>
+<ul>
+<li><a href="doc-dom1.html">Direct reference</a></li>
+<li><a href="doc-dom2.html">getElementById
reference</a></li>
</ul>
</body>
</html>
diff --git a/utils/config.h b/utils/config.h
index cd64683..bd2e303 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -90,6 +90,10 @@ char *realpath(const char *path, char *resolved_path);
#undef HAVE_STDOUT
#endif
+#define HAVE_MMAP
+#if (defined(_WIN32) || defined(riscos) || defined(__HAIKU__) || defined(__BEOS__) ||
defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
+#undef HAVE_MMAP
+#endif
/* This section toggles build options on and off.
* Simply undefine a symbol to turn the relevant feature off.
@@ -116,10 +120,12 @@ char *realpath(const char *path, char *resolved_path);
#define WITH_MMAP
#endif
+/* gtk */
#if defined(gtk)
#define WITH_THEME_INSTALL
#endif
+/* amiga */
#if defined(__amigaos4__) || defined(__AMIGA__) || \
defined(nsatari)
#define NO_IPV6
diff --git a/utils/nsurl.c b/utils/nsurl.c
index 2e73866..1107d67 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -227,11 +227,13 @@ enum url_sections {
#define nsurl__component_copy(c) (c == NULL) ? NULL : lwc_string_ref(c)
-#define nsurl__component_compare(c1, c2, match) \
- if (c1 && c2) \
- lwc_string_isequal(c1, c2, match); \
- else if (c1 || c2) \
- *match = false;
+#define nsurl__component_compare(c1, c2, match) \
+ if (c1 && c2 && lwc_error_ok == \
+ lwc_string_isequal(c1, c2, match)) { \
+ /* do nothing */ \
+ } else if (c1 || c2) { \
+ *match = false; \
+ }
/**
diff --git a/utils/types.h b/utils/types.h
index 3500968..617b493 100644
--- a/utils/types.h
+++ b/utils/types.h
@@ -52,6 +52,11 @@ struct contextual_content {
const char *link_url;
struct hlcache_handle *object;
struct hlcache_handle *main;
+ enum {
+ CTX_FORM_NONE,
+ CTX_FORM_TEXT,
+ CTX_FORM_FILE
+ } form_features;
};
#endif
diff --git a/utils/utils.h b/utils/utils.h
index 02bf75f..f3dba44 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -32,26 +32,38 @@
#ifndef NOF_ELEMENTS
#define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
#endif
+
#ifndef ABS
#define ABS(x) (((x)>0)?(x):(-(x)))
#endif
+
#ifdef __MINT__ /* avoid using GCCs builtin min/max functions */
#undef min
#undef max
#endif
+
#ifndef min
#define min(x,y) (((x)<(y))?(x):(y))
#endif
+
#ifndef max
#define max(x,y) (((x)>(y))?(x):(y))
#endif
+
#ifndef PRIxPTR
#define PRIxPTR "x"
#endif
+
#ifndef PRId64
#define PRId64 "lld"
#endif
+#if defined(_WIN32)
+#define SSIZET_FMT "Iu"
+#else
+#define SSIZET_FMT "zd"
+#endif
+
#if defined(__GNUC__) && (__GNUC__ < 3)
#define FLEX_ARRAY_LEN_DECL 0
#else
diff --git a/windows/Makefile.target b/windows/Makefile.target
index e992266..f358999 100644
--- a/windows/Makefile.target
+++ b/windows/Makefile.target
@@ -1,6 +1,7 @@
-# ----------------------------------------------------------------------------
-# Windows target setup
-# ----------------------------------------------------------------------------
+#
+# Makefile for NetSurf Windows target
+#
+# This file is part of NetSurf
LDFLAGS += -L${GCCSDK_INSTALL_ENV}/lib
CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
@@ -71,3 +72,21 @@ S_WINDOWS := $(addprefix windows/,$(S_WINDOWS))
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_WINDOWS) $(S_RESOURCES)
EXETARGET := NetSurf.exe
+
+# ----------------------------------------------------------------------------
+# Install target
+# ----------------------------------------------------------------------------
+
+install-windows:
+
+# ----------------------------------------------------------------------------
+# Package target
+# ----------------------------------------------------------------------------
+
+package-windows: netsurf-installer.exe
+
+WIN_RES_OBJ := installer.nsi NetSurf.ico netsurf.png welcome.html default.css messages
+WIN_RES_INS_OBJ := $(addprefix windows/res/,$(WIN_RES_OBJ))
+
+netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ)
+ makensis -V4 -NOCD windows/res/installer.nsi
diff --git a/windows/NetSurfInstaller.nsi b/windows/NetSurfInstaller.nsi
deleted file mode 100644
index c52b5c4..0000000
--- a/windows/NetSurfInstaller.nsi
+++ /dev/null
@@ -1,94 +0,0 @@
-; install script for nullsoft msi installer creation
-; debian package name nsis
-; paths may need adapting according to local settings
-; for release, would really need to compile source tree too
-Page license
-Page directory
-Page instfiles
-; install directory $INSTDIR = $PROGRAMFILES\NetSurf
-; install resources $PROGRAMFILES\NetSurf\res
-; install dlls $SYSDIR=%SystemRoot%\System[32]
-SetCompressor lzma
-InstallDir "$PROGRAMFILES\NetSurf"
-LicenseData ../COPYING ; \n -> \r\n
-Name NetSurf
-OutFile NetSurfInstall.exe
-Icon ../windows/res/NetSurf32.ico
-XPStyle on
-Section
- SetShellVarContext all
- SetOutPath $SYSDIR
- File /usr/local/mingw/bin/libeay32.dll
- File /usr/local/mingw/bin/libcurl-4.dll
- File /usr/local/mingw/bin/libiconv-2.dll
- File /usr/local/mingw/bin/ssleay32.dll
- File /usr/local/mingw/bin/libgnurx-0.dll
- File /usr/local/mingw/bin/libxml2-2.dll
- File /usr/local/mingw/bin/libpng12.dll
- File /usr/local/mingw/bin/libjpeg.dll
- IfFileExists "$INSTDIR\*.*" +2
- CreateDirectory "$INSTDIR"
- SetOutPath $INSTDIR
- File ../NetSurf.exe
- IfFileExists "$INSTDIR\res\*.*" +2
- CreateDirectory "$INSTDIR\res"
- SetOutPath $INSTDIR\res
- File ../windows/res/default.css
- File ../windows/res/quirks.css
- File ../windows/res/messages
- File ../windows/res/preferences
- File ../windows/res/*.bmp
- File ../windows/res/*.ico
- File ../windows/res/throbber.avi
- IfFileExists $SMPROGRAMS\NetSurf\NetSurf.lnk +2
- CreateDirectory "$SMPROGRAMS\NetSurf"
- CreateShortCut "$SMPROGRAMS\NetSurf\NetSurf.lnk"
"$INSTDIR\NetSurf.exe" "" "$INSTDIR\res\NetSurf32.ico"
- IfFileExists "$INSTDIR\src\*.*" +2
- CreateDirectory "$INSTDIR\src"
- SetOutPath "$INSTDIR\src"
- File ../Makefile
- File ../Makefile.config
- File ../Makefile.config.example
- File ../Makefile.defaults
- File ../Makefile.sources
- File ../Makefile.resources
- IfFileExists "$INSTDIR\src\content\*.*" +2
- CreateDirectory "$INSTDIR\src\content"
- SetOutPath "$INSTDIR\src\content"
- File /r /x .svn ../content/*.c
- File /r /x .svn ../content/*.h
- IfFileExists "$INSTDIR\src\css\*.*" +2
- CreateDirectory "$INSTDIR\src\css"
- SetOutPath "$INSTDIR\src\css"
- File /r /x .svn ../css/*.c
- File /r /x .svn ../css/*.h
- IfFileExists "$INSTDIR\src\desktop\*.*" +2
- CreateDirectory "$INSTDIR\src\desktop"
- SetOutPath "$INSTDIR\src\desktop"
- File /r /x .svn ../desktop/*.c
- File /r /x .svn ../desktop/*.h
- IfFileExists "$INSTDIR\src\image\*.*" +2
- CreateDirectory "$INSTDIR\src\image"
- SetOutPath "$INSTDIR\src\image"
- File /r /x .svn ../image/*.c
- File /r /x .svn ../image/*.h
- IfFileExists "$INSTDIR\src\render\*.*" +2
- CreateDirectory "$INSTDIR\src\render"
- SetOutPath "$INSTDIR\src\render"
- File /r /x .svn ../render/*.c
- File /r /x .svn ../render/*.h
- IfFileExists "$INSTDIR\src\utils\*.*" +2
- CreateDirectory "$INSTDIR\src\utils"
- SetOutPath "$INSTDIR\src\utils"
- File /r /x .svn ../utils/*.c
- File /r /x .svn ../utils/*.h
- IfFileExists "$INSTDIR\src\windows\*.*" +2
- CreateDirectory "$INSTDIR\src\windows"
- SetOutPath "$INSTDIR\src\windows"
- File /r /x .svn ../windows/*.c
- File /r /x .svn ../windows/*.h
- IfFileExists "$INSTDIR\src\Docs\*.*" +2
- CreateDirectory "$INSTDIR\src\Docs"
- SetOutPath "$INSTDIR\src\Docs"
- File /r /x .svn ../Docs/*.*
-SectionEnd
diff --git a/windows/about.c b/windows/about.c
index 164ee93..74bca0e 100644
--- a/windows/about.c
+++ b/windows/about.c
@@ -16,9 +16,12 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
-#include <windows.h>
#include <stdio.h>
+#include "utils/config.h"
+
+#include <windows.h>
+
#include "utils/utils.h"
#include "utils/messages.h"
#include "desktop/netsurf.h"
diff --git a/windows/bitmap.c b/windows/bitmap.c
index aaa5633..378dc8b 100644
--- a/windows/bitmap.c
+++ b/windows/bitmap.c
@@ -20,6 +20,9 @@
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
+
+#include "utils/config.h"
+
#include <windows.h>
#include "image/bitmap.h"
diff --git a/windows/download.c b/windows/download.c
index e9ab28b..635e3b6 100644
--- a/windows/download.c
+++ b/windows/download.c
@@ -17,10 +17,13 @@
*/
#include <limits.h>
-#include <windows.h>
-#include <shlobj.h>
#include <sys/time.h>
+#include "utils/config.h"
+
+#include <shlobj.h>
+#include <windows.h>
+
#include "content/fetch.h"
#include "desktop/gui.h"
#include "utils/schedule.h"
diff --git a/windows/drawable.c b/windows/drawable.c
index 883931e..8e35d30 100644
--- a/windows/drawable.c
+++ b/windows/drawable.c
@@ -18,10 +18,12 @@
#include <stdbool.h>
+#include "utils/config.h"
+
#include <windows.h>
#include <windowsx.h>
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/textinput.h"
#include "utils/errors.h"
#include "utils/log.h"
diff --git a/windows/findfile.c b/windows/findfile.c
index 8a3cb44..a91125c 100644
--- a/windows/findfile.c
+++ b/windows/findfile.c
@@ -17,7 +17,9 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
+#include <winsock2.h>
#include <windows.h>
+
#include <limits.h>
#include <unistd.h>
#include <stdbool.h>
@@ -25,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+
#include <curl/curl.h>
#include "utils/url.h"
diff --git a/windows/font.c b/windows/font.c
index f97e366..9a5d9eb 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -21,7 +21,11 @@
#include <inttypes.h>
#include <assert.h>
+
+#include "utils/config.h"
+
#include <windows.h>
+
#include "css/css.h"
#include "render/font.h"
#include "desktop/options.h"
diff --git a/windows/gui.c b/windows/gui.c
index 21e9d17..f7d8c4c 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -23,6 +23,8 @@
#include <unistd.h>
#include <string.h>
+#include "utils/config.h"
+
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
@@ -30,6 +32,7 @@
#include "content/urldb.h"
#include "content/fetch.h"
#include "css/utils.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/mouse.h"
#include "desktop/netsurf.h"
@@ -1764,7 +1767,8 @@ bool gui_empty_clipboard(void)
return false;
}
-bool gui_add_to_clipboard(const char *text, size_t length, bool space)
+bool gui_add_to_clipboard(const char *text, size_t length, bool space,
+ const plot_font_style_t *fstyle)
{
HANDLE hnew;
char *new, *original;
diff --git a/windows/localhistory.c b/windows/localhistory.c
index d1d533f..f58ab81 100644
--- a/windows/localhistory.c
+++ b/windows/localhistory.c
@@ -16,11 +16,13 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
+#include "utils/config.h"
+
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
-#include "desktop/browser.h"
+#include "desktop/browser_private.h"
#include "desktop/history_core.h"
#include "desktop/plotters.h"
#include "utils/utils.h"
diff --git a/windows/main.c b/windows/main.c
index 8213ca8..6fbf401 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -18,6 +18,9 @@
#include <limits.h>
#include <stdbool.h>
+
+#include "utils/config.h"
+
#include <windows.h>
#include "desktop/gui.h"
@@ -116,7 +119,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int
ncmd)
argctemp++;
}
- respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\res:"NETSURF_WINDOWS_RESPATH);
+ respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
messages = filepath_find(respaths, "messages");
diff --git a/windows/misc.c b/windows/misc.c
index 513a2bd..5132e61 100644
--- a/windows/misc.c
+++ b/windows/misc.c
@@ -20,6 +20,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+
+#include "utils/config.h"
+
#include <windows.h>
#include "desktop/cookies.h"
diff --git a/windows/plot.c b/windows/plot.c
index 2898fae..b3c3e58 100644
--- a/windows/plot.c
+++ b/windows/plot.c
@@ -22,6 +22,9 @@
#include <string.h>
#include <limits.h>
#include <math.h>
+
+#include "utils/config.h"
+
#include <windows.h>
#include "utils/log.h"
@@ -94,12 +97,13 @@ static bool line(int x0, int y0, int x1, int y1, const plot_style_t
*style)
DeleteObject(clipregion);
return false;
}
+/*
RECT r;
r.left = x0;
r.top = y0;
r.right = x1;
r.bottom = y1;
-
+*/
SelectClipRgn(plot_hdc, clipregion);
MoveToEx(plot_hdc, x0, y0, (LPPOINT) NULL);
@@ -276,15 +280,16 @@ static bool text(int x, int y, const char *text, size_t length,
int wlen;
SIZE s;
LPWSTR wstring;
- RECT r;
fontbak = (HFONT) SelectObject(plot_hdc, font);
GetTextExtentPoint(plot_hdc, text, length, &s);
+/*
+ RECT r;
r.left = x;
r.top = y - (3 * s.cy) / 4;
r.right = x + s.cx;
r.bottom = y + s.cy / 4;
-
+*/
SelectClipRgn(plot_hdc, clipregion);
SetTextAlign(plot_hdc, TA_BASELINE | TA_LEFT);
@@ -354,12 +359,13 @@ static bool disc(int x, int y, int radius, const plot_style_t
*style)
DeleteObject(brush);
return false;
}
+/*
RECT r;
r.left = x - radius;
r.top = y - radius;
r.right = x + radius;
r.bottom = y + radius;
-
+*/
SelectClipRgn(plot_hdc, clipregion);
if (style->fill_type == PLOT_OP_TYPE_NONE)
@@ -408,7 +414,7 @@ static bool arc(int x, int y, int radius, int angle1, int angle2,
DeleteObject(pen);
return false;
}
- RECT r;
+
int q1, q2;
double a1=1.0, a2=1.0, b1=1.0, b2=1.0;
q1 = (int) ((angle1 + 45) / 90) - 45;
@@ -462,11 +468,13 @@ static bool arc(int x, int y, int radius, int angle1, int angle2,
break;
}
+/*
+ RECT r;
r.left = x - radius;
r.top = y - radius;
r.right = x + radius;
r.bottom = y + radius;
-
+*/
SelectClipRgn(plot_hdc, clipregion);
Arc(plot_hdc, x - radius, y - radius, x + radius, y + radius,
diff --git a/windows/prefs.c b/windows/prefs.c
index b3cdca3..577c2a5 100644
--- a/windows/prefs.c
+++ b/windows/prefs.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
+#include "utils/config.h"
+
#include <windows.h>
#include <commctrl.h>
diff --git a/windows/res/installer.nsi b/windows/res/installer.nsi
new file mode 100644
index 0000000..9f14687
--- /dev/null
+++ b/windows/res/installer.nsi
@@ -0,0 +1,133 @@
+# This installs NetSurf execuatables and resources, creates a start menu shortcut, builds
an uninstaller, and
+# adds uninstall information to the registry for Add/Remove Programs
+
+# show up in a few places.
+# All the other settings can be tweaked by editing the !defines at the top of this
script
+!define APPNAME "NetSurf"
+!define COMPANYNAME "NetSurf"
+!define DESCRIPTION "Web Browser"
+# These three must be integers
+!define VERSIONMAJOR 3
+!define VERSIONMINOR 0
+!define VERSIONBUILD 1
+# These will be displayed by the "Click here for support information" link in
"Add/Remove Programs"
+# It is possible to use "mailto:" links in here to open the email client
+!define HELPURL "http://www.netsurf-browser.org/" # "Support
Information" link
+!define UPDATEURL "http://www.netsurf-browser.org/" # "Product
Updates" link
+!define ABOUTURL "http://www.netsurf-browser.org/" # "Publisher"
link
+# This is the size (in kB) of all the files copied into "Program Files"
+!define INSTALLSIZE 9000
+
+RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
+
+InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
+
+# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
+LicenseData "COPYING"
+# This will be in the installer/uninstaller's title bar
+Name "${COMPANYNAME} - ${APPNAME}"
+Icon "windows\res\NetSurf.ico"
+outFile "netsurf-installer.exe"
+BrandingText "${COMPANYNAME}"
+
+!include LogicLib.nsh
+
+# Just three pages - license agreement, install location, and installation
+page license
+page directory
+Page instfiles
+
+!macro VerifyUserIsAdmin
+UserInfo::GetAccountType
+pop $0
+${If} $0 != "admin" ;Require admin rights on NT4+
+ messageBox mb_iconstop "Administrator rights required!"
+ setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
+ quit
+${EndIf}
+!macroend
+
+function .onInit
+ setShellVarContext all
+ !insertmacro VerifyUserIsAdmin
+functionEnd
+
+section "install"
+ # Files for the install directory - to build the installer, these should be in the same
directory as the install script (this file)
+ setOutPath $INSTDIR
+ # Files added here should be removed by the uninstaller (see section
"uninstall")
+ file "NetSurf.exe"
+ file /oname=NetSurf.ico "windows\res\NetSurf.ico"
+ file /oname=libcares-2.dll
"/opt/netsurf/i686-w64-mingw32/env/bin/libcares-2.dll"
+ file /oname=libgnurx-0.dll
"/opt/netsurf/i686-w64-mingw32/env/bin/libgnurx-0.dll"
+ file /oname=default.css "windows\res\default.css"
+ file /oname=welcome.html "windows\res\welcome.html"
+ file /oname=netsurf.png "windows\res\netsurf.png"
+ file /oname=messages "windows\res\messages"
+ # Add any other files for the install directory (license files, app data, etc) here
+
+ # Uninstaller - See function un.onInit and section "uninstall" for
configuration
+ writeUninstaller "$INSTDIR\uninstall.exe"
+
+ # Start Menu
+ createDirectory "$SMPROGRAMS\${COMPANYNAME}"
+ createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
"$INSTDIR\NetSurf.exe" "" "$INSTDIR\NetSurf.ico"
+
+ # Registry information for add/remove programs
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"InstallLocation" "$\"$INSTDIR$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"DisplayIcon" "$\"$INSTDIR\NetSurf.ico$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"Publisher" "$\"${COMPANYNAME}$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"HelpLink" "$\"${HELPURL}$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"URLUpdateInfo" "$\"${UPDATEURL}$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"URLInfoAbout" "$\"${ABOUTURL}$\""
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"DisplayVersion"
"$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"VersionMajor" ${VERSIONMAJOR}
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"VersionMinor" ${VERSIONMINOR}
+ # There is no option for modifying or repairing the install
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"NoModify" 1
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"NoRepair" 1
+ # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove
Programs can accurately report the size
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
"EstimatedSize" ${INSTALLSIZE}
+sectionEnd
+
+# Uninstaller
+
+function un.onInit
+ SetShellVarContext all
+
+ #Verify the uninstaller - last chance to back out
+ MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
+ Abort
+ next:
+ !insertmacro VerifyUserIsAdmin
+functionEnd
+
+section "uninstall"
+
+ # Remove Start Menu launcher
+ delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
+ # Try to remove the Start Menu folder - this will only happen if it is empty
+ rmDir "$SMPROGRAMS\${COMPANYNAME}"
+
+ # Remove files
+ delete $INSTDIR\NetSurf.exe
+ delete $INSTDIR\NetSurf.ico
+ delete $INSTDIR\libcares-2.dll
+ delete $INSTDIR\libgnurx-0.dll
+ delete $INSTDIR\default.css
+ delete $INSTDIR\welcome.html
+ delete $INSTDIR\netsurf.png
+ delete $INSTDIR\messages
+
+ # Always delete uninstaller as the last action
+ delete $INSTDIR\uninstall.exe
+
+ # Try to remove the install directory - this will only happen if it is empty
+ rmDir $INSTDIR
+
+ # Remove uninstaller information from the registry
+ DeleteRegKey HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
+sectionEnd
diff --git a/beos/res/internal.css b/windows/res/internal.css
similarity index 100%
copy from beos/res/internal.css
copy to windows/res/internal.css
diff --git a/beos/res/netsurf.png b/windows/res/netsurf.png
similarity index 100%
copy from beos/res/netsurf.png
copy to windows/res/netsurf.png
diff --git a/framebuffer/res/welcome.html b/windows/res/welcome.html
similarity index 100%
copy from framebuffer/res/welcome.html
copy to windows/res/welcome.html
diff --git a/windows/thumbnail.c b/windows/thumbnail.c
index e2d85fc..4ce0aba 100644
--- a/windows/thumbnail.c
+++ b/windows/thumbnail.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
+#include "utils/config.h"
+
#include <windows.h>
#include "content/urldb.h"
--
NetSurf Browser