Compare commits

..

460 Commits

Author SHA1 Message Date
pavlov%netscape.com
c45c2db17b new shit
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_NEW@91713 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-08 23:55:33 +00:00
(no author)
ebc0074860 This commit was manufactured by cvs2svn to create branch 'IMGLIB2_NEW'.
git-svn-id: svn://10.0.0.236/branches/IMGLIB2_NEW@91429 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 06:02:33 +00:00
dprice%netscape.com
5cbf372cac 65845 - new order files
git-svn-id: svn://10.0.0.236/trunk@91428 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 06:02:32 +00:00
ben%netscape.com
5df9049d06 change comments in these files to be appropriate doc comment format. sr=hyatt.
git-svn-id: svn://10.0.0.236/trunk@91427 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 05:29:24 +00:00
anthonyd%netscape.com
d46561cd6b bug fix for 74145: Caret appears in previously disabled input field
r=cmanske
sr=sfraser


git-svn-id: svn://10.0.0.236/trunk@91426 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 05:14:29 +00:00
cls%seawood.org
1f020b6a91 Updating config.guess & config.sub with 2001-03-30 changes from the GNU master copy at :pserver:anoncvs@subversions.gnu.org:/cvs /config .
git-svn-id: svn://10.0.0.236/trunk@91425 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 04:46:56 +00:00
cls%seawood.org
14ae816e4b Updating config.guess & config.sub with 2001-03-30 changes from the GNU master copy at :pserver:anoncvs@subversions.gnu.org:/cvs /config .
git-svn-id: svn://10.0.0.236/trunk@91424 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 04:41:13 +00:00
darin%netscape.com
16416e44e5 Fixes bug 73029 "new cache time problems, reload sometimes broken"
r=disttsc@bart.nl,gagan sr=mscott


git-svn-id: svn://10.0.0.236/trunk@91420 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:56:54 +00:00
mscott%netscape.com
47e53be8a3 (NOT PART OF THE BUILD).
Help get icon urls working on the Mac. Get rid of a bogus real bytes per row value which wasn't accurate. Just rely
on the # bytes per row the image frame gives us.


git-svn-id: svn://10.0.0.236/trunk@91419 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:51:59 +00:00
mscott%netscape.com
ef5c4d9598 First Checked In.
git-svn-id: svn://10.0.0.236/trunk@91418 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:39:55 +00:00
bratell%lysator.liu.se
7259124fe2 The right fix for bug 74328. This was the one that was reviewed and I have no idea where the old one came from. r=waterson sr=jst
git-svn-id: svn://10.0.0.236/trunk@91417 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:38:20 +00:00
pinkerton%netscape.com
b6d6b1d4a4 OS_ARCH is no longer 'Rhapsody' on OSX, it's now 'Darwin'. Fixes problem
where shared libs all would try to link as stand-alone and fail to find _main().
r=beard/sr=blizzard.


git-svn-id: svn://10.0.0.236/trunk@91416 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:36:56 +00:00
disttsc%bart.nl
11c13fcf56 "Click Finish..." profile text not correctly aligned at bottom, bug=42402, author=Boris Zbarsky <bzbarsky@mit.edu>, r=ksosez@softhome.net, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91413 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:27:05 +00:00
disttsc%bart.nl
ae7ef1243d Provide default userChrome.css and userContent.css with sample (commented out) content for discoverability, bug=37642, author=Boris Zbarsky <bzbarsky@mit.edu>, r=timeless, sr=shaver
git-svn-id: svn://10.0.0.236/trunk@91412 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:20:46 +00:00
ben%netscape.com
697e3b44a9 First part of fix for bug 73508, test files for outliner bookmarks, not part of build!
(Testing only, will be removed once I'm done).


git-svn-id: svn://10.0.0.236/trunk@91411 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:17:58 +00:00
ben%netscape.com
9a4d892843 First part of fix for bug 73508, create nsIXULOutlinerBuilderObserver interface,
and install notifications for it. r=waterson, sr=shaver


git-svn-id: svn://10.0.0.236/trunk@91409 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:17:17 +00:00
bratell%lysator.liu.se
f1239e3f79 Fix for bug 74328, removing O(n^2) algorithm from ContentAppended. This saves time on big pages. r=waterson sr=jst
git-svn-id: svn://10.0.0.236/trunk@91408 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:14:57 +00:00
bratell%lysator.liu.se
bd6e87975b Fix for bug 74319, removing O(n^2) algorithm when restoring session frame state. This saves time on big pages. r=waterson sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91407 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 03:11:30 +00:00
dr%netscape.com
da65fbe16c fix for 61187 (nsIController ignores COM identity rules), contributed by MarkH@ActiveState.com, r=dr, sr=brendan
git-svn-id: svn://10.0.0.236/trunk@91405 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:45:17 +00:00
tor%cs.brown.edu
a6631a4f52 Calculate vertical scaling factor properly in DrawScaled().
r=jag,dr; sr=shaver


git-svn-id: svn://10.0.0.236/trunk@91404 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:41:51 +00:00
erik%netscape.com
6ff4f34ea1 checkin for bstell@netscape.com:
bug 54000; r=cls, sr=blizzard
enable nl_langinfo(CODESET) compiling


git-svn-id: svn://10.0.0.236/trunk@91403 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:29:59 +00:00
cls%seawood.org
7ef560bf29 Make sure that cpp & asm files are rebuilt on Makefile.in changes like .c files.
git-svn-id: svn://10.0.0.236/trunk@91402 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:12:53 +00:00
disttsc%bart.nl
c793ed4f4d Fix senna bustage by removing unnecessary #include. r=shaver
git-svn-id: svn://10.0.0.236/trunk@91401 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:12:09 +00:00
sfraser%netscape.com
4b8124de18 Fix HPUX bustage
git-svn-id: svn://10.0.0.236/trunk@91400 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 02:11:57 +00:00
brendan%mozilla.org
e4c21a8200 - Add JS_GetReservedSlot, JS_SetReservedSlot, and JSCLASS_HAS_RESERVED_SLOTS(n)
to the JS API, for per class extra slots beyond JSSLOT_PRIVATE (or starting
  there for a class that lacks JSCLASS_HAS_PRIVATE).  To avoid penalizing all
  instances, these slots are allocated only upon first property-owned slot
  allocation, or upon first JS_SetReservedSlot.

  This entailed adding getRequiredSlot and setRequiredSlot hooks to the
  JSObjectOps struct, and making obj->slots self-describing, a la BSTR.  It
  also afforded me a chance to clean up obj->slots locking so that non-native
  JSObjectOps didn't risk unlocked accesses!  Now there are thread-safe hooks
  for all uses of obj.

  First consumer is the new, DOM-glue-unifying XPConnect, which needs two
  slots per wrapped function.  Hence the change to js_FunctionClass.flags'
  initializer.

- Commented the heck out of JSClass and JSObjectOps function typedefs in
  jspubtd.h.  I hope embedders see these comments!

- Fix JS_XDRValue's default case to handle int exclusively, there is no other
  possible type (and therefore no JSMSG_BAD_JVAL_TYPE error).

- Clean up tabs in select old, tab-ridden files and sections.

- s/\<fh\>/file/g for stdio FILE * canonical variable names.


git-svn-id: svn://10.0.0.236/trunk@91396 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:53:24 +00:00
cls%seawood.org
d7180f9a7b Update our non-compiler based dependency system to build dependencies on the fly like the compiler-based system does.
Bug #66529 r=leaf


git-svn-id: svn://10.0.0.236/trunk@91393 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:18:34 +00:00
loadrunner%betak.net
acedb5b4d7 Bug 64231, The Edit|Preferences|Fonts has problem with display some foreign fonts, r=matt, nhotta, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91391 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:06:13 +00:00
loadrunner%betak.net
2e257637d0 Bug 72752, The default search engine will pick up AltaVista TradChinese, r=nhotta, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91390 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:05:28 +00:00
kmcclusk%netscape.com
b1782a1c4e Not part of the build, stand alone test program. Make gfx pixel coverage test compile and run. bug=70041. (patch from jonsmirl@mediaone.net)
git-svn-id: svn://10.0.0.236/trunk@91388 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 01:01:40 +00:00
sfraser%netscape.com
4fdc5bc10c Add nsAccessibilityFactory.cpp so this stupid thing gets registered properly. r=pinkerton
git-svn-id: svn://10.0.0.236/trunk@91387 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:47:00 +00:00
ddrinan%netscape.com
b2332346b0 Use security.default_personal_cert for client auth
git-svn-id: svn://10.0.0.236/trunk@91386 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:36:53 +00:00
ddrinan%netscape.com
c21fadfcbe Fixed some typos in the pref names
git-svn-id: svn://10.0.0.236/trunk@91385 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:35:01 +00:00
mcafee%netscape.com
fc2a5878b2 Adding named logfiles, test support.
git-svn-id: svn://10.0.0.236/trunk@91384 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:33:19 +00:00
waterson%netscape.com
17ec076943 Bug 74728, redux. Fix without leaking tokens: make sure that nsCParserNode always has an nsTokenAllocator object. r=harishd, sr=shaver
git-svn-id: svn://10.0.0.236/trunk@91383 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:27:11 +00:00
bnesse%netscape.com
81dbdbc713 Added coments based on Judson's review comments.
[Not Part of the Build]


git-svn-id: svn://10.0.0.236/trunk@91378 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-05 00:08:07 +00:00
pinkerton%netscape.com
dafd939478 forgot to wrap something in !TARGET_CARBON. fixes bustage.
git-svn-id: svn://10.0.0.236/trunk@91376 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:58:35 +00:00
sfraser%netscape.com
55a3a4f35d Fix for 74143, change nsIController to use DOMStrings. sr=hyatt, r=kin
git-svn-id: svn://10.0.0.236/trunk@91375 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:48:03 +00:00
peterlubczynski%netscape.com
3987c653e7 Fix for null pointer in full page plugins on Mac. bug 74789 a=av sr=shaver
git-svn-id: svn://10.0.0.236/trunk@91374 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:46:27 +00:00
rich.burridge%sun.com
84f19f4353 Fix for bug 72841 - Solaris Intel xptcall code should really be in separate files.
sr=shaver@mozilla.org


git-svn-id: svn://10.0.0.236/trunk@91373 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:42:40 +00:00
bryner%uiuc.edu
8365e2492e Making the CertContentListener support weak refs, this makes it so the user gets prompted to import the certificate. r=javi.
git-svn-id: svn://10.0.0.236/trunk@91370 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:30:05 +00:00
sonmi%netscape.com
23d3cc6ef4 updated
git-svn-id: svn://10.0.0.236/trunk@91369 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:28:57 +00:00
leaf%mozilla.org
5cc821a1cb Automated update
git-svn-id: svn://10.0.0.236/trunk@91368 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:15:03 +00:00
hyatt%netscape.com
c4648b083b Fix for 53670.
git-svn-id: svn://10.0.0.236/trunk@91367 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:15:02 +00:00
pinkerton%netscape.com
808c7b19d5 Add DARWIN define for osx so we don't have to keep adding RHAPSODY defines if
anything new is needed. r=leaf/sr=shaver.


git-svn-id: svn://10.0.0.236/trunk@91366 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:13:27 +00:00
hyatt%netscape.com
9ff7c61384 Fix for 53670. sr=waterson, r=danm
git-svn-id: svn://10.0.0.236/trunk@91365 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 23:12:53 +00:00
pinkerton%netscape.com
7cc8e5e508 add DefProcFakery to build.
git-svn-id: svn://10.0.0.236/trunk@91364 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:57:45 +00:00
erik%netscape.com
7181d48f9a checkin for bstell@netscape.com:
bug 54000; r=cls, sr=blizzard
define _XOPEN_SOURCE so older versions of Linux define CODESET


git-svn-id: svn://10.0.0.236/trunk@91363 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:51:36 +00:00
ftang%netscape.com
ba73f80669 remove obsoleted code. fix bug 74727
git-svn-id: svn://10.0.0.236/trunk@91362 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:49:04 +00:00
ftang%netscape.com
9d8ab7d797 remove obsoleted files
git-svn-id: svn://10.0.0.236/trunk@91361 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:42:57 +00:00
ftang%netscape.com
808acb1820 fix bug 74727. remove dead code
git-svn-id: svn://10.0.0.236/trunk@91360 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:36:47 +00:00
ftang%netscape.com
fc082d8752 fix 74727
r=yokoyama@netscape.com
remove dead code


git-svn-id: svn://10.0.0.236/trunk@91359 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:36:30 +00:00
ftang%netscape.com
c1dd21f016 remove dead cpp files
git-svn-id: svn://10.0.0.236/trunk@91358 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:35:25 +00:00
ftang%netscape.com
4070d00536 fix 74730. r=yokoyama@netscape.com
remove dead code
remove dead cpp file from the build


git-svn-id: svn://10.0.0.236/trunk@91357 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:34:45 +00:00
ftang%netscape.com
307f07b3d9 add table generation tool to the build Not part of the build
fix bug 67374


git-svn-id: svn://10.0.0.236/trunk@91356 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:32:54 +00:00
cmanske%netscape.com
d55dcb6cf6 checkin for neil@parkwaycc.co.uk: Use proper toolbar separator in Composer. b=73775, r=cmanske, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91355 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:28:45 +00:00
ddrinan%netscape.com
04444a91b6 Fixed preftype error for default_personal_cert. r=javi
git-svn-id: svn://10.0.0.236/trunk@91354 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:23:27 +00:00
Xiaobin.Lu%eng.Sun.com
acc0c9d7f5 Bug 68933 r=Ed Burns sr=Mike Shaver
Get rid of the duplication function of JavaEnabled & IsJavaEnabled


git-svn-id: svn://10.0.0.236/trunk@91353 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:16:52 +00:00
cmanske%netscape.com
b36907b631 Part of fix number validation bug 73049, r=brade, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91352 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:15:10 +00:00
Xiaobin.Lu%eng.Sun.com
600c054cdb Bug 68933 r=Ed Burns and Mike Shaver sr=Mike Shaver
Function name changed due to idl convention


git-svn-id: svn://10.0.0.236/trunk@91351 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:14:43 +00:00
Xiaobin.Lu%eng.Sun.com
6096346361 Bug 68933 r=sr=Mike Shaver
Add declaration of GetPluginHost


git-svn-id: svn://10.0.0.236/trunk@91350 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:13:04 +00:00
Xiaobin.Lu%eng.Sun.com
6065a9bc2a Bug 68933 r=sr=Mike Shaver
Add GetPluginHost method in order to be used by JavaEnabled implementation


git-svn-id: svn://10.0.0.236/trunk@91349 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:12:26 +00:00
Xiaobin.Lu%eng.Sun.com
28a0cbb434 Bug 68933 r=sr=Mike Shaver
Due to nsIJVMManger.idl change, IsJavaEnabled changed to GetJavaEnabled


git-svn-id: svn://10.0.0.236/trunk@91348 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:11:12 +00:00
Xiaobin.Lu%eng.Sun.com
ab5b7af17e Bug 68933 r=sr=Mike Shaver
Reimplemented the JavaEnabled() function done by jst@netscape


git-svn-id: svn://10.0.0.236/trunk@91347 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:09:56 +00:00
Xiaobin.Lu%eng.Sun.com
5bc2dc615f Bug 68933: r=sr=Mike Shaver.
M tasksOverlay.js
navigator.javaEnabled() implementation has been changed by jst@netscape


git-svn-id: svn://10.0.0.236/trunk@91346 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:07:46 +00:00
cmanske%netscape.com
1c88cd85a7 New strings for dialog number validation bug 73049, r=brade, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91345 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:05:50 +00:00
cmanske%netscape.com
62d10f5721 Fixed dialog number validation bug 73049, r=brade, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91344 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 22:05:06 +00:00
morse%netscape.com
abc9cd1707 bug 74489, fix semantics of enumerate, r=valeski, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91343 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:58:50 +00:00
jdunn%netscape.com
282f25dce4 just adding a comment with reference to the bug to let people looking
at this know what the heck is going on


git-svn-id: svn://10.0.0.236/trunk@91342 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:57:14 +00:00
jdunn%netscape.com
ce51cd05bb aix,os/2 & solaris are all having problems with this. It has to do with
struct/union access and nested classes, but it is a big pain.

r= mkaply@us.ibm.com,waterson@netscape.com,scc@mozilla.org
a= scc@mozilla.org
# 74725


git-svn-id: svn://10.0.0.236/trunk@91341 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:54:18 +00:00
cmanske%netscape.com
0ffe25f89e Fixed JS warnings and window title bugs 57649, 73807; r=brade, hurricane; sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91340 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:52:25 +00:00
pinkerton%netscape.com
34f7b25727 remove mdef resource, no longer needed. r=saari/sr=sfraser bug# 61039
git-svn-id: svn://10.0.0.236/trunk@91339 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:45:51 +00:00
pinkerton%netscape.com
0ffe24b221 new borderless wdef to bring in line with win32 windows. clean up mdef code to be in line with wdef code. r=saari/sr=sfraser bug# 61039
git-svn-id: svn://10.0.0.236/trunk@91338 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:45:18 +00:00
pinkerton%netscape.com
6362cd404d add borders back to mac popups now that the popups have no border of their own. r=saari/sr=sfraser bug# 61039
git-svn-id: svn://10.0.0.236/trunk@91337 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:44:26 +00:00
pinkerton%netscape.com
87cf0f67a6 new borderless wdef to bring in line with win32 windows. clean up mdef code to be in line with wdef code.
git-svn-id: svn://10.0.0.236/trunk@91336 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:42:42 +00:00
pinkerton%netscape.com
d3cd048aeb extract some code used for our fake MDEF/WDEF. r=saari/sr=sfraser. bug 61039.
git-svn-id: svn://10.0.0.236/trunk@91335 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:42:16 +00:00
dbragg%netscape.com
873f8b6c8d Fix for 29415. Now returning READ_ONLY error if file attribute set that way. r=dveditz, sr=mscott
git-svn-id: svn://10.0.0.236/trunk@91334 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:40:59 +00:00
leaf%mozilla.org
20d69db19e Automated update
git-svn-id: svn://10.0.0.236/trunk@91332 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:30:03 +00:00
cls%seawood.org
c2ee9a00e1 Use TRY_LINK instead of TRY_COMPILE when testing for gnu_get_libc_version().
Thanks to Kurt <lidl@pix.net> for the patch.
Bug #74758 Fixing ports tinderbox bustage


git-svn-id: svn://10.0.0.236/trunk@91331 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:29:20 +00:00
mcgreer%netscape.com
24504c30f6 fix bug #74764
r=javi


git-svn-id: svn://10.0.0.236/trunk@91329 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:06:22 +00:00
cls%seawood.org
6bd6c87cd3 Fix jsmath.o related dependencies.
Bug #74707 a=jj@netscape.com


git-svn-id: svn://10.0.0.236/trunk@91327 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 21:00:11 +00:00
beard%netscape.com
40e3d35ea3 Configuration for Mac OS X final (Darwin 1.3)
git-svn-id: svn://10.0.0.236/trunk@91324 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 19:48:12 +00:00
pchen%netscape.com
2ff09311e0 blocker bug 74728, r=pinkerton, Check for null mTokenAllocator before trying to free a token, for some reason unbeknowst to me, view source likes to create nsCParserNodes with a null allocator. Why this didn't bite us in the ass before is also beyond me.
git-svn-id: svn://10.0.0.236/trunk@91321 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 18:38:28 +00:00
shaver%mozilla.org
c2d245c145 explicitly include nsString.h
git-svn-id: svn://10.0.0.236/trunk@91311 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 16:41:14 +00:00
dcone%netscape.com
5064aea52b Added silent parameter. r=mclusky sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91305 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 14:55:26 +00:00
jdunn%netscape.com
3c7ded623c fixing ports bustage
# 74725


git-svn-id: svn://10.0.0.236/trunk@91304 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 14:43:39 +00:00
ftang%netscape.com
52903545bc not part of the build yet.
fix bug 65773
r=nobodyyet sr=nobodyyet


git-svn-id: svn://10.0.0.236/trunk@91303 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 14:36:53 +00:00
kestes%tradinglinx.com
acfc204cad relax the uid/gid security checks for Debian
git-svn-id: svn://10.0.0.236/trunk@91302 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 14:23:36 +00:00
mkaply%us.ibm.com
3ce0b10d25 Nope, didn't work
git-svn-id: svn://10.0.0.236/trunk@91301 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 13:44:01 +00:00
mkaply%us.ibm.com
2d69301e88 Attempt to fix ports bustage
git-svn-id: svn://10.0.0.236/trunk@91300 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 13:08:27 +00:00
cls%seawood.org
93acdb6341 Some compilers/platforms (Irix) only have <new.h> not <new>. Fixing cement tinderbox bustage
git-svn-id: svn://10.0.0.236/trunk@91297 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 11:16:58 +00:00
leaf%mozilla.org
5e76dbfe8b Automated update
git-svn-id: svn://10.0.0.236/trunk@91296 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 11:15:02 +00:00
cls%seawood.org
6d44f62c63 Expand the function check for gnu_get_libc_version() into a full compile check as BeOS has the function in libroot.so but it is not declared in any headers.
git-svn-id: svn://10.0.0.236/trunk@91295 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 11:02:06 +00:00
hwaara%chello.se
6b919bf372 Don't include the same header twice! No bug, sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@91294 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 10:39:21 +00:00
sspitzer%netscape.com
794070fa81 ignore generate makefiles
git-svn-id: svn://10.0.0.236/trunk@91292 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 10:03:09 +00:00
waterson%netscape.com
5a0c204b43 Another wild stab at fixing ports bustage.
git-svn-id: svn://10.0.0.236/trunk@91281 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 09:09:58 +00:00
waterson%netscape.com
88dd85fcc6 Wild stab at fixing ports bustage.
git-svn-id: svn://10.0.0.236/trunk@91280 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 09:05:06 +00:00
waterson%netscape.com
38e5ada380 Fix more gcc-2.7.2.3 bustage. Whee\!
git-svn-id: svn://10.0.0.236/trunk@91279 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 08:26:32 +00:00
mkaply%us.ibm.com
23a9b5d209 OS/2 TB breakage
git-svn-id: svn://10.0.0.236/trunk@91278 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 08:25:32 +00:00
pavlov%netscape.com
fd002cfbf7 fixing images not drawing correctly. bug 73195. patch from kmcclusk@netscape.com. r=pavlov sr=jst
git-svn-id: svn://10.0.0.236/trunk@91276 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 08:23:14 +00:00
pavlov%netscape.com
82068782e0 fixing bug 74652 r=shaver sr=waterson
git-svn-id: svn://10.0.0.236/trunk@91274 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 08:04:54 +00:00
waterson%netscape.com
6ebd59f729 Fix gcc-2.7.2.3 bustage.
git-svn-id: svn://10.0.0.236/trunk@91273 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:54:23 +00:00
brendan%mozilla.org
e21e734c03 Quote reserved identifiers as well as non-lexical-identifier property ids in object literals (73598, r=jband, sr=shaver).
git-svn-id: svn://10.0.0.236/trunk@91271 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:45:22 +00:00
bryner%uiuc.edu
6dbd115c0e Fixing client auth. r=darin, sr=ben. Not part of the build.
git-svn-id: svn://10.0.0.236/trunk@91270 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:36:39 +00:00
darin%netscape.com
30bbfdcd43 Fixes bug 74118 "can't launch with a new profile" r=bryner, sr=mscott
git-svn-id: svn://10.0.0.236/trunk@91268 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:28:51 +00:00
darin%netscape.com
93a44d86ec Fixes bug 74199 "about:cache-entry needs to know how to deal with
non-stream-based cache entries" r=gordon, sr=mscott


git-svn-id: svn://10.0.0.236/trunk@91267 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:25:58 +00:00
ben%netscape.com
19e5473291 Partial fix for 73905, JS files not loaded with nsIChannel::LOAD_NORMAL.
r=darin, sr=hyatt


git-svn-id: svn://10.0.0.236/trunk@91266 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:21:36 +00:00
darin%netscape.com
72047ef03e Fixes bug 73905 "CSS/JS documents are not cached" r=pierre, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@91265 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:20:46 +00:00
hyatt%netscape.com
1f47c8bc4a Missed the XML bit of my mutation patch.
git-svn-id: svn://10.0.0.236/trunk@91264 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:07:33 +00:00
hyatt%netscape.com
0ed9d49f33 Missed a bit of my mutation patch.
git-svn-id: svn://10.0.0.236/trunk@91263 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:07:20 +00:00
idk%eng.sun.com
0af6d623df *not part of the build*
fix for 74676


git-svn-id: svn://10.0.0.236/trunk@91262 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 07:01:42 +00:00
shaver%mozilla.org
9c980e4543 sigh, fix direct-inclusion-of-jsgc.h bustage in TestXPC
git-svn-id: svn://10.0.0.236/trunk@91257 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:53:58 +00:00
sspitzer%netscape.com
f59c05572a partial fix for #74674. bullet proof the db view. r/sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91255 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:16:29 +00:00
stephend%netscape.com
23fc7135c8 Fixing typo in the patch for bug 52154 'Make gui for view source coloring pref' patch this time by bzbarsky@mit.edu (this patch was previously reviewed by akkana and super-reviewed by Joe Hewitt)
git-svn-id: svn://10.0.0.236/trunk@91254 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:12:08 +00:00
shaver%mozilla.org
4aa2ca3096 fixing bustage from fat-fingering before committing
git-svn-id: svn://10.0.0.236/trunk@91253 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:06:59 +00:00
hyatt%netscape.com
f7d1932732 Missed a piece of the mutation patch.
git-svn-id: svn://10.0.0.236/trunk@91252 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:06:18 +00:00
waterson%netscape.com
1ef6e620b4 Bug 68213. Require users of nsFixedSizeAllocator to specify object size at Free() time to avoid 8 byte overhead per allocation. r=harishd, brendan, shaver, hyatt; sr=scc
git-svn-id: svn://10.0.0.236/trunk@91251 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 05:00:08 +00:00
sspitzer%netscape.com
049707d100 fix for #67677. on loading a folder, if there is no new messages
scroll to the top.  r=mscott, sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91250 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:43:15 +00:00
roc+%cs.cmu.edu
2647a38223 Fix calculation of widget coverings in nsViewManager::UpdateAllCoveringWidgets. Bug 74413, sr=attinasi,r=kmcclusk
git-svn-id: svn://10.0.0.236/trunk@91249 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:37:12 +00:00
sspitzer%netscape.com
56acdd67fa fix #72262 and #72269. when loading a folder, scroll to the first new message (but don't select it.) when loading a folder while doing cross folder navigation, scroll to and select the proper messsage. r=mscott, sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91248 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:32:10 +00:00
shaver%mozilla.org
04121d876f 73645: use JSDHashTable for JSRuntime.gcRootsHash and .gcLocksHash.
r=waterson-the-dhash-fiend, sr=brendan-the-other-dhash-fiend


git-svn-id: svn://10.0.0.236/trunk@91247 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:30:41 +00:00
hyatt%netscape.com
65a3e065f4 Fix for mutation event crashers.
git-svn-id: svn://10.0.0.236/trunk@91246 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:30:03 +00:00
cmanske%netscape.com
a0403c6188 Fixed Print button bug in plaintext editor (by rcassin@supernova.org) r=cmanske, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91245 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:08:13 +00:00
cmanske%netscape.com
520fe7bdf2 Fixed Spell check dialog layout bug 72223, r=andreww, sr=hewitt
git-svn-id: svn://10.0.0.236/trunk@91244 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:05:14 +00:00
shaver%mozilla.org
4bd0482736 74637: track scc's string changes, to fix infinite recursion when manipulating
a wrapped JSString. r=smfr, sr=scc.


git-svn-id: svn://10.0.0.236/trunk@91243 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 04:02:21 +00:00
cmanske%netscape.com
25db66b850 Editor CSS changes needed for Spelling dialog, b=72223, r=andreww, sr=hewitt
git-svn-id: svn://10.0.0.236/trunk@91242 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:59:27 +00:00
pchen%netscape.com
7f079b897f bug 73262, r=pinkerton, sr=sfraser/jst, add ptr for xul document
git-svn-id: svn://10.0.0.236/trunk@91241 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:41:34 +00:00
pchen%netscape.com
0b287ca0c8 bug 73262, r=pinkerton, sr=sfraser/jst, set weak ref to xul document after adding nsMenuBar as observer, then use that weak ref in destructor to remove ourself as observer, problem is that webshell is getting destroyed before nsMenuBar, so nsMenuBar can't get at the xul document, thus it can't remove itself as an observer.
git-svn-id: svn://10.0.0.236/trunk@91240 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:41:30 +00:00
talisman%anamorphic.com
2f29d6753a Added a new note for Mac users re Project Builder. jrg
git-svn-id: svn://10.0.0.236/trunk@91239 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:38:31 +00:00
nhotta%netscape.com
27858ace60 Changed to use strncmp instead of strcmp for Content-Type value comparison, bug 74573, r=ftang, sr=erik.
git-svn-id: svn://10.0.0.236/trunk@91238 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:34:57 +00:00
talisman%anamorphic.com
01fba1527a Adding support for Project Builder on Mac OS X. jrg
git-svn-id: svn://10.0.0.236/trunk@91237 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:34:20 +00:00
gordon%netscape.com
1e0c0b4023 Landing DISKCACHE1_BRANCH (part Deux) which enables dynamic eviction and efficient cache miss detection for the disk cache (bug 72506) r=beard, sr=darin.
git-svn-id: svn://10.0.0.236/trunk@91234 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:30:45 +00:00
stephend%netscape.com
b93908a789 Fixes bug 52154, 'Make gui for view source coloring pref' r=akkana@netscape.com sr=hewitt@netscape.com
git-svn-id: svn://10.0.0.236/trunk@91233 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:19:17 +00:00
stephend%netscape.com
befa5a072c Part of the fix for bug 52154, 'Make gui for view source coloring pref' r=akkana@netscape.com sr=hewitt@netscape.com
git-svn-id: svn://10.0.0.236/trunk@91232 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:18:34 +00:00
stephend%netscape.com
96f508e78d Fix for bug 66011, mailto: headers erroneously inserted into to: field. Patch by Kevin Duffy <kevin@buhbird.com> r=ducarroz@netscape.com sr=sspitzer@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@91231 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 03:03:47 +00:00
talisman%anamorphic.com
774201eaba new, better-looking, more professional splash screen image. jrg
git-svn-id: svn://10.0.0.236/trunk@91230 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:58:22 +00:00
talisman%anamorphic.com
b8efdaaa9e Modified means of getting the splash screen image so it works when app is run as a jar. jrg
git-svn-id: svn://10.0.0.236/trunk@91229 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:57:04 +00:00
talisman%anamorphic.com
8e4587c509 Changed event switch - must access static public (i.e., class) variables through class, not through instance. jrg
git-svn-id: svn://10.0.0.236/trunk@91228 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:55:54 +00:00
morse%netscape.com
18ceb1bc1c bugs 74049 (cookies permission file garbled) and 74489 (crash bringing up cookie viewer), r=valeski, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91227 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:39:39 +00:00
morse%netscape.com
6dd905a714 bug 74089, image/cookie confusion, r=valeski, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91226 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:34:26 +00:00
sspitzer%netscape.com
1b2060a435 fix for #74357. do what 4.x mac did for collapsed read messages, that are threads that had unread chidren. r/sr=hyatt,bienvenu
git-svn-id: svn://10.0.0.236/trunk@91225 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:13:41 +00:00
disttsc%bart.nl
19d56a352c Fix senna bustage, add "timer" to REQUIRES line
git-svn-id: svn://10.0.0.236/trunk@91224 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 02:09:28 +00:00
oeschger%netscape.com
8f8d6be1c2 fixing css, adding manifest, NOT PART OF BUILD
git-svn-id: svn://10.0.0.236/trunk@91223 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 01:52:16 +00:00
pinkerton%netscape.com
e019408e1d fix build bustage.
git-svn-id: svn://10.0.0.236/trunk@91222 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 01:38:57 +00:00
hyatt%netscape.com
4bab10dbe3 Fix for outliner skin switching bug.
git-svn-id: svn://10.0.0.236/trunk@91221 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 01:37:09 +00:00
pinkerton%netscape.com
1312d6685c fix build bustage.
git-svn-id: svn://10.0.0.236/trunk@91219 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:57:40 +00:00
sonmi%netscape.com
2991dfa79f removed unneccessary variables
git-svn-id: svn://10.0.0.236/trunk@91213 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:31:59 +00:00
sonmi%netscape.com
cfcafc823a workaround, when running backward compatibility tests pk12util tests don't run
git-svn-id: svn://10.0.0.236/trunk@91212 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:29:27 +00:00
sonmi%netscape.com
5a748ff2d9 added functionallity for backward compatibility testing, improved messages
git-svn-id: svn://10.0.0.236/trunk@91211 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:28:12 +00:00
sonmi%netscape.com
33777883af added backward compatibility tests
git-svn-id: svn://10.0.0.236/trunk@91209 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:23:18 +00:00
sonmi%netscape.com
e0aaa40617 added functionallity for backward compatibility testing
git-svn-id: svn://10.0.0.236/trunk@91208 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:22:43 +00:00
javi%netscape.com
57314ffb6d Fix for Bug 74436 patch provided by ccarlen r=danm
Make PSM 2.0 use the embedding friendly window watcher
  service instead of grabbing the hidden window.


git-svn-id: svn://10.0.0.236/trunk@91203 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:06:18 +00:00
javi%netscape.com
43e6f04f96 Fix UNIX build bustage
git-svn-id: svn://10.0.0.236/trunk@91202 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-04 00:03:02 +00:00
valeski%netscape.com
1174356dfa sr=waterson. comment change only
git-svn-id: svn://10.0.0.236/trunk@91200 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 23:30:30 +00:00
dr%netscape.com
dc91b51ac9 backing out edburns's removal of necessary typedefs
git-svn-id: svn://10.0.0.236/trunk@91199 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 23:29:26 +00:00
larryh%netscape.com
77a7c53dde bugzilla: 45343. re-implement PL_ArenaAllocate()
git-svn-id: svn://10.0.0.236/trunk@91196 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 23:23:02 +00:00
valeski%netscape.com
12dee4cf09 sr=shaver, r=dmose. 74554. fixing array index typo
git-svn-id: svn://10.0.0.236/trunk@91194 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:59:02 +00:00
rickg%netscape.com
75bb2ffbb9 preloader update. r=peterl, sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91193 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:58:59 +00:00
av%netscape.com
1adad24225 For 73856, adding simple scriptability to the old style plugins, sr=vidur, ra=av
git-svn-id: svn://10.0.0.236/trunk@91192 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:49:38 +00:00
mcafee%netscape.com
f1b3bb4da2 print out system id
git-svn-id: svn://10.0.0.236/trunk@91191 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:47:50 +00:00
sspitzer%netscape.com
8a191a3338 make --with-extensions=inspector generate the Makefiles
for hewitt's document inspector.  r=prass,kerz sr=sspitzer


git-svn-id: svn://10.0.0.236/trunk@91190 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:41:24 +00:00
av%netscape.com
41610106ab For 73856, zeroing plugin function table in ns4xPlugin destructor, sr=vidur, ra=av
git-svn-id: svn://10.0.0.236/trunk@91189 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:39:19 +00:00
locka%iol.ie
f035c4a3bb NOT PART OF BUILD. Added test for innerHTML property of HTML elements.
git-svn-id: svn://10.0.0.236/trunk@91188 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:37:47 +00:00
av%netscape.com
c84a6b1b9c For 73856, adding plugin host notification that the plugin instance is scriptable, sr=vidur, ra=jst
git-svn-id: svn://10.0.0.236/trunk@91187 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:33:32 +00:00
peterlubczynski%netscape.com
a2ae9333a1 Implement full-page plugins on Mac bug 35682 a=av sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91186 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:18:59 +00:00
heikki%netscape.com
120df2142a This commit was generated by cvs2svn to compensate for changes in r91184,
which included commits to RCS files with non-trunk default branches.

git-svn-id: svn://10.0.0.236/trunk@91185 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:13:38 +00:00
edburns%acm.org
3f17be6c32 ra=edburns
r=av
sr=waterson
author = Nikolay Igotti <inn@sparc.spb.su>
Changes are:
  - adding IID accessors to nsIJVMPlugin and nsIJVMConsole interface - I think
    better patch would  add accessors to the end of interface definition -
    to save binary compatibility with Java Plugin
 -  together with old way of obtaining of JVM service (GetFactory) use new way
    GetService - it's good anyway and shouldn't break Java Plugin

M modules/oji/public/nsIJVMPlugin.h
M modules/oji/public/nsIJVMConsole.h
M sun-java/stubs/include/jri_md.h
M modules/oji/src/nsJVMManager.cpp


git-svn-id: svn://10.0.0.236/trunk@91183 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:05:03 +00:00
locka%iol.ie
f109555953 Added read-only implementations of innerHTML, innerText, offsetLeft, offsetTop, offsetWidth, offsetHeight. b=58475
git-svn-id: svn://10.0.0.236/trunk@91182 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 22:00:21 +00:00
edburns%acm.org
4e72c06770 http://bugzilla.mozilla.org/show_bug.cgi?id=69466
r=av
sr=waterson
Make it so incomplete hostnames, such as .eng.sun.com, are valid entries for
the noProxyFor list.


git-svn-id: svn://10.0.0.236/trunk@91180 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:56:59 +00:00
locka%iol.ie
cc8edeccc2 Updated GetTarget so windows are created if the named target cannot be found and for _new & _blank targets. b=72491, sr=mscott
git-svn-id: svn://10.0.0.236/trunk@91179 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:56:02 +00:00
av%netscape.com
f05d8ec049 For 73856, adding new header file to the list of files to be exported, sr=vidur, ra=av
git-svn-id: svn://10.0.0.236/trunk@91178 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:41:19 +00:00
av%netscape.com
09c8488159 For 73856, new private interface for the plugin host, first time in, sr=vidur, ra=av
git-svn-id: svn://10.0.0.236/trunk@91177 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:35:57 +00:00
radha%netscape.com
71cd80f593 Fix for bug 73746. r=valeski, sr=rpotts
git-svn-id: svn://10.0.0.236/trunk@91176 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:34:30 +00:00
av%netscape.com
2d89d9e3a4 For 73856, adding new values to nsPluginInstanceVariable enum type, sr=vidur, ra=av
git-svn-id: svn://10.0.0.236/trunk@91175 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:33:17 +00:00
naving%netscape.com
f8854e2942 74446. sr=bienvenu. handle the period at the beginning of the line.
git-svn-id: svn://10.0.0.236/trunk@91174 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:32:59 +00:00
peterlubczynski%netscape.com
841e90d34d Fix for sending events to plugins on Windows through the DOM bug 60712 r=saari sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91173 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:32:37 +00:00
av%netscape.com
a82e86719b For 73856 -- adding new values to NPPVariable enumeration type, sr=vidur, ar=av
git-svn-id: svn://10.0.0.236/trunk@91172 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:29:48 +00:00
pinkerton%netscape.com
014590aa82 before executing command, check if it's a menu. fixes weird problems with context menus where rightclicking with a submenu visible would dismiss the parent but leave the submenu. r=pchen/sr=hyatt. bug# 71795
git-svn-id: svn://10.0.0.236/trunk@91171 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:20:43 +00:00
ducarroz%netscape.com
1228e9d631 Fix for bug 70222. Use IC to decide if we need to send the file as AppleDouble. R=varada, SR=bienvenu.
git-svn-id: svn://10.0.0.236/trunk@91170 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:11:24 +00:00
ducarroz%netscape.com
402091e0a2 Fix for bug 70222. Add an API to retreive file mapping flags. R=varada, SR=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91169 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:08:51 +00:00
ducarroz%netscape.com
634e01d85f Fix for bug 67504. Remove hardcoded string. R=varada, SR=bienvenu
Fix for bug 41150. Do not reveal BCC recipients when forwarding a message. R=varada, SR=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91168 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:05:07 +00:00
ducarroz%netscape.com
382c9a9837 Fix for bug 67504. Remove hardcoded string. R=varada, SR=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91167 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 21:03:30 +00:00
idk%eng.sun.com
0d7a733787 *not part of the build*
add on to my previous checkin


git-svn-id: svn://10.0.0.236/trunk@91166 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:59:04 +00:00
dave%intrec.com
b6faef51e6 Fix for bug 74529: backward email filtering fixed. patch by jake@acutex.net
git-svn-id: svn://10.0.0.236/trunk@91165 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:54:53 +00:00
disttsc%bart.nl
85513f5d0d Get postData from session history instead of BrowserInstance. bug=46200, r=law, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@91164 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:53:50 +00:00
dr%netscape.com
5869bd3fea fix for 74065. r=pinkerton, sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@91163 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:45:13 +00:00
dave%intrec.com
f5dae4e3f3 Fix for bug 53696: periods(.) and plusses(+) were not being accepted as valid in mime-types, which are legal per RFC2045 and RFC2048.
git-svn-id: svn://10.0.0.236/trunk@91162 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:42:58 +00:00
dr%netscape.com
b8f39c94f6 fix for 72010 (contrib by alex.fritze@crocodile-clips.com). r=dr, sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@91161 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:42:41 +00:00
dr%netscape.com
fe4a8c286c fix for 40105. r=jst, sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@91160 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:39:34 +00:00
beard%netscape.com
e10e494f55 fix for bug #6872, checking in for tnoyes@mac.com, r=beard, sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91159 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:23:36 +00:00
bnesse%netscape.com
7ecfbaef13 Updates to the future preferences API based on the latest round of feedback.
[Not Part of the Build]


git-svn-id: svn://10.0.0.236/trunk@91157 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 20:11:54 +00:00
rickg%netscape.com
da16bfd694 Adding hook for preloader; r=peterl, sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91156 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:40:58 +00:00
ftang%netscape.com
2dea739cf9 remove dead code prepare for bidi landing
The code removed are #ifdef and turn off right now.
r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@91155 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:34:56 +00:00
ftang%netscape.com
2d33682705 fix 71762.r=bstell sr=erik. add non standard jis0208 mapping
git-svn-id: svn://10.0.0.236/trunk@91154 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:30:33 +00:00
varada%netscape.com
a718e19985 fix for bug#71907 -cant send message;r=ducarroz;sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91153 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:27:11 +00:00
joe.chou%eng.sun.com
7ed08b37f7 After converting nsIPluginManager.h to nsIPluginManager.idl (64297, already checked in), the original nsIPluginManager.h is no longer neede.
git-svn-id: svn://10.0.0.236/trunk@91151 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:09:39 +00:00
joe.chou%eng.sun.com
efdfd5c59e After converting nsIJVMPluginInstance.h to nsIJVMPluginInstance.idl (64296, already checked in), theoriginal nsIJVMPluginInstance.h is no longer needed.
git-svn-id: svn://10.0.0.236/trunk@91150 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 19:04:22 +00:00
disttsc%bart.nl
93523cb0ed Fix for bug 74488 (and hopefully bug 74552): app freezes in mail when psm dialog is brought up (/ a link is clicked), r=scc, sr=darin
git-svn-id: svn://10.0.0.236/trunk@91149 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 17:17:20 +00:00
dcone%netscape.com
6acdc377a9 back out change..
git-svn-id: svn://10.0.0.236/trunk@91146 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 15:29:33 +00:00
kestes%tradinglinx.com
d55d96f6c8 relax the uid/gid security checks for redhat 7.0
git-svn-id: svn://10.0.0.236/trunk@91145 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 15:14:27 +00:00
dcone%netscape.com
1573da7109 added a silent member. sr=attinasi r=kmmclusk.
git-svn-id: svn://10.0.0.236/trunk@91144 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 14:38:42 +00:00
ccarlen%netscape.com
d735ced6e8 Sample code - not part of the process. Bug 74120 - remove refs to old cache. r=valeski.
git-svn-id: svn://10.0.0.236/trunk@91143 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 14:32:01 +00:00
peterv%netscape.com
af566ed325 Removing use of HashTable (bug #69091). Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91142 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 14:31:33 +00:00
ccarlen%netscape.com
d34d0b9bea Sample code - not part of the process. Bug 71387 - remove unneeded code to determine locale of profile defaults. r=tao
git-svn-id: svn://10.0.0.236/trunk@91141 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 14:29:01 +00:00
rods%netscape.com
de53e898e2 removing special centering code for width
Bug 68573 r=kmcclusk sr=attinasi


git-svn-id: svn://10.0.0.236/trunk@91140 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 14:10:47 +00:00
dbaron%fas.harvard.edu
282c63502d Fix Boehm GC + MOZ_TRACK_MODULE_DEPS build. r=disttsc@bart.nl sr=cls@seawood.org
git-svn-id: svn://10.0.0.236/trunk@91139 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 13:29:13 +00:00
miodrag%netscape.com
ef15674f7e Allow explicit SSLSocketFactory, contribution by Kyle F. Downey, kdowney@amberarcher.com
git-svn-id: svn://10.0.0.236/trunk@91138 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 13:17:22 +00:00
miodrag%netscape.com
70e4886ec2 A minor update
git-svn-id: svn://10.0.0.236/trunk@91137 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 13:13:52 +00:00
miodrag%netscape.com
ac66a4b576 74378 fix in flushEntries(), contribution by Glenn McAllister, glenn@somanetworks.com
git-svn-id: svn://10.0.0.236/trunk@91136 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 13:12:03 +00:00
peterv%netscape.com
4b69a94419 Removing unused files. Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91135 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 13:00:38 +00:00
peterv%netscape.com
af590839d9 Making this file compile on Mac. Not part of default build.
git-svn-id: svn://10.0.0.236/trunk@91133 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:38:50 +00:00
peterv%netscape.com
ae721659d9 Fix some of bug #59853 (new operator should be used with more care). Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91132 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:38:01 +00:00
peterv%netscape.com
f51cda11e6 Fix some leaks (bug #72179). Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91131 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:36:07 +00:00
peterv%netscape.com
0264c08211 Allow use of Transformiix in embedding (bug #72143). Not part of default build. r=heikki.
git-svn-id: svn://10.0.0.236/trunk@91130 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:33:03 +00:00
peterv%netscape.com
0eb10aa694 Removing use of HashTable (bug #69091). Removing CommandLineUtils from module build. Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91129 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:30:50 +00:00
peterv%netscape.com
0f3fae5540 Small clean-up. Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91128 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:25:03 +00:00
peterv%netscape.com
e85c1a22ba Redesign wrappers a bit (bug #65237). Comment out nslogging stuff for now. Use mozilla's new GetBaseURI. Not part of default build. r=Pike.
git-svn-id: svn://10.0.0.236/trunk@91127 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:23:03 +00:00
peterv%netscape.com
5c753a496b Adding two files (nsUnicodeToTeXCMMIttf.cpp and nsUnicodeToTeXCMSYttf.cpp) to keep MathML building on Mac. Not part of default build.
git-svn-id: svn://10.0.0.236/trunk@91126 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 12:06:13 +00:00
idk%eng.sun.com
64984abc73 * not part of the build*
Fixed 71951, 74511, 74525


git-svn-id: svn://10.0.0.236/trunk@91125 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 11:57:15 +00:00
markh%activestate.com
a8c7226929 Pass the class itself to the registrar function.
Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@91124 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 11:17:35 +00:00
markh%activestate.com
25cd24f421 Free a leaking IID.
Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@91122 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 10:43:27 +00:00
markh%activestate.com
9a40c7d956 Final set of changes to bring us into like with the new file IO world.
Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@91121 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 10:41:38 +00:00
markh%activestate.com
151f1e3fd3 Allow services to use interface names as a string, just like regular components.
Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@91120 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 10:41:09 +00:00
ssu%netscape.com
0453f1c09f fixing:
bug 68053 - Win32 installer needs to log the installation process.
bug 64433 - setup.exe inside mozilla-win32-installer.exe contains "Netscape" text
bug 72254 - Installer should not place Uninstaller shortcut in Start Menu
bug 72422 - Moz Installer needs to update internal ua to 0.9
bug 74173 - Win32 installer needs to offer ability to disable path change
bug 64179 - "K" should be "KB"
bug 71108 - Installer FTP stage is slow on Win32
bug 71113 - Log files should not prevent installation
http://bugscape/show_bug.cgi?id=4196 - Launching Setup via a CD autorun causes dll error

r=dveditz
sr=mscott


git-svn-id: svn://10.0.0.236/trunk@91118 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 09:44:22 +00:00
dveditz%netscape.com
a4ac8f7d68 one more try, force depend to be clobber in this directory
git-svn-id: svn://10.0.0.236/trunk@91117 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 08:59:34 +00:00
timeless%mac.com
7cf6907320 temp patch to fix build bustage r=bstell
CODEPAGE is not defined (perhaps we don't have glibc2.1 on some tinders?)
so i'm disabling the code that would try to use it.


git-svn-id: svn://10.0.0.236/trunk@91115 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 08:45:05 +00:00
dveditz%netscape.com
5d7092e5e8 fixing win32 clobber bustage too
git-svn-id: svn://10.0.0.236/trunk@91114 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 08:15:18 +00:00
dveditz%netscape.com
6b534e9e27 fixing win32 depend bustage -- hack alert
git-svn-id: svn://10.0.0.236/trunk@91113 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 08:12:02 +00:00
disttsc%bart.nl
0e603efaad Fix MOZ_TRACK_MODULE_DEPS bustage (senna)
git-svn-id: svn://10.0.0.236/trunk@91112 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 07:49:49 +00:00
disttsc%bart.nl
ca5ce7c32a Fix speedracer bustage. r=dveditz
git-svn-id: svn://10.0.0.236/trunk@91111 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 07:47:54 +00:00
sdagley%netscape.com
93c22f57fa Fix linkage probs preventing lib loading under Carbon. No bug #. r/a/doh!=saari
git-svn-id: svn://10.0.0.236/trunk@91110 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 07:19:51 +00:00
jst%netscape.com
2fb55fe1f8 Fixing crasher/regression bug 74431 that I caused a few weeks ago.
git-svn-id: svn://10.0.0.236/trunk@91109 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 07:14:12 +00:00
mscott%netscape.com
eb8f9e5308 (NOT PART OF THE BUILD)
get icon support working on win2k by supporting 16 bit per pixel RGB data from the OS.
Turn this 5:5:5 data into 24 bit per pixel data.

still doesn't look quite right color wise (the blues are off) but it's closer.


git-svn-id: svn://10.0.0.236/trunk@91108 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 07:09:20 +00:00
dveditz%netscape.com
efbf1b32a6 Fix 72551 speed up zip archive opening. r=ssu,sr=waterson
git-svn-id: svn://10.0.0.236/trunk@91107 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:35:13 +00:00
erik%netscape.com
d37fea69b3 checkin for bstell@netscape.com:
bug 55021; r=ftang@netscape.com, sr=erik@netscape.com
sample postscript font names file


git-svn-id: svn://10.0.0.236/trunk@91106 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:30:17 +00:00
erik%netscape.com
619faf0ee9 checkin for bstell@netscape.com:
bug 55021; r=ftang@netscape.com, sr=erik@netscape.com
remove default japanese postscript font names
these have been moved into nsPostScriptObj.cpp so user can override them


git-svn-id: svn://10.0.0.236/trunk@91105 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:27:40 +00:00
leaf%mozilla.org
a124ec6d2c Automated update
git-svn-id: svn://10.0.0.236/trunk@91104 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:15:02 +00:00
sspitzer%netscape.com
ea80fb54c5 #72282 fix the "watched threads" crasher, again
#62455 make sure double clicking on a cell in a column that is a cycler doesn't open the message in a new window

#72665, #73888
treat the thread unread and thread total columns like all the other columns.
allow the user to persist their hidden attribuyte.
don't hide / show them when switching between threaded and nonthreaded views.
All that's left is to hide those columns by default.

#72252 fix sort indicator problems

#72250 sorts should default to ascending

sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91103 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:13:38 +00:00
erik%netscape.com
bae21fa3f9 checkin for bstell@netscape.com:
bug 55021; r=ftang@netscape.com, sr=erik@netscape.com
read postscript printer vendor supplied font names file
export a sample postscript font names file


git-svn-id: svn://10.0.0.236/trunk@91102 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:09:02 +00:00
erik%netscape.com
0aacd6d07e checkin for bstell@netscape.com:
bug 55021; r=ftang@netscape.com, sr=erik@netscape.com
read postscript printer vendor supplied font names file


git-svn-id: svn://10.0.0.236/trunk@91101 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:08:27 +00:00
erik%netscape.com
2bd2fa11f2 checkin for bstell@netscape.com:
bug 55021; r=ftang@netscape.com, sr=erik@netscape.com
read postscript printer vendor supplied font names file
function declarations for code to read postscript printer
  vendor supplied font names file


git-svn-id: svn://10.0.0.236/trunk@91100 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:07:57 +00:00
erik%netscape.com
8312e3d856 checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add comment noting where to add line to include a charset remapping file


git-svn-id: svn://10.0.0.236/trunk@91099 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:06:59 +00:00
sspitzer%netscape.com
750b4b411a remove usused files.
git-svn-id: svn://10.0.0.236/trunk@91098 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:06:58 +00:00
erik%netscape.com
a52289a76d checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
this is a sample nl_langinfo(CODESET) to gecko charset remapping file


git-svn-id: svn://10.0.0.236/trunk@91097 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:06:24 +00:00
erik%netscape.com
ced7b9640b checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add comment saying this file is deprecated


git-svn-id: svn://10.0.0.236/trunk@91096 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:05:47 +00:00
sspitzer%netscape.com
2a0503de9a #74454, allow the user to edit the value "limit message size" text area
when it is enabled.  sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91095 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:05:31 +00:00
erik%netscape.com
54f87fda1b checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
get charset using ns_langinfo(CODESET)
(instead of mapping setlocale(LC_LCTYPE, nsnull);)


git-svn-id: svn://10.0.0.236/trunk@91094 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:05:05 +00:00
sspitzer%netscape.com
72ea6ce645 #74473
fix js exception when clicking on the column picker.
sr=ben.


git-svn-id: svn://10.0.0.236/trunk@91093 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:04:03 +00:00
erik%netscape.com
44b64e90c0 checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add NS_ERROR_USING_FALLBACK_LOCALE


git-svn-id: svn://10.0.0.236/trunk@91092 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:03:59 +00:00
erik%netscape.com
88eb8c75f2 eckin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add check for nl_langinfo and libc-version.h


git-svn-id: svn://10.0.0.236/trunk@91091 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:01:49 +00:00
erik%netscape.com
d674d7cdbf checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add OS_ARCH compile define


git-svn-id: svn://10.0.0.236/trunk@91090 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:01:07 +00:00
erik%netscape.com
87c1708f1c checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add DidLoad() method to indicate the file was loaded


git-svn-id: svn://10.0.0.236/trunk@91089 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 06:00:01 +00:00
erik%netscape.com
d4c5d165ed checkin for bstell@netscape.com:
bug 54000; r=ftang@netscape.com, sr=erik@netscape.com
(part of nl_langinfo(CODESET);)
add DidLoad() method to indicate the properties file was loaded


git-svn-id: svn://10.0.0.236/trunk@91088 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 05:59:44 +00:00
nicolson%netscape.com
c605e08e1c just hacking.
git-svn-id: svn://10.0.0.236/trunk@91087 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 04:08:20 +00:00
scc%mozilla.org
c88fb14442 fix speedracer bustage
git-svn-id: svn://10.0.0.236/trunk@91086 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 04:07:25 +00:00
scc%mozilla.org
2973f31c8f fix speedracer bustage
git-svn-id: svn://10.0.0.236/trunk@91083 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 03:29:49 +00:00
edburns%acm.org
5467f21d10 We need to have this file to unjar the dom jar into dist/classes.
git-svn-id: svn://10.0.0.236/trunk@91081 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 02:03:07 +00:00
scc%mozilla.org
6c826b6f79 fix speedracer bustage once and for all
git-svn-id: svn://10.0.0.236/trunk@91080 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:47:55 +00:00
edburns%acm.org
3aeae22b4e Use getEventDetail to tell if the mouse button was pressed.
git-svn-id: svn://10.0.0.236/trunk@91079 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:37:28 +00:00
scc%mozilla.org
fb94b0d593 fix speedracer bustage
git-svn-id: svn://10.0.0.236/trunk@91076 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:18:09 +00:00
ddrinan%netscape.com
79b2e3632e Added client auth callback
git-svn-id: svn://10.0.0.236/trunk@91075 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:11:30 +00:00
ddrinan%netscape.com
0365bb8105 Need to include dist/private/security
git-svn-id: svn://10.0.0.236/trunk@91074 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:10:57 +00:00
ddrinan%netscape.com
69982f32f2 Added client auth dialog interface
git-svn-id: svn://10.0.0.236/trunk@91073 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:10:10 +00:00
ddrinan%netscape.com
570f3987dc Client auth xul and js
git-svn-id: svn://10.0.0.236/trunk@91072 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:09:03 +00:00
ddrinan%netscape.com
49af02d7d1 Added client auth resources
git-svn-id: svn://10.0.0.236/trunk@91071 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:07:30 +00:00
ddrinan%netscape.com
d94d631f55 Added support for client auth dialogs
git-svn-id: svn://10.0.0.236/trunk@91070 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 01:06:17 +00:00
scc%mozilla.org
3701ed2f04 fix torino bustage
git-svn-id: svn://10.0.0.236/trunk@91069 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 00:42:48 +00:00
edburns%acm.org
972e690574 When bug 74468 gets fixed, -1 will be returned from getButton().
git-svn-id: svn://10.0.0.236/trunk@91068 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 00:42:47 +00:00
scc%mozilla.org
72ec93e781 fix speedracer bustage
git-svn-id: svn://10.0.0.236/trunk@91067 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-03 00:23:06 +00:00
edburns%acm.org
960a520571 Don't try to free an automatic variable.
git-svn-id: svn://10.0.0.236/trunk@91064 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 23:27:44 +00:00
mkaply%us.ibm.com
b27816d8a8 I give up.
Hack fix to fix OS/2 TB break.
Real fix is in #74224


git-svn-id: svn://10.0.0.236/trunk@91063 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 23:16:19 +00:00
scc%mozilla.org
7415e115f6 fix bustage
git-svn-id: svn://10.0.0.236/trunk@91062 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 23:11:04 +00:00
scc%mozilla.org
7cbb7b5ebd attempting to fix AIX, et al, bustage
git-svn-id: svn://10.0.0.236/trunk@91061 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 23:05:55 +00:00
edburns%acm.org
447399fb12 // replace nsString::Recycle with nsMemory::Free
java/dom/jni/org_mozilla_dom_events_MouseEventImpl.cpp
java/dom/jni/org_mozilla_dom_events_UIEventImpl.cpp
java/dom/jni/org_mozilla_dom_events_EventImpl.cpp
java/dom/jni/org_mozilla_dom_ProcessingInstructionImpl.cpp
java/dom/jni/org_mozilla_dom_NodeImpl.cpp
java/dom/jni/org_mozilla_dom_NamedNodeMapImpl.cpp
java/dom/jni/org_mozilla_dom_ElementImpl.cpp
java/dom/jni/org_mozilla_dom_DOMImplementationImpl.cpp
java/dom/jni/org_mozilla_dom_DocumentImpl.cpp
java/dom/jni/org_mozilla_dom_CharacterDataImpl.cpp
java/dom/jni/org_mozilla_dom_AttrImpl.cpp
java/dom/jni/javaDOMEventsGlobals.cpp

// On*DocumentLoad() now takes an nsIRequest instead of an nsIChannel.
// nsIChannel extends nsIRequest.
java/dom/src/nsJavaDOMImpl.cpp
java/dom/src/nsJavaDOMImpl.h
java/dom/src/nsIJavaDOM.h

// nsIChannel instances replaced with nsIRequest. Removed ShowModal(),
// ExitModalLoop(), FindNamedBrowserItem().  Parameter changes for
// {Set,Get}Persistence().  Add DestroyBrowserWindow(), IsWindowModal().
// supports weak references
java/webclient/src_moz/CBrowserContainer.h
java/webclient/src_moz/CBrowserContainer.cpp

// GetProfileList now returns an array of profile names.  Need to use
// nsIProfileInternal instead of nsIProfile for StartupWithArgs.
java/webclient/src_moz/NativeEventThread.cpp

// Remove -lxpfelocation_s
java/webclient/src_moz/Makefile.in

// Don't include appfilelocprovider_s
java/webclient/src_moz/Makefile.win

// Don't assert thread safe, cause we are thread safe
java/webclient/src_moz/InputStreamShim.cpp


git-svn-id: svn://10.0.0.236/trunk@91060 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 22:48:33 +00:00
scc%mozilla.org
f959d16949 partial fix for ports bustage
git-svn-id: svn://10.0.0.236/trunk@91059 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 22:42:49 +00:00
scc%mozilla.org
d5cfafb98f fix speedracer bustage; r=jag and jst
git-svn-id: svn://10.0.0.236/trunk@91052 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 22:00:34 +00:00
ashuk%eng.sun.com
e483742f91 Merging JAVADEV_RTM_20001102 into Trunk
_Ashu


git-svn-id: svn://10.0.0.236/trunk@91051 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 21:18:06 +00:00
dbaron%fas.harvard.edu
6657eede2c Fix bustage (if CSS_REPORT_PARSE_ERRORS is defined) from scc's string branch landing. nsLiteralChar was removed, so use nsLocalString instead. r=disttsc@bart.nl sr=scc@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@91050 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 21:14:23 +00:00
scc%mozilla.org
7b06841b03 landing string branch; see bug #73786
git-svn-id: svn://10.0.0.236/trunk@91049 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 19:40:52 +00:00
pinkerton%netscape.com
e12df9c36a set the out param for GetSelection in all cases. fixes blocker. r=blake, sr=smfr. bug 74217.
git-svn-id: svn://10.0.0.236/trunk@91048 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 18:18:53 +00:00
sonmi%netscape.com
7347110b37 improved usage and parameters, reduced connections from 5 to 1
git-svn-id: svn://10.0.0.236/trunk@91046 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 17:32:48 +00:00
brade%netscape.com
31e670fc9d use internet config to get colors for text and window background; sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@91045 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 14:27:28 +00:00
brade%netscape.com
1cb353f0fe only add flavors when we have data in that flavor; r=pinkerton
git-svn-id: svn://10.0.0.236/trunk@91044 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 14:11:01 +00:00
glazman%netscape.com
5b94c6728b Default namespace in html:style was HTML by default; b=72302, r=peterv, sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@91043 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 13:56:22 +00:00
sspitzer%netscape.com
2fb7ed4b12 fix warnings
git-svn-id: svn://10.0.0.236/trunk@91042 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 09:20:17 +00:00
sspitzer%netscape.com
118d32c61a fix for #74354. on a new header, force the row for the parent thread to update.
sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91038 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 07:48:53 +00:00
sspitzer%netscape.com
450a5447cf fix #74354. the icon in the thread column should have the green arrow
if the thread has any unread messages

fix #72281.  if new message arrive and they are children of a collapsed
thread, they should not become the king of the thread.

sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@91036 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 07:22:27 +00:00
jfrancis%netscape.com
efbcb3dec1 bug 58281: fixing mem leaks when shuffling nsISupports around in editor paste code. r=fm; sr=kin
git-svn-id: svn://10.0.0.236/trunk@91029 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 06:09:44 +00:00
sspitzer%netscape.com
2a3f8fcaa3 re-fix #72256. now that AdjustSelection() is working, inappropriately calling RowCountChange() will mess up the selection. (I'm the champ who added the inappropriate call.) sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@91026 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 05:30:39 +00:00
mscott%netscape.com
fd11d7c8e4 NOT PART OF THE BUILD YET
Windows specific icon channel implemenation for reading out icon bitmaps from the OS.

Landing files for icon urls. For windows only currently, this code will read out
icon bitmaps based on info from the windows registry and turns that into a 24 bit RGB image
which we can render. Icon urls have the form of:
icon://test.html/large
icon://test.doc/small
icon://test.doc (defaults to small).

Currently doesn't work on win2k yet.


git-svn-id: svn://10.0.0.236/trunk@91025 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 04:57:23 +00:00
mscott%netscape.com
55f471786c NOT PART OF THE BUILD YET
Landing files for icon urls. For windows only currently, this code will read out
icon bitmaps based on info from the windows registry and turns that into a 24 bit RGB image
which we can render. Icon urls have the form of:
icon://test.html/large
icon://test.doc/small
icon://test.doc (defaults to small).

Currently doesn't work on win2k yet.


git-svn-id: svn://10.0.0.236/trunk@91024 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 04:56:18 +00:00
stephend%netscape.com
7e2510a1e6 Removing 'Netscape' from console output in nsPop3Protocol.cpp. Bug 42509. Patch by Henrik Gemal <gemal@gemal.dk> r=hwaara@chello.se sr=blizzard@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@91023 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 03:57:29 +00:00
karnaze%netscape.com
2a157ec8eb new regression test, not affecting the build.
git-svn-id: svn://10.0.0.236/trunk@91022 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 03:37:59 +00:00
karnaze%netscape.com
3d4646b8a3 new regression tests, not affecting the build.
git-svn-id: svn://10.0.0.236/trunk@91021 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 03:24:31 +00:00
karnaze%netscape.com
dc9119345d bug 57467 - print a new row on the current page if it will waste too much space otherwise. sr=attinasi.
git-svn-id: svn://10.0.0.236/trunk@91020 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 03:21:58 +00:00
darin%netscape.com
7ba1e92b05 Fixes bug 72520 "support for cacheKeys must be implemented" r=gordon sr=dougt
git-svn-id: svn://10.0.0.236/trunk@91016 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 01:20:43 +00:00
darin%netscape.com
8568921a21 Fixes bug 73875 "www.fox.com does not load" r=beard sr=brendan
git-svn-id: svn://10.0.0.236/trunk@91015 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 01:12:40 +00:00
pollmann%netscape.com
fa49d41052 Bug 65609: (DOM) Allow form elements inside a subtree to find their parent when the subtree is appended/inserted. r=nisheeth@netscape.com, sr=jst@netscape.com
git-svn-id: svn://10.0.0.236/trunk@91014 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 00:45:52 +00:00
bryner%uiuc.edu
327beb9a6f Bug 38061 - removing obsolete headers. sr=cls.
git-svn-id: svn://10.0.0.236/trunk@91013 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-02 00:22:19 +00:00
mcafee%netscape.com
6ed1ca5564 Minor UI changes to get content to fit on pref panes with better resizing behavior (74002). sr=ben
git-svn-id: svn://10.0.0.236/trunk@91011 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 22:28:34 +00:00
waterson%netscape.com
7fc3df77e7 Bug 69973. Use NC_EXTENSION on Win32, too. Patch submitted by william.cook@crocodile-clips.com, r=bryner, ksosez@softhome.net; sr=waterson
git-svn-id: svn://10.0.0.236/trunk@91008 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 20:10:37 +00:00
jgmyers%netscape.com
e43bdd3098 don't decode overlong UTF8 sequences: bug 29314 r=jag sr=scc
git-svn-id: svn://10.0.0.236/trunk@91007 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 19:40:32 +00:00
jgmyers%netscape.com
07b50ade19 distinguish weak crypto: bug 31896 r=ddrinan
git-svn-id: svn://10.0.0.236/trunk@91006 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 19:38:12 +00:00
jgmyers%netscape.com
d305166394 distinguish weak crypto in PSM2: bug 31896 r=dmose ser=darin
git-svn-id: svn://10.0.0.236/trunk@91005 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 19:37:29 +00:00
chak%netscape.com
5c167d9d75 Calling Activate()/Deactivate() from inside of HandleEvent() as suggested by blizzard
This is a part of:
Fix for #71014 - arrow keys don't work inside text areas in mfcEmbed.
r=saari, sr=blizzard


git-svn-id: svn://10.0.0.236/trunk@91003 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 18:02:39 +00:00
chak%netscape.com
9c0f200110 Fix for #71014 - arrow keys don't work inside text areas in mfcEmbed.
r=saari, sr=blizzard


git-svn-id: svn://10.0.0.236/trunk@91002 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 17:51:12 +00:00
chak%netscape.com
edbac2c7c9 Fixes for the following bugs:
#74155 - MfcEmbed needs a prefs dlg box.
         r=valeski, sr=blizzard

#71014 - arrow keys don't work inside text areas in mfcEmbed.
         r=saari, sr=blizzard


git-svn-id: svn://10.0.0.236/trunk@91001 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 17:49:51 +00:00
mcafee%netscape.com
b49c02f26e Centering find dialog (9131). sr=ben
git-svn-id: svn://10.0.0.236/trunk@91000 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 12:09:08 +00:00
mcafee%netscape.com
36005ecf47 Adding ctrl+f for edit|search history (67908). r=blake, sr=ben
git-svn-id: svn://10.0.0.236/trunk@90997 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 11:43:06 +00:00
hwaara%chello.se
b0377ef658 Kill the last remaining js warning in this file. bug 60632. r=mao, sr=jst
git-svn-id: svn://10.0.0.236/trunk@90996 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 11:05:51 +00:00
jst%netscape.com
b98b69f1b3 Removing unused files.
git-svn-id: svn://10.0.0.236/trunk@90995 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 11:05:14 +00:00
jst%netscape.com
2a665086ed Removing unused files.
git-svn-id: svn://10.0.0.236/trunk@90994 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 10:58:34 +00:00
darin%netscape.com
c77492dc3e Fixes bug 72320. abort on exit (sending "logout" to a closed IMAP socket?).
r=sspitzer,dougt,mscott.


git-svn-id: svn://10.0.0.236/trunk@90987 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 05:17:42 +00:00
disttsc%bart.nl
19a59d243b Removing prefutilities.js, moving the code in it to where it belongs. bug=73355, r=mao, sr=ben
git-svn-id: svn://10.0.0.236/trunk@90986 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 05:02:07 +00:00
cls%seawood.org
5ca7a32c5b Add accessibility to REQUIRES. Fixing senna tb bustage.
git-svn-id: svn://10.0.0.236/trunk@90982 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 03:44:35 +00:00
morse%netscape.com
541e249bbc not part of build
git-svn-id: svn://10.0.0.236/trunk@90981 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 02:31:47 +00:00
av%netscape.com
06e15798d9 Fixing bug 73071, adding nsIPlugin::Shutdown in the plugin host destruction, r=beard, a=av, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90980 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 02:29:51 +00:00
mcafee%netscape.com
922741fa71 Setting width, height for logo.gif to avoid reflow (68264). sr=ben
git-svn-id: svn://10.0.0.236/trunk@90979 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:51:44 +00:00
evaughan%netscape.com
4067031dd1 Landing MSAA part of accessibility (DISABLED)
-r vidur -sr hyatt


git-svn-id: svn://10.0.0.236/trunk@90978 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:38:35 +00:00
jst%netscape.com
1464e3a801 New file, not part of the build.
git-svn-id: svn://10.0.0.236/trunk@90976 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:17:43 +00:00
jst%netscape.com
0ad75975e8 Adding new files, not part of the build yet.
git-svn-id: svn://10.0.0.236/trunk@90973 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:10:59 +00:00
cls%seawood.org
60e8454658 Second round of nspr autoconf cleanup.
Adding --with-dist-prefix options to free up standard options for real installs.
Bug #73919 r=bryner


git-svn-id: svn://10.0.0.236/trunk@90972 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:02:23 +00:00
evaughan%netscape.com
94e72ae454 XP part of accessibility landing
-r vidur, rods -sr hyatt


git-svn-id: svn://10.0.0.236/trunk@90971 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 01:01:33 +00:00
waterson%netscape.com
4323130426 Bug 60079. Look a little bit harder for <area> elements, rather than just bailing if the first element in the <map> isn't an <area>. r=saari, sr=jst
git-svn-id: svn://10.0.0.236/trunk@90970 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 00:45:59 +00:00
waterson%netscape.com
9c686d896b Bug 53251. RecreateFrameForContent() on a 'special' frame need only ReframeContainingBlock(). r=karnaze, sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@90969 18797224-902f-48f8-a5cc-f745e15eee43
2001-04-01 00:43:27 +00:00
mkaply%us.ibm.com
60e6b41fc8 No bug
r=mkaply, a=blizzard
Changes to get OS/2 working after LIBPR0N


git-svn-id: svn://10.0.0.236/trunk@90968 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 23:50:35 +00:00
pinkerton%netscape.com
e4fb924942 take out some useless code r=blake. bug# 18726.
git-svn-id: svn://10.0.0.236/trunk@90967 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 23:50:25 +00:00
pinkerton%netscape.com
1f8515d285 prevent click-hold scrollbars from coming up on form elements. r=pchen/sr=hyatt. bug# 18726.
git-svn-id: svn://10.0.0.236/trunk@90966 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 23:32:14 +00:00
pinkerton%netscape.com
544b8ba8d1 prevent scrollbars and popups from doing bad things with the new context menu events. r=pchen/sr=hyatt. bug# 18726
git-svn-id: svn://10.0.0.236/trunk@90965 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 23:31:37 +00:00
harishd%netscape.com
b41e36791e 69331 - <?XML..> does not require BODY!!
66985 - Do not open BODY for INPUT type=hidden. For compatibility
72639 - Discard nested FORMS
2749  - Enable Strict comment parsing.

Replace PRBools with bit operation.
nsScanner Append() should return nsresult not PRBool.

r=heikki
sr=jst


git-svn-id: svn://10.0.0.236/trunk@90964 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 22:44:05 +00:00
disttsc%bart.nl
3c74b21e9a Adding .cvsignore loving to mozilla/accessible/ and mozilla/accessible/public/
git-svn-id: svn://10.0.0.236/trunk@90963 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 20:32:49 +00:00
evaughan%netscape.com
49dad6729e Adding accessibilty to mac build
-r pinkerton -sr sfraser


git-svn-id: svn://10.0.0.236/trunk@90962 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 20:18:31 +00:00
morse%netscape.com
d86eebd4ad bug 74112, cookie following deleted cookie not getting sent out, r=valeski, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@90961 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 14:34:54 +00:00
roc+%cs.cmu.edu
5ea7ffb101 Correct child widget's view according to parent view's coordinates in AddCoveringWidgetsToOpaqueRegion. Fix for bug 73406. r=kmcclusk,sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@90960 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 13:41:28 +00:00
hwaara%chello.se
127a95b883 fix if "limit message size" check box is disabled, disabled the "size" text area and do some additional cleanup. bug 74044. sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90959 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 11:27:34 +00:00
syd%netscape.com
fbc867997c Fix for 74115, r=dveditz, sr=tor
git-svn-id: svn://10.0.0.236/trunk@90958 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 08:50:32 +00:00
beard%netscape.com
ebf25fceb5 Fixes bug #73194, when profile switching occurs, ensure new cache directory is created. r=beard, sr=darin
git-svn-id: svn://10.0.0.236/trunk@90956 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 07:37:19 +00:00
cls%seawood.org
eea62e46c8 Add needed include for BeOS BONE builds.
Thanks to maz@albany.net (Matthew Zahorik) for the patch.
Bug #71681 r=darin


git-svn-id: svn://10.0.0.236/trunk@90952 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 06:23:49 +00:00
cls%seawood.org
8b63a103c4 Add version check for Qt toolkit. Minimum required version 2.2.0 (Bug #73987, r=cls)
Update QT_CFLAGS to use proper include path and special string define. (Bug #70509, r=leaf, sr=cls)
Thanks to johng@corel.com (John Griggs) for the patches.


git-svn-id: svn://10.0.0.236/trunk@90951 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 06:21:57 +00:00
sean%beatnik.com
af30194bfc fix for bug 73349: internet shortcuts created improperly. r=pinkerton sr=blizzard
git-svn-id: svn://10.0.0.236/trunk@90950 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 05:04:57 +00:00
sspitzer%netscape.com
665b669141 #73840 fix crashers caused by a missing and addref on the db in one case, one extra one in another.
#72256 Msg selection needs to hold when expanding threads of other msgs
#72264 sorting by thread doesn't restore selection properly
#72284 Get Msg selects new message instead of leaving thread pane selection on current selected message
#74068 scroll to selected message after the sort
sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@90949 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 04:59:03 +00:00
sspitzer%netscape.com
6c1136f07e #72122 implement AdjustSelection on the outliner selection. sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@90948 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 04:55:34 +00:00
andreww%netscape.com
5ae4e22b64 bug 47290 r-timeless, sr-hyatt - remove grey bar when sidebar disabled
git-svn-id: svn://10.0.0.236/trunk@90943 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 03:50:17 +00:00
andreww%netscape.com
5576ddb6bd bug 72897 r=timeless, sr=hyatt toolbar buttons too wide
git-svn-id: svn://10.0.0.236/trunk@90942 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 03:49:12 +00:00
cls%seawood.org
c0e43b0b55 Remove solaris flags to use libiostream in the build.
Thanks to rich.burridge@Sun.COM (Rich Burridge) for the patch.
Bug #74005 r=cls


git-svn-id: svn://10.0.0.236/trunk@90941 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 03:39:09 +00:00
sean%beatnik.com
dda2578962 backing out part of my last patch to fix Sun build bustage.
git-svn-id: svn://10.0.0.236/trunk@90940 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 03:01:52 +00:00
bienvenu%netscape.com
0d9569e5f5 fix problem with messed up imap folder hierarchy, folder names in server.msf files 72854 and 72871 sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90939 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 02:50:11 +00:00
nelsonb%netscape.com
5b276cd67e Fix a couple of memory leaks that occur in rare error paths.
git-svn-id: svn://10.0.0.236/trunk@90938 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 02:49:59 +00:00
sean%beatnik.com
a8c2b13cd4 fix for bug 73289. Make plugin host an xpcom-shutdown observer so that it can release plugins even if it itself is leaked. ar=av sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@90936 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 02:26:51 +00:00
leaf%mozilla.org
7070751edd Automated update
git-svn-id: svn://10.0.0.236/trunk@90935 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 02:00:03 +00:00
bryner%uiuc.edu
f3c0851883 Fixing --disable-libpr0n so we can see if it's causing the profile problems. r=cls.
git-svn-id: svn://10.0.0.236/trunk@90934 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 01:56:38 +00:00
karnaze%netscape.com
08223b27c4 fix regression test, not affecting the build.
git-svn-id: svn://10.0.0.236/trunk@90928 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 01:33:21 +00:00
leaf%mozilla.org
70e61b9f1c Automated update
git-svn-id: svn://10.0.0.236/trunk@90927 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 01:15:03 +00:00
disttsc%bart.nl
6747645aa8 Convert hkscs.ut from DOS mode to UNIX mode (newline fu) to make Cement happy.
git-svn-id: svn://10.0.0.236/trunk@90926 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 01:11:45 +00:00
cls%seawood.org
8b1861c0ec Making ldap beos-aware. Fixing tinderbox bustage.
Bug #74163 r=dmose@netscape.com


git-svn-id: svn://10.0.0.236/trunk@90924 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 01:06:51 +00:00
pavlov%netscape.com
8d387bf49f fix for bug 74115. r=saari sr=scc
git-svn-id: svn://10.0.0.236/trunk@90923 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 00:50:30 +00:00
karnaze%netscape.com
f7f2974fa4 fix regression test, not affecting the build.
git-svn-id: svn://10.0.0.236/trunk@90921 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 00:46:49 +00:00
cls%seawood.org
8077c2249e dos2unix: converting file intl/uconv/ucvtw/hkscs.uf to UNIX format ...
git-svn-id: svn://10.0.0.236/trunk@90920 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-31 00:36:19 +00:00
av%netscape.com
e018a51da3 Fixing 71884, making native Windows Get Plugin dialog modeless, r=serge, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90919 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 23:56:38 +00:00
kestes%tradinglinx.com
c293543b6d do not have blank lines before the mail headers, postfix will choke.
git-svn-id: svn://10.0.0.236/trunk@90918 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 22:44:54 +00:00
kestes%tradinglinx.com
866050de31 do not have blank lines before the mail headers, postfix will choke.
git-svn-id: svn://10.0.0.236/trunk@90917 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 22:44:10 +00:00
karnaze%netscape.com
fb99a87f3a new printing regression tests/cleanup, not affecting the build.
git-svn-id: svn://10.0.0.236/trunk@90916 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 22:19:31 +00:00
cls%seawood.org
5efbd2c0d8 Add timer to REQUIRES. Fixing senna tb bustage
git-svn-id: svn://10.0.0.236/trunk@90915 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 22:19:00 +00:00
rginda%netscape.com
a5ff3d3128 -- NOT PART OF ANY BUILD --
ircbot.js: only check userIsOwner if we care about the result
mingus.js: update owners list, add op owners on join


git-svn-id: svn://10.0.0.236/trunk@90911 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 21:05:24 +00:00
mcgreer%netscape.com
0244ac115b clean up PKCS#12 code
refer to certs by db key, not nickname (fixes nickname collision bugs)


git-svn-id: svn://10.0.0.236/trunk@90907 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 19:55:00 +00:00
kestes%tradinglinx.com
3871d7b75c remove duplicate printing of unmonitored build list.
git-svn-id: svn://10.0.0.236/trunk@90906 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 19:54:50 +00:00
javi%netscape.com
566e0db160 Fix for bug 64713. Patch from Margaret Chan to get PSM building using gcc
git-svn-id: svn://10.0.0.236/trunk@90903 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 18:46:06 +00:00
brade%netscape.com
739e748c0e remove platform specific bindings; remove ids
git-svn-id: svn://10.0.0.236/trunk@90899 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 16:02:39 +00:00
brade%netscape.com
0596bcb1c7 move certain keys to platform files; windows fixes
git-svn-id: svn://10.0.0.236/trunk@90898 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 16:00:31 +00:00
brade%netscape.com
d585f29764 remove ids
git-svn-id: svn://10.0.0.236/trunk@90897 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 15:59:44 +00:00
brade%netscape.com
cc25e2caa4 os2 keybinding changes
git-svn-id: svn://10.0.0.236/trunk@90896 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 15:58:55 +00:00
brade%netscape.com
251c7ed2b2 mac keybinding cleanup
git-svn-id: svn://10.0.0.236/trunk@90895 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 15:56:20 +00:00
kestes%tradinglinx.com
71f4b75187 I seem to have trouble keeping the interface
TinderDB::Build::all_build_names($tree);
consistent will all usage of this function.


git-svn-id: svn://10.0.0.236/trunk@90894 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 15:37:44 +00:00
mkaply%us.ibm.com
2c63774226 Per jdunn - AIX and OS/2 bustage
git-svn-id: svn://10.0.0.236/trunk@90893 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 15:31:54 +00:00
kin%netscape.com
114013d2ea Fix for Normal->ViewSource->Normal dataloss bugs
73659 (TextArea tag) and 55224 (Map tag). Added
IsTextarea() and IsMap() methods, factored out
common code for Is*() methods into NodeIsType().
r=jfrancis@netscpae.com sr=sfraser@netscape.com


git-svn-id: svn://10.0.0.236/trunk@90892 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 14:39:29 +00:00
mkaply%us.ibm.com
45beae1008 #72239
r=heikki, sr=brendan
The XML parser is designed to receive extern "C" functions, so that is what we should be passing


git-svn-id: svn://10.0.0.236/trunk@90891 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 14:28:06 +00:00
mkaply%us.ibm.com
ed3df1c16e BeOS breakage - with new libimg
git-svn-id: svn://10.0.0.236/trunk@90890 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 14:24:59 +00:00
mkaply%us.ibm.com
9dbdce4188 OS/2 breakage - with new libimg
git-svn-id: svn://10.0.0.236/trunk@90889 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 14:24:49 +00:00
oeschger%netscape.com
e190bf0901 removing extra curly, NOT PART OF BUILD
git-svn-id: svn://10.0.0.236/trunk@90888 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 14:22:15 +00:00
locka%iol.ie
6da141a0d9 Added test for MOZ_NO_ACTIVEX_REGISTRATION to disable control_kicker registration . b=71715
git-svn-id: svn://10.0.0.236/trunk@90886 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 12:01:24 +00:00
locka%iol.ie
f6942e98d1 Removed ActiveX control registration. b=71715
git-svn-id: svn://10.0.0.236/trunk@90885 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 12:00:25 +00:00
cls%seawood.org
78e26e0296 more gfx2 fun
git-svn-id: svn://10.0.0.236/trunk@90884 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 11:47:24 +00:00
disttsc%bart.nl
3ea7009900 Add "gfx2" and "imglib2" to REQUIRES lines in Makefile.in for MOZ_TRACK_MODULE_DEPS builds (e.g. senna)
git-svn-id: svn://10.0.0.236/trunk@90883 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 10:39:06 +00:00
cls%seawood.org
49b5df7f2c Start adding gfx2 headers to REQUIRES
git-svn-id: svn://10.0.0.236/trunk@90882 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 10:27:42 +00:00
glazman%netscape.com
ea38e16949 Support for :last-child pseudoclass; checking in for Ian Hickson ; b=46916, r=pierre, sr=attinasi
git-svn-id: svn://10.0.0.236/trunk@90881 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 10:20:57 +00:00
cls%seawood.org
002e21b623 Cast void * to long before casting to char.
Thanks to Brad Roberts <braddr@puremagic.com> for the patch.
Bug #74078


git-svn-id: svn://10.0.0.236/trunk@90878 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 09:51:50 +00:00
axel%pike.org
518edf86c2 not part of build; do attribute comparison better in DiffDOM.js, r=peterv
git-svn-id: svn://10.0.0.236/trunk@90873 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:55:53 +00:00
pavlov%netscape.com
d2665b288d adding new files to unix packages file
git-svn-id: svn://10.0.0.236/trunk@90871 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:47:47 +00:00
pavlov%netscape.com
163bbdd200 adding new files to the embedding manifest file for unix bug 73773
git-svn-id: svn://10.0.0.236/trunk@90870 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:45:42 +00:00
timeless%mac.com
2a269d478f tinderbox senna bustage r=cls add timer to REQUIRES
git-svn-id: svn://10.0.0.236/trunk@90869 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:43:00 +00:00
pavlov%netscape.com
d42539fd26 fix for animations on linux r=saari sr=waterson bug 73342
git-svn-id: svn://10.0.0.236/trunk@90868 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:42:23 +00:00
cls%seawood.org
fca096b68e Attempting fix for HP-UX & OS/2 bustage
git-svn-id: svn://10.0.0.236/trunk@90867 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 08:07:20 +00:00
maolson%earthlink.net
3456445cd2 bug 53688 - javascript strict warnings in autocomplete.xml
r=timeless, sr=alecf


git-svn-id: svn://10.0.0.236/trunk@90866 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:47:46 +00:00
sspitzer%netscape.com
5bd0d9390f make the widget state manager more robust. see #74072. sr=alecf
git-svn-id: svn://10.0.0.236/trunk@90865 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:16:59 +00:00
sspitzer%netscape.com
3f8944c914 fix js error when doing search. there is no folder tree when you are searching.
sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@90864 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:15:23 +00:00
leaf%mozilla.org
3f3c512bf1 Automated update
git-svn-id: svn://10.0.0.236/trunk@90863 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:15:02 +00:00
sspitzer%netscape.com
f0b029acc2 quiet js errors, since we haven't gotten dnd working for search yet.
hide the thread specific columns in the search pane.  sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@90862 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:14:19 +00:00
pavlov%netscape.com
c29feacfbb fix for bug 73161 r=bryner,syd sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90860 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:05:28 +00:00
pavlov%netscape.com
caeaf71875 turning on new imagelib on linux bugs 73161 and 70938 r=bryner,syd sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90859 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:05:02 +00:00
pavlov%netscape.com
a6fb61b0dd turning on new imagelib on linux. part of bug 73161 and 70938. r=bryner,syd sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90858 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:04:13 +00:00
sspitzer%netscape.com
f3b6929f26 fix #73863. no twisties in the outliner in classic. r=bienvenu, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@90857 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 07:02:32 +00:00
sspitzer%netscape.com
4941e5e749 fix for #65677. if there is no spell checker, disable the "spell check on message send ui." fix by gervase.markham@univ.ox.ac.uk. sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90856 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 06:48:24 +00:00
alecf%netscape.com
62af2a607f fix for but 1995, checking in for sicking@bigfoot.com, sr=alecf r=jag
git-svn-id: svn://10.0.0.236/trunk@90853 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 06:01:00 +00:00
leaf%mozilla.org
324a8cbdbe Automated update
git-svn-id: svn://10.0.0.236/trunk@90852 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 06:00:04 +00:00
dmose%netscape.com
8824937eb8 fix BeOS bustage by disabling ldap support on that platform
git-svn-id: svn://10.0.0.236/trunk@90851 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:55:51 +00:00
naving%netscape.com
cd41ccdbf0 fix warnings due to earlier checkins
git-svn-id: svn://10.0.0.236/trunk@90850 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:51:06 +00:00
sspitzer%netscape.com
ac59320954 #72282 fix "click on empty thread pane" crash (again)
#72264 sort by thread doesn't restore selection
#74068 if we switch sort mode, scroll to find the message we are displaying

sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@90849 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:44:01 +00:00
naving%netscape.com
b27184df63 67799, 55814. sr=bienvenu
Also check if write has failed to alert the user and stop downloading messages


git-svn-id: svn://10.0.0.236/trunk@90846 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:30:13 +00:00
leaf%mozilla.org
a3a81d5571 Automated update
git-svn-id: svn://10.0.0.236/trunk@90845 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:30:04 +00:00
naving%netscape.com
422b25a870 67799, 55814. sr=bienvenu. Check if write has failed to alert the user and stop downloading messages. Truncate the file if write has failed before downloading a message completely
git-svn-id: svn://10.0.0.236/trunk@90844 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:29:53 +00:00
naving%netscape.com
f1e8c50dca 67799, 55814. sr=bienvenu. Do UIDL implemenetation when we don't leave messages on the server. if write has failed to alert the user and stop downloading messages
git-svn-id: svn://10.0.0.236/trunk@90843 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:28:43 +00:00
naving%netscape.com
5c2fd21f73 67799, 55814. Do UIDL implemenetation when we don't leave messages on the server.
Also check if write has failed to alert the user and stop downloading messages


git-svn-id: svn://10.0.0.236/trunk@90842 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:27:53 +00:00
naving%netscape.com
fbd042a61b 67799, 55814. Clean up work asscociated with these bugs.
git-svn-id: svn://10.0.0.236/trunk@90841 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:25:54 +00:00
kmcclusk%netscape.com
780ba6923c Use frame bit to indicate if frame has a decendant with a view and use this to optimize nsContainerFrame::PositionChildViews; bug 70211; sr=attinasi@netscape.com r=karnaze@netscape.com
git-svn-id: svn://10.0.0.236/trunk@90840 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:25:49 +00:00
naving%netscape.com
e53729a27c 67799, 55814. sr=bienvenu. Propogate the error values for streams.
git-svn-id: svn://10.0.0.236/trunk@90839 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:24:34 +00:00
dmose%netscape.com
299f3bb323 This workaround actually won't work. Backing it out.
git-svn-id: svn://10.0.0.236/trunk@90838 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:24:23 +00:00
pinkerton%netscape.com
d4f0bc497f attempt to fix bustage.
git-svn-id: svn://10.0.0.236/trunk@90836 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:22:42 +00:00
sspitzer%netscape.com
49eb631a77 fix for #71243. don't hard code the default values, get them from the
default prefs.  fix by cavin@netscape.com.  sr=spitzer


git-svn-id: svn://10.0.0.236/trunk@90835 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:22:22 +00:00
kmcclusk%netscape.com
e889aeb106 Invalidate only the newly exposed region when the container frame size changes vertically b=19256; sr=attinasi@netscape.com r=roc+moz@cs.cmu.edu
git-svn-id: svn://10.0.0.236/trunk@90834 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:17:07 +00:00
bienvenu%netscape.com
225b79f9a0 fix assertion when loading folder with just one thread r=naving, sr=sspitzer 73989
git-svn-id: svn://10.0.0.236/trunk@90833 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:12:43 +00:00
bienvenu%netscape.com
1f54e1c13c fix 73960 double load of imap inbox on start r=naving, sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90832 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:07:20 +00:00
joe.chou%eng.sun.com
ef0e4bc915 Re-checkin fix of bug 64296 after updating the Mac file, build/mac/build_scripts
/MozillaBuildList.pm.

bug=64296
r=edburns
sr=waterson

This checkin idlifies some files in the plugin hierarchy.

The following files are in this checkin.

build/mac/build_scripts/MozillaBuildList.pm
modules/oji/public/MANIFEST
modules/oji/public/MANIFEST_IDL
modules/oji/macbuild/ojiIDL.mcp
modules/plugin/public/MANIFEST
modules/plugin/public/MANIFEST_IDL
modules/plugin/macbuild/pluginIDL.mcp
modules/oji/public/Makefile.in
modules/oji/public/makefile.win
modules/oji/public/nsIJVMPluginInstance.idl
modules/plugin/public/Makefile.in
modules/plugin/public/makefile.win
modules/plugin/public/nsIPluginManager.idl


git-svn-id: svn://10.0.0.236/trunk@90831 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:00:56 +00:00
leaf%mozilla.org
e3057bb8c0 Automated update
git-svn-id: svn://10.0.0.236/trunk@90830 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 05:00:02 +00:00
dmose%netscape.com
fb352a8266 Attempt to workaround bustage on palermo by forcing -Dhpux on all HP/UX builds. r=cls@seawoord.org
git-svn-id: svn://10.0.0.236/trunk@90829 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 04:51:54 +00:00
pinkerton%netscape.com
ccfecb4d51 switching mac to use NS_CONTEXTMENU event, click-hold context menus, switching embedding to use NS_CONTEXTMENU event. r=saari/sr=hyatt. bug# 36665, 18726
git-svn-id: svn://10.0.0.236/trunk@90828 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 04:45:40 +00:00
cls%seawood.org
33374aacdf Help text typo fix.
Thanks to Ben Bucksch <ben.bucksch@beonex.com> for the patch.


git-svn-id: svn://10.0.0.236/trunk@90827 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:59:43 +00:00
darin%netscape.com
d7139a472d Fixes bug 72312 "gopher needs to wrap the proxy channel"
patch=bbaetz, r=dougt, sr=darin


git-svn-id: svn://10.0.0.236/trunk@90826 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:21:55 +00:00
sfraser%netscape.com
d84e88c630 Fix for bug 72578 -- add ability to retrieve controllers by ID from an nsIControllers. r=kin, sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@90825 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:20:56 +00:00
cls%seawood.org
2b0b9b564a Backout ben's erronous checkin. bug #69366
git-svn-id: svn://10.0.0.236/trunk@90824 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:19:08 +00:00
ftang%netscape.com
b843b8286d fix 71197
r=bstell sr=erik
split JIS0208 to two mapping
One for standard JIS0208 mapping one for the CP932 extension (non standard)


git-svn-id: svn://10.0.0.236/trunk@90823 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:16:10 +00:00
ftang%netscape.com
fdfed42191 fix 71489
r=bstell sr=erik
add Unicode to Johab encoding to the module


git-svn-id: svn://10.0.0.236/trunk@90822 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:11:21 +00:00
ftang%netscape.com
be39c9dd08 add nsUnicodeToJohab.cpp into the mac build system
fix bug 71489 r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@90821 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:09:40 +00:00
ftang%netscape.com
4e212d2368 fix 71489
add nsUnicodeToJohab.cpp to the window build system
r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@90820 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:09:00 +00:00
peterlubczynski%netscape.com
3e7edbf8c0 Fix to make printing OBJECTs safer bug 73846 a=av sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90819 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:07:52 +00:00
ftang%netscape.com
e399a943aa fix 71489
add nsUnicodeToJohab.cpp to the unix build system


git-svn-id: svn://10.0.0.236/trunk@90818 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:07:33 +00:00
pinkerton%netscape.com
0b05afe8e0 checking in nsXBLContextMenuHandler for hyatt.
git-svn-id: svn://10.0.0.236/trunk@90817 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:05:47 +00:00
ftang%netscape.com
26f8754867 fix 71489
Add johab document encoding support
Currently the convert from johab to unicode part is #if 0 since
we didn't have a way to test it.
r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@90816 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 03:03:14 +00:00
ftang%netscape.com
521dcc01ba fix 71489
r=bstell sr=erik
add x-johab font support


git-svn-id: svn://10.0.0.236/trunk@90815 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:54:46 +00:00
ftang%netscape.com
9574c0d87a add lang group for x-johab
fix 71489
r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@90814 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:53:55 +00:00
ftang%netscape.com
6fec59ea21 add new cid for Johab encoding
fix 71489
r=bstell sr=erik


git-svn-id: svn://10.0.0.236/trunk@90813 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:52:37 +00:00
ftang%netscape.com
f164d43056 add Johab converter to fix bug 71489
r=bstell sr=erik
Not part of the build yet.


git-svn-id: svn://10.0.0.236/trunk@90812 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:51:24 +00:00
ftang%netscape.com
229acc4d59 fix bug 71197
r=bstell sr=erik
add new mapping for non-standard jis0208 extension


git-svn-id: svn://10.0.0.236/trunk@90811 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:49:34 +00:00
ftang%netscape.com
5ef3e0dbfd remove the non standard jis0208 mapping and split into jis0208ext.uf
r=bstell sr=erik, bug 71197


git-svn-id: svn://10.0.0.236/trunk@90810 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:47:41 +00:00
ftang%netscape.com
30bffc120a fix 71197
Machine generate code for non standard jis0208 code point (from cp 932)
r=bstell sr=erik
not part of the build yet


git-svn-id: svn://10.0.0.236/trunk@90809 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:46:40 +00:00
ftang%netscape.com
8497e43f47 fix 72557
r=harishd sr=erik
add the hack mapping for the last two new cp1252 characters.


git-svn-id: svn://10.0.0.236/trunk@90808 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:45:12 +00:00
rbs%maths.uq.edu.au
b21aa14236 Enable an ordered list of preferred fonts (rather than just one font) for particular chars. Fix the problem that the stretchy direction wasn't specified in certain cases so that resolving the annotations could wrongly failed. Use NS_LITERAL_STRING like everybody else. Apply suggestions from drivers (roc+moz, dbaron)
git-svn-id: svn://10.0.0.236/trunk@90807 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:39:38 +00:00
harishd%netscape.com
23353e444d P3P code drop. Includes basic P3P support and UI.
Contributed by Tom Lendacky ( toml@us.ibm.com ).

*-- NOT PART OF THE BUILD...YET --*


git-svn-id: svn://10.0.0.236/trunk@90806 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:36:22 +00:00
hyatt%netscape.com
2ebbd7376a Checkin for 36665. r=pink, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90805 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:30:17 +00:00
danm%netscape.com
40ec918c36 restrict conditions under which fix for bug 22658 fires; a fix for many focus bugs, especially bug 54936
git-svn-id: svn://10.0.0.236/trunk@90804 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:27:50 +00:00
heikki%netscape.com
6c69c694fd Bug 72522, implemented DOM Level 3 baseURI property (node interface). r=harishd, sr=jst.
git-svn-id: svn://10.0.0.236/trunk@90803 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:15:21 +00:00
ftang%netscape.com
74c7d96b39 bug 70028
sr=erik r=ftang check in for smontagur@il.ibm.com
add methods for arabic shaping with the unreview code turn off in #ifdef
add to mac build system


git-svn-id: svn://10.0.0.236/trunk@90802 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:14:14 +00:00
ftang%netscape.com
216801a0ba bug 70028. add arabic shaping methods with unreview code turn off by default. add to mac build system
git-svn-id: svn://10.0.0.236/trunk@90801 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:12:46 +00:00
harishd%netscape.com
0cf651600f 71942 - Intialize the ptr to fix the crash.
49942 - Should not include parent when absolutely positioned.
Added border color property.
r=heikki
sr=jst


git-svn-id: svn://10.0.0.236/trunk@90800 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:08:48 +00:00
pavlov%netscape.com
8c9a17ebcd removing the extern "C" { ... } that blake accidentally added the other day. fixes runtime errors on solaris
git-svn-id: svn://10.0.0.236/trunk@90799 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:07:00 +00:00
racham%netscape.com
63508e9fab Fixing bugs 72498, 73892 and 72531. Fixing bug 72498 brings back File Here menuitem back into all mailnews folder pickers. This one missed 081 branch train. Thanks to all who reviewed this patch now and then. Fixing bug 73892 makes the Bcc Self field appear again in Copies and Folders panel of any given server and fianlly fix to bug 72531 makes Search Messages link to appear for news and movemail accounts in AccountCentral. r=gayatrib, bienvenu, racham sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90798 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:06:46 +00:00
jgmyers%netscape.com
213c4ff3cd fix logic inversion: bug 73243 r=nhotta sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@90797 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:05:19 +00:00
naving%netscape.com
a1e1e0e7d1 74018. sr=sspitzer. limiting message_size working again.
git-svn-id: svn://10.0.0.236/trunk@90796 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:03:32 +00:00
leaf%mozilla.org
1b9569ddf1 Automated update
git-svn-id: svn://10.0.0.236/trunk@90795 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 02:00:03 +00:00
pavlov%netscape.com
f98e787957 fix for crash when loading images with a null URL. bug 72447. r=dr sr=hyatt
git-svn-id: svn://10.0.0.236/trunk@90794 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 01:59:03 +00:00
dmose%netscape.com
c0316344b7 Start building the LDAP XPCOM SDK by default in autoconf builds (bug 70658). Patch to flip the switch: r=leif@netscape.com, sr=cls@seawood.org. Code being turned on: moa=dmose@netscape.com, sr=shaver@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@90793 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 01:52:15 +00:00
nelsonb%netscape.com
58e68a8e98 Fix leak of cert reference in cert authentication callback functions.
git-svn-id: svn://10.0.0.236/trunk@90792 18797224-902f-48f8-a5cc-f745e15eee43
2001-03-30 00:40:24 +00:00
81 changed files with 10309 additions and 2288 deletions

View File

@@ -0,0 +1,33 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public src decoders
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,32 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = ppm png gif jpeg
include $(topsrcdir)/config/rules.mk

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,323 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef _GIF_H_
#define _GIF_H_
/* gif2.h
The interface for the GIF87/89a decoder.
*/
// List of possible parsing states
typedef enum {
gif_gather,
gif_init, //1
gif_type,
gif_version,
gif_global_header,
gif_global_colormap,
gif_image_start, //6
gif_image_header,
gif_image_colormap,
gif_image_body,
gif_lzw_start,
gif_lzw, //11
gif_sub_block,
gif_extension,
gif_control_extension,
gif_consume_block,
gif_skip_block,
gif_done, //17
gif_oom,
gif_error,
gif_comment_extension,
gif_application_extension,
gif_netscape_extension_block,
gif_consume_netscape_extension,
gif_consume_comment,
gif_delay,
gif_wait_for_buffer_full,
gif_stop_animating //added for animation stop
} gstate;
/* "Disposal" method indicates how the image should be handled in the
framebuffer before the subsequent image is displayed. */
typedef enum
{
DISPOSE_NOT_SPECIFIED = 0,
DISPOSE_KEEP = 1, /* Leave it in the framebuffer */
DISPOSE_OVERWRITE_BGCOLOR = 2, /* Overwrite with background color */
DISPOSE_OVERWRITE_PREVIOUS = 4 /* Save-under */
} gdispose;
/* A RGB triplet representing a single pixel in the image's colormap
(if present.) */
typedef struct _GIF_RGB
{
PRUint8 red, green, blue, pad; /* Windows requires the fourth byte &
many compilers pad it anyway. */
/* XXX: hist_count appears to be unused */
//PRUint16 hist_count; /* Histogram frequency count. */
} GIF_RGB;
/* Colormap information. */
typedef struct _GIF_ColorMap {
int32 num_colors; /* Number of colors in the colormap.
A negative value can be used to denote a
possibly non-unique set. */
GIF_RGB *map; /* Colormap colors. */
PRUint8 *index; /* NULL, if map is in index order. Otherwise
specifies the indices of the map entries. */
void *table; /* Lookup table for this colormap. Private to
the Image Library. */
} GIF_ColorMap;
/* An indexed RGB triplet. */
typedef struct _GIF_IRGB {
PRUint8 index;
PRUint8 red, green, blue;
} GIF_IRGB;
/* A GIF decoder's state */
typedef struct gif_struct {
void* clientptr;
/* Callbacks for this decoder instance*/
int (PR_CALLBACK *GIFCallback_NewPixmap)();
int (PR_CALLBACK *GIFCallback_BeginGIF)(
void* aClientData,
PRUint32 aLogicalScreenWidth,
PRUint32 aLogicalScreenHeight,
PRUint8 aLogicalScreenBackgroundRGBIndex);
int (PR_CALLBACK* GIFCallback_EndGIF)(
void* aClientData,
int aAnimationLoopCount);
int (PR_CALLBACK* GIFCallback_BeginImageFrame)(
void* aClientData,
PRUint32 aFrameNumber, /* Frame number, 1-n */
PRUint32 aFrameXOffset, /* X offset in logical screen */
PRUint32 aFrameYOffset, /* Y offset in logical screen */
PRUint32 aFrameWidth,
PRUint32 aFrameHeight,
GIF_RGB* aTransparencyChromaKey);
int (PR_CALLBACK* GIFCallback_EndImageFrame)(
void* aClientData,
PRUint32 aFrameNumber,
PRUint32 aDelayTimeout);
int (PR_CALLBACK* GIFCallback_SetupColorspaceConverter)();
int (PR_CALLBACK* GIFCallback_ResetPalette)();
int (PR_CALLBACK* GIFCallback_InitTransparentPixel)();
int (PR_CALLBACK* GIFCallback_DestroyTransparentPixel)();
int (PR_CALLBACK* GIFCallback_HaveDecodedRow)(
void* aClientData,
PRUint8* aRowBufPtr, /* Pointer to single scanline temporary buffer */
PRUint8* aRGBrowBufPtr,/* Pointer to temporary storage for dithering/mapping */
int aXOffset, /* With respect to GIF logical screen origin */
int aLength, /* Length of the row? */
int aRow, /* Row number? */
int aDuplicateCount, /* Number of times to duplicate the row? */
PRUint8 aDrawMode, /* il_draw_mode */
int aInterlacePass);
int (PR_CALLBACK *GIFCallback_HaveImageAll)(
void* aClientData);
/* Parsing state machine */
gstate state; /* Curent decoder master state */
PRUint8 *hold; /* Accumulation buffer */
int32 hold_size; /* Capacity, in bytes, of accumulation buffer */
PRUint8 *gather_head; /* Next byte to read in accumulation buffer */
int32 gather_request_size; /* Number of bytes to accumulate */
int32 gathered; /* bytes accumulated so far*/
gstate post_gather_state; /* State after requested bytes accumulated */
int32 requested_buffer_fullness; /* For netscape application extension */
/* LZW decoder state machine */
PRUint8 *stack; /* Base of decoder stack */
PRUint8 *stackp; /* Current stack pointer */
PRUint16 *prefix;
PRUint8 *suffix;
int datasize;
int codesize;
int codemask;
int clear_code; /* Codeword used to trigger dictionary reset */
int avail; /* Index of next available slot in dictionary */
int oldcode;
PRUint8 firstchar;
int count; /* Remaining # bytes in sub-block */
int bits; /* Number of unread bits in "datum" */
int32 datum; /* 32-bit input buffer */
/* Output state machine */
int ipass; /* Interlace pass; Ranges 1-4 if interlaced. */
PRUintn rows_remaining; /* Rows remaining to be output */
PRUintn irow; /* Current output row, starting at zero */
PRUint8 *rgbrow; /* Temporary storage for dithering/mapping */
PRUint8 *rowbuf; /* Single scanline temporary buffer */
PRUint8 *rowend; /* Pointer to end of rowbuf */
PRUint8 *rowp; /* Current output pointer */
/* Parameters for image frame currently being decoded*/
PRUintn x_offset, y_offset; /* With respect to "screen" origin */
PRUintn height, width;
PRUintn last_x_offset, last_y_offset; /* With respect to "screen" origin */
PRUintn last_height, last_width;
int interlaced; /* TRUE, if scanlines arrive interlaced order */
int tpixel; /* Index of transparent pixel */
GIF_IRGB* transparent_pixel;
int is_transparent; /* TRUE, if tpixel is valid */
int control_extension; /* TRUE, if image control extension present */
int is_local_colormap_defined;
gdispose disposal_method; /* Restore to background, leave in place, etc.*/
gdispose last_disposal_method;
GIF_RGB *local_colormap; /* Per-image colormap */
int local_colormap_size; /* Size of local colormap array. */
PRUint32 delay_time; /* Display time, in milliseconds,
for this image in a multi-image GIF */
/* Global (multi-image) state */
int screen_bgcolor; /* Logical screen background color */
int version; /* Either 89 for GIF89 or 87 for GIF87 */
PRUintn screen_width; /* Logical screen width & height */
PRUintn screen_height;
GIF_RGB *global_colormap; /* Default colormap if local not supplied */
int global_colormap_size; /* Size of global colormap array. */
int images_decoded; /* Counts images for multi-part GIFs */
int destroy_pending; /* Stream has ended */
int progressive_display; /* If TRUE, do Haeberli interlace hack */
int loop_count; /* Netscape specific extension block to control
the number of animation loops a GIF renders. */
} gif_struct;
/* Create a new gif_struct */
extern PRBool gif_create(gif_struct **gs);
/* These are the APIs that the client calls to intialize,
push data to, and shut down the GIF decoder. */
PRBool GIFInit(
gif_struct* gs,
void* aClientData,
int (*PR_CALLBACK GIFCallback_NewPixmap)(),
int (*PR_CALLBACK GIFCallback_BeginGIF)(
void* aClientData,
PRUint32 aLogicalScreenWidth,
PRUint32 aLogicalScreenHeight,
PRUint8 aBackgroundRGBIndex),
int (*PR_CALLBACK GIFCallback_EndGIF)(
void* aClientData,
int aAnimationLoopCount),
int (*PR_CALLBACK GIFCallback_BeginImageFrame)(
void* aClientData,
PRUint32 aFrameNumber, /* Frame number, 1-n */
PRUint32 aFrameXOffset, /* X offset in logical screen */
PRUint32 aFrameYOffset, /* Y offset in logical screen */
PRUint32 aFrameWidth,
PRUint32 aFrameHeight,
GIF_RGB* aTransparencyChromaKey),
int (*PR_CALLBACK GIFCallback_EndImageFrame)(
void* aClientData,
PRUint32 aFrameNumber,
PRUint32 aDelayTimeout),
int (*PR_CALLBACK GIFCallback_SetupColorspaceConverter)(),
int (*PR_CALLBACK GIFCallback_ResetPalette)(),
int (*PR_CALLBACK GIFCallback_InitTransparentPixel)(),
int (*PR_CALLBACK GIFCallback_DestroyTransparentPixel)(),
int (*PR_CALLBACK GIFCallback_HaveDecodedRow)(
void* aClientData,
PRUint8* aRowBufPtr, /* Pointer to single scanline temporary buffer */
PRUint8* aRGBrowBufPtr,/* Pointer to temporary storage for dithering/mapping */
int aXOffset, /* With respect to GIF logical screen origin */
int aLength, /* Length of the row? */
int aRow, /* Row number? */
int aDuplicateCount, /* Number of times to duplicate the row? */
PRUint8 aDrawMode, /* il_draw_mode */
int aInterlacePass),
int (*PR_CALLBACK GIFCallback_HaveImageAll)(
void* aClientData)
);
extern void gif_destroy(gif_struct* aGIFStruct);
int gif_write(gif_struct* aGIFStruct, const PRUint8 * buf, PRUint32 numbytes);
PRUint8 gif_write_ready(gif_struct* aGIFStruct);
extern void gif_complete(gif_struct** aGIFStruct);
extern void gif_delay_time_callback(/* void *closure */);
/* Callback functions that the client must implement and pass in
pointers for during the GIFInit call. These will be called back
when the decoder has a decoded rows, frame size information, etc.*/
/* GIFCallback_LogicalScreenSize is called only once to notify the client
of the logical screen size, which will be the size of the total image. */
typedef int (*PR_CALLBACK BEGINGIF_CALLBACK)(
void* aClientData,
PRUint32 aLogicalScreenWidth,
PRUint32 aLogicalScreenHeight,
PRUint8 aLogicalScreenBackgroundRGBIndex);
typedef int (PR_CALLBACK *GIFCallback_EndGIF)(
void* aClientData,
int aAnimationLoopCount);
/* GIFCallback_BeginImageFrame is called at the beginning of each frame of
a GIF.*/
typedef int (PR_CALLBACK *GIFCallback_BeginImageFrame)(
void* aClientData,
PRUint32 aFrameNumber, /* Frame number, 1-n */
PRUint32 aFrameXOffset, /* X offset in logical screen */
PRUint32 aFraqeYOffset, /* Y offset in logical screen */
PRUint32 aFrameWidth,
PRUint32 aFrameHeight);
extern int GIFCallback_EndImageFrame(
void* aClientData,
PRUint32 aFrameNumber,
PRUint32 aDelayTimeout); /* Time in milliseconds this frame should be displayed before the next frame.
This information appears in a sub control block, so we don't
transmit it back to the client until we're done with the frame. */
/*
extern int GIFCallback_SetupColorspaceConverter();
extern int GIFCallback_ResetPalette();
extern int GIFCallback_InitTransparentPixel();
extern int GIFCallback_DestroyTransparentPixel();
*/
extern int GIFCallback_HaveDecodedRow();
extern int GIFCallback_HaveImageAll();
#endif

View File

@@ -0,0 +1,42 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imggif
LIBRARY_NAME = imggif
IS_COMPONENT = 1
REQUIRES = xpcom necko layout gfx2 imglib2
CPPSRCS = GIF2.cpp nsGIFDecoder2.cpp nsGIFModule.cpp
EXTRA_DSO_LDOPTS = $(GIF_LIBS) $(ZLIB_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,52 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imggif
LIBRARY_NAME = imggif
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\nsGIFDecoder2.obj \
.\$(OBJDIR)\GIF2.obj \
.\$(OBJDIR)\nsGIFModule.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,506 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Chris Saari <saari@netscape.com>
*/
#include "nsGIFDecoder2.h"
#include "nsIInputStream.h"
#include "nsIComponentManager.h"
#include "nsIImage.h"
#include "nsMemory.h"
#include "imgIContainerObserver.h"
#include "nsRect.h"
//////////////////////////////////////////////////////////////////////
// GIF Decoder Implementation
// This is an adaptor between GIF2 and imgIDecoder
NS_IMPL_ISUPPORTS2(nsGIFDecoder2, imgIDecoder, nsIOutputStream);
nsGIFDecoder2::nsGIFDecoder2()
{
NS_INIT_ISUPPORTS();
mImageFrame = nsnull;
mGIFStruct = nsnull;
mAlphaLine = nsnull;
}
nsGIFDecoder2::~nsGIFDecoder2(void)
{
if (mAlphaLine)
nsMemory::Free(mAlphaLine);
if (mGIFStruct) {
gif_destroy(mGIFStruct);
mGIFStruct = nsnull;
}
}
//******************************************************************************
/** imgIDecoder methods **/
//******************************************************************************
//******************************************************************************
/* void init (in imgIRequest aRequest); */
NS_IMETHODIMP nsGIFDecoder2::Init(imgIRequest *aRequest)
{
mImageRequest = aRequest;
mObserver = do_QueryInterface(aRequest); // we're holding 2 strong refs to the request.
aRequest->GetImage(getter_AddRefs(mImageContainer));
/* do gif init stuff */
/* Always decode to 24 bit pixdepth */
PRBool created = gif_create(&mGIFStruct);
NS_ASSERTION(created, "gif_create failed");
// Call GIF decoder init routine
GIFInit(
mGIFStruct,
this,
NewPixmap,
BeginGIF,
EndGIF,
BeginImageFrame,
EndImageFrame,
SetupColorspaceConverter,
ResetPalette,
InitTransparentPixel,
DestroyTransparentPixel,
HaveDecodedRow,
HaveImageAll);
return NS_OK;
}
//******************************************************************************
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsGIFDecoder2::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mImageRequest;
NS_IF_ADDREF(*aRequest);
return NS_OK;
}
//******************************************************************************
/** nsIOutputStream methods **/
//******************************************************************************
//******************************************************************************
/* void close (); */
NS_IMETHODIMP nsGIFDecoder2::Close()
{
if (mGIFStruct) {
gif_destroy(mGIFStruct);
mGIFStruct = nsnull;
}
return NS_OK;
}
//******************************************************************************
/* void flush (); */
NS_IMETHODIMP nsGIFDecoder2::Flush()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsGIFDecoder2::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* static callback from nsIInputStream::ReadSegments */
static NS_METHOD ReadDataOut(nsIInputStream* in,
void* closure,
const char* fromRawSegment,
PRUint32 toOffset,
PRUint32 count,
PRUint32 *writeCount)
{
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, closure);
*writeCount = decoder->ProcessData((unsigned char*)fromRawSegment, count);
return NS_OK;
}
//******************************************************************************
PRUint32 nsGIFDecoder2::ProcessData(unsigned char *data, PRUint32 count)
{
// Push the data to the GIF decoder
// First we ask if the gif decoder is ready for more data, and if so, push it.
// In the new decoder, we should always be able to process more data since
// we don't wait to decode each frame in an animation now.
if(gif_write_ready(mGIFStruct)) {
gif_write(mGIFStruct, data, count);
}
return count; // we always consume all the data
}
//******************************************************************************
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP nsGIFDecoder2::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
inStr->ReadSegments(
ReadDataOut, // Callback
this,
count,
_retval);
// if error
//mRequest->Cancel(NS_BINDING_ABORTED); // XXX is this the correct error ?
return NS_OK;
}
//******************************************************************************
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsGIFDecoder2::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsGIFDecoder2::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
NS_IMETHODIMP nsGIFDecoder2::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsGIFDecoder2::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
NS_IMETHODIMP nsGIFDecoder2::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
// GIF decoder callback methods. Part of pulic API for GIF2
//******************************************************************************
//******************************************************************************
int BeginGIF(
void* aClientData,
PRUint32 aLogicalScreenWidth,
PRUint32 aLogicalScreenHeight,
PRUint8 aBackgroundRGBIndex)
{
// copy GIF info into imagelib structs
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
if (decoder->mObserver)
decoder->mObserver->OnStartDecode(nsnull, nsnull);
decoder->mImageContainer->Init(aLogicalScreenWidth, aLogicalScreenHeight, decoder->mObserver);
if (decoder->mObserver)
decoder->mObserver->OnStartContainer(nsnull, nsnull, decoder->mImageContainer);
return 0;
}
//******************************************************************************
int EndGIF(
void* aClientData,
int aAnimationLoopCount)
{
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
if (decoder->mObserver) {
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImageContainer);
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
decoder->mImageContainer->SetLoopCount(aAnimationLoopCount);
decoder->mImageContainer->DecodingComplete();
return 0;
}
//******************************************************************************
int BeginImageFrame(
void* aClientData,
PRUint32 aFrameNumber, /* Frame number, 1-n */
PRUint32 aFrameXOffset, /* X offset in logical screen */
PRUint32 aFrameYOffset, /* Y offset in logical screen */
PRUint32 aFrameWidth,
PRUint32 aFrameHeight,
GIF_RGB* aTransparencyChromaKey) /* don't have this info yet */
{
nsGIFDecoder2* decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
decoder->mImageFrame = nsnull; // clear out our current frame reference
decoder->mGIFStruct->x_offset = aFrameXOffset;
decoder->mGIFStruct->y_offset = aFrameYOffset;
decoder->mGIFStruct->width = aFrameWidth;
decoder->mGIFStruct->height = aFrameHeight;
return 0;
}
//******************************************************************************
int EndImageFrame(
void* aClientData,
PRUint32 aFrameNumber,
PRUint32 aDelayTimeout) /* Time this frame should be displayed before the next frame
we can't have this in the image frame init because it doesn't
show up in the GIF frame header, it shows up in a sub control
block.*/
{
nsGIFDecoder2* decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
// We actually have the timeout information before we get the lzw encoded image
// data, at least according to the spec, but we delay in setting the timeout for
// the image until here to help ensure that we have the whole image frame decoded before
// we go off and try to display another frame.
// XXXXXXXX
// decoder->mImageFrame->SetTimeout(aDelayTimeout);
decoder->mImageContainer->EndFrameDecode(aFrameNumber, aDelayTimeout);
if (decoder->mObserver)
decoder->mObserver->OnStopFrame(nsnull, nsnull, decoder->mImageFrame);
decoder->mImageFrame = nsnull;
return 0;
}
//******************************************************************************
// GIF decoder callback
int HaveImageAll(
void* aClientData)
{
return 0;
}
//******************************************************************************
// GIF decoder callback notification that it has decoded a row
int HaveDecodedRow(
void* aClientData,
PRUint8* aRowBufPtr, // Pointer to single scanline temporary buffer
PRUint8* aRGBrowBufPtr,// Pointer to temporary storage for dithering/mapping
int aXOffset, // With respect to GIF logical screen origin
int aLength, // Length of the row?
int aRowNumber, // Row number?
int aDuplicateCount, // Number of times to duplicate the row?
PRUint8 aDrawMode, // il_draw_mode
int aInterlacePass) // interlace pass (1-4)
{
nsGIFDecoder2* decoder = NS_STATIC_CAST(nsGIFDecoder2*, aClientData);
PRUint32 bpr, abpr;
// We have to delay allocation of the image frame until now because
// we won't have control block info (transparency) until now. The conrol
// block of a GIF stream shows up after the image header since transparency
// is added in GIF89a and control blocks are how the extensions are done.
// How annoying.
if(! decoder->mImageFrame) {
gfx_format format = gfxIFormats::RGB;
if (decoder->mGIFStruct->is_transparent)
format = gfxIFormats::RGB_A1;
#ifdef XP_PC
// XXX this works...
format += 1; // RGB to BGR
#endif
// initalize the frame and append it to the container
decoder->mImageFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
decoder->mImageFrame->Init(
decoder->mGIFStruct->x_offset, decoder->mGIFStruct->y_offset,
decoder->mGIFStruct->width, decoder->mGIFStruct->height, format);
decoder->mImageContainer->AppendFrame(decoder->mImageFrame);
if (decoder->mObserver)
decoder->mObserver->OnStartFrame(nsnull, nsnull, decoder->mImageFrame);
decoder->mImageFrame->GetImageBytesPerRow(&bpr);
decoder->mImageFrame->GetAlphaBytesPerRow(&abpr);
if (format == gfxIFormats::RGB_A1 || format == gfxIFormats::BGR_A1) {
if (decoder->mAlphaLine)
nsMemory::Free(decoder->mAlphaLine);
decoder->mAlphaLine = (PRUint8 *)nsMemory::Alloc(abpr);
}
} else {
decoder->mImageFrame->GetImageBytesPerRow(&bpr);
decoder->mImageFrame->GetAlphaBytesPerRow(&abpr);
}
if (aRowBufPtr) {
nscoord width;
decoder->mImageFrame->GetWidth(&width);
PRUint32 iwidth = width;
gfx_format format;
decoder->mImageFrame->GetFormat(&format);
// XXX map the data into colors
int cmapsize;
GIF_RGB* cmap;
if(decoder->mGIFStruct->local_colormap) {
cmapsize = decoder->mGIFStruct->local_colormap_size;
cmap = decoder->mGIFStruct->local_colormap;
} else {
cmapsize = decoder->mGIFStruct->global_colormap_size;
cmap = decoder->mGIFStruct->global_colormap;
}
PRUint8* rgbRowIndex = aRGBrowBufPtr;
PRUint8* rowBufIndex = aRowBufPtr;
switch (format) {
case gfxIFormats::RGB:
{
while(rowBufIndex != decoder->mGIFStruct->rowend) {
#ifdef XP_MAC
*rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad
#endif
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].blue;
++rowBufIndex;
}
decoder->mImageFrame->SetImageData((PRUint8*)aRGBrowBufPtr, bpr, aRowNumber*bpr);
}
break;
case gfxIFormats::BGR:
{
while(rowBufIndex != decoder->mGIFStruct->rowend) {
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].blue;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
++rowBufIndex;
}
decoder->mImageFrame->SetImageData((PRUint8*)aRGBrowBufPtr, bpr, aRowNumber*bpr);
}
break;
case gfxIFormats::RGB_A1:
case gfxIFormats::BGR_A1:
{
memset(aRGBrowBufPtr, 0, bpr);
memset(decoder->mAlphaLine, 0, abpr);
PRUint32 iwidth = (PRUint32)width;
for (PRUint32 x=0; x<iwidth; x++) {
if (*rowBufIndex != decoder->mGIFStruct->tpixel) {
#ifdef XP_PC
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].blue;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
#else
#ifdef XP_MAC
*rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad
#endif
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].red;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].green;
*rgbRowIndex++ = cmap[PRUint8(*rowBufIndex)].blue;
#endif
decoder->mAlphaLine[x>>3] |= 1<<(7-x&0x7);
} else {
#ifdef XP_MAC
rgbRowIndex+=4;
#else
rgbRowIndex+=3;
#endif
}
++rowBufIndex;
}
decoder->mImageFrame->SetImageData((PRUint8*)aRGBrowBufPtr, bpr, aRowNumber*bpr);
decoder->mImageFrame->SetAlphaData(decoder->mAlphaLine, abpr, aRowNumber*abpr);
}
break;
default:
break;
}
nsRect r(0, aRowNumber, width, 1);
decoder->mObserver->OnDataAvailable(nsnull, nsnull, decoder->mImageFrame, &r);
}
return 0;
}
//******************************************************************************
int ResetPalette()
{
return 0;
}
//******************************************************************************
int SetupColorspaceConverter()
{
return 0;
}
//******************************************************************************
int EndImageFrame()
{
return 0;
}
//******************************************************************************
int NewPixmap()
{
return 0;
}
//******************************************************************************
int InitTransparentPixel()
{
return 0;
}
//******************************************************************************
int DestroyTransparentPixel()
{
return 0;
}

View File

@@ -0,0 +1,114 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Chris Saari <saari@netscape.com>
*/
#ifndef _nsGIFDecoder2_h
#define _nsGIFDecoder2_h
#include "nsCOMPtr.h"
#include "imgIDecoder.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgIRequest.h"
#include "GIF2.h"
#define NS_GIFDECODER2_CID \
{ /* 797bec5a-1dd2-11b2-a7f8-ca397e0179c4 */ \
0x797bec5a, \
0x1dd2, \
0x11b2, \
{0xa7, 0xf8, 0xca, 0x39, 0x7e, 0x01, 0x79, 0xc4} \
}
//////////////////////////////////////////////////////////////////////
// nsGIFDecoder2 Definition
class nsGIFDecoder2 : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsGIFDecoder2();
virtual ~nsGIFDecoder2();
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
NS_METHOD ProcessData(unsigned char *data, PRUint32 count);
nsCOMPtr<imgIContainer> mImageContainer;
nsCOMPtr<gfxIImageFrame> mImageFrame;
nsCOMPtr<imgIRequest> mImageRequest;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
gif_struct *mGIFStruct;
PRUint8 *mAlphaLine;
};
// static callbacks for the GIF decoder
static int PR_CALLBACK BeginGIF(
void* aClientData,
PRUint32 aLogicalScreenWidth,
PRUint32 aLogicalScreenHeight,
PRUint8 aBackgroundRGBIndex);
static int PR_CALLBACK HaveDecodedRow(
void* aClientData,
PRUint8* aRowBufPtr, // Pointer to single scanline temporary buffer
PRUint8* aRGBrowBufPtr,// Pointer to temporary storage for dithering/mapping
int aXOffset, // With respect to GIF logical screen origin
int aLength, // Length of the row?
int aRow, // Row number?
int aDuplicateCount, // Number of times to duplicate the row?
PRUint8 aDrawMode, // il_draw_mode
int aInterlacePass);
static int PR_CALLBACK NewPixmap();
static int PR_CALLBACK EndGIF(
void* aClientData,
int aAnimationLoopCount);
static int PR_CALLBACK BeginImageFrame(
void* aClientData,
PRUint32 aFrameNumber, /* Frame number, 1-n */
PRUint32 aFrameXOffset, /* X offset in logical screen */
PRUint32 aFrameYOffset, /* Y offset in logical screen */
PRUint32 aFrameWidth,
PRUint32 aFrameHeight,
GIF_RGB* aTransparencyChromaKey);
static int PR_CALLBACK EndImageFrame(
void* aClientData,
PRUint32 aFrameNumber,
PRUint32 aDelayTimeout);
static int PR_CALLBACK SetupColorspaceConverter();
static int PR_CALLBACK ResetPalette();
static int PR_CALLBACK InitTransparentPixel();
static int PR_CALLBACK DestroyTransparentPixel();
static int PR_CALLBACK HaveImageAll(
void* aClientData);
#endif

View File

@@ -0,0 +1,41 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Chris Saari <saari@netscape.com>
*/
#include "nsGIFDecoder2.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIFDecoder2)
static nsModuleComponentInfo components[] =
{
{ "GIF Decoder",
NS_GIFDECODER2_CID,
"@mozilla.org/image/decoder;2?type=image/gif",
nsGIFDecoder2Constructor, },
};
NS_IMPL_NSGETMODULE("nsGIFModule2", components)

View File

@@ -0,0 +1,18 @@
?AddRef@nsGIFDecoder2@@UAGKXZ ; 2550
?Release@nsGIFDecoder2@@UAGKXZ ; 2550
?gif_write_ready@@YAEPAUgif_struct@@@Z ; 1624
?ProcessData@nsGIFDecoder2@@QAGIPAEI@Z ; 1624
?gif_write@@YAHPAUgif_struct@@PBEI@Z ; 1624
?WriteFrom@nsGIFDecoder2@@UAGIPAVnsIInputStream@@IPAI@Z ; 1309
?Close@nsGIFDecoder2@@UAGIXZ ; 1275
??_GnsGIFDecoder2@@UAEPAXI@Z ; 1275
??0nsGIFDecoder2@@QAE@XZ ; 1275
??1nsGIFDecoder2@@UAE@XZ ; 1275
?QueryInterface@nsGIFDecoder2@@UAGIABUnsID@@PAPAX@Z ; 1275
?GIFInit@@YAHPAUgif_struct@@PAXP6AHXZP6AH1IIE@ZP6AH1H@ZP6AH1IIIIIPAU_GIF_RGB@@@ZP6AH1II@Z2222P6AH1PAE8HHHHEH@ZP6AH1@Z@Z ; 1275
?Init@nsGIFDecoder2@@UAGIPAVimgIRequest@@@Z ; 1275
?Flush@nsGIFDecoder2@@UAGIXZ ; 1275
?gif_destroy@@YAXPAUgif_struct@@@Z ; 1275
?gif_create@@YAHPAPAUgif_struct@@@Z ; 1275
?il_BACat@@YAPADPAPADIPBDI@Z ; 698
_NSGetModule ; 1

View File

@@ -0,0 +1,378 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#include "nsIconChannel.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsXPIDLString.h"
#include "nsMimeTypes.h"
#include "nsMemory.h"
#include "nsIStringStream.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIMimeService.h"
#include "nsCExternalHandlerService.h"
#include "plstr.h"
#include <Files.h>
#include <QuickDraw.h>
// nsIconChannel methods
nsIconChannel::nsIconChannel()
{
NS_INIT_REFCNT();
mStatus = NS_OK;
}
nsIconChannel::~nsIconChannel()
{}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsIconChannel,
nsIChannel,
nsIRequest)
nsresult nsIconChannel::Init(nsIURI* uri)
{
nsresult rv;
NS_ASSERTION(uri, "no uri");
mUrl = uri;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
NS_IMETHODIMP nsIconChannel::GetName(PRUnichar* *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::IsPending(PRBool *result)
{
NS_NOTREACHED("nsIconChannel::IsPending");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::GetStatus(nsresult *status)
{
*status = mStatus;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::Cancel(nsresult status)
{
NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code");
nsresult rv = NS_ERROR_FAILURE;
mStatus = status;
return rv;
}
NS_IMETHODIMP nsIconChannel::Suspend(void)
{
NS_NOTREACHED("nsIconChannel::Suspend");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::Resume(void)
{
NS_NOTREACHED("nsIconChannel::Resume");
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// nsIChannel methods:
NS_IMETHODIMP nsIconChannel::GetOriginalURI(nsIURI* *aURI)
{
*aURI = mOriginalURI ? mOriginalURI : mUrl;
NS_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetOriginalURI(nsIURI* aURI)
{
mOriginalURI = aURI;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetURI(nsIURI* *aURI)
{
*aURI = mUrl;
NS_IF_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetURI(nsIURI* aURI)
{
mUrl = aURI;
return NS_OK;
}
NS_IMETHODIMP
nsIconChannel::Open(nsIInputStream **_retval)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
{
// get the file name from the url
nsXPIDLCString fileName; // will contain a dummy file we'll use to figure out the type of icon desired.
nsXPIDLCString filePath; // will contain an optional parameter for small vs. large icon. default is small
mUrl->GetHost(getter_Copies(fileName));
nsCOMPtr<nsIURL> url (do_QueryInterface(mUrl));
if (url)
url->GetFileBaseName(getter_Copies(filePath));
nsresult rv = NS_OK;
nsCOMPtr<nsIMIMEService> mimeService (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// extract the extension out of the dummy file so we can look it up in the mime service.
char * chFileName = fileName.get(); // get the underlying buffer
char * fileExtension = PL_strrchr(chFileName, '.');
if (!fileExtension) return NS_ERROR_FAILURE; // no file extension to work from.
// look the file extension up in the registry.
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mimeService->GetFromExtension(fileExtension, getter_AddRefs(mimeInfo));
NS_ENSURE_TRUE(mimeInfo, NS_ERROR_FAILURE);
// get the mac creator and file type for this mime object
PRUint32 macType;
PRUint32 macCreator;
mimeInfo->GetMacType(&macType);
mimeInfo->GetMacCreator(&macCreator);
// get a refernce to the desktop database
DTPBRec pb;
OSErr err = noErr;
memset(&pb, 0, sizeof(DTPBRec));
pb.ioCompletion = nil;
pb.ioVRefNum = 0; // default desktop volume
pb.ioNamePtr = nil;
err = PBDTGetPath(&pb);
if (err != noErr) return NS_ERROR_FAILURE;
pb.ioFileCreator = macCreator;
pb.ioFileType = macType;
pb.ioCompletion = nil;
pb.ioTagInfo = 0;
PRUint32 numPixelsInRow = 0;
if (filePath && !nsCRT::strcmp(filePath, "large"))
{
pb.ioDTReqCount = kLarge8BitIconSize;
pb.ioIconType = kLarge8BitIcon;
numPixelsInRow = 32;
}
else
{
pb.ioDTReqCount = kSmall8BitIconSize;
pb.ioIconType = kSmall8BitIcon;
numPixelsInRow = 16;
}
// allocate a buffer large enough to handle the icon
PRUint8 * bitmapData = (PRUint8 *) nsMemory::Alloc (pb.ioDTReqCount);
pb.ioDTBuffer = (Ptr) bitmapData;
err = PBDTGetIcon(&pb, false);
if (err != noErr) return NS_ERROR_FAILURE; // unable to fetch the icon....
nsCString iconBuffer;
iconBuffer.Assign((char) numPixelsInRow);
iconBuffer.Append((char) numPixelsInRow);
CTabHandle cTabHandle = GetCTable(72);
if (!cTabHandle) return NS_ERROR_FAILURE;
HLock((Handle) cTabHandle);
CTabPtr colTable = *cTabHandle;
RGBColor rgbCol;
PRUint8 redValue, greenValue, blueValue;
for (PRUint32 index = 0; index < pb.ioDTReqCount; index ++)
{
// each byte in bitmapData needs to be converted from an 8 bit system color into
// 24 bit RGB data which our special icon image decoder can understand.
ColorSpec colSpec = colTable->ctTable[ bitmapData[index]];
rgbCol = colSpec.rgb;
redValue = rgbCol.red & 0xff;
greenValue = rgbCol.green & 0xff;
blueValue = rgbCol.blue & 0xff;
// for some reason the image code on the mac expects each RGB pixel value to be padded with a preceding byte.
// so add the padding here....
iconBuffer.Append((char) 0);
iconBuffer.Append((char) redValue);
iconBuffer.Append((char) greenValue);
iconBuffer.Append((char) blueValue);
}
HUnlock((Handle) cTabHandle);
DisposeCTable(cTabHandle);
nsMemory::Free(bitmapData);
// now that the color bitmask is taken care of, we need to do the same thing again for the transparency
// bit mask....
if (filePath && !nsCRT::strcmp(filePath, "large"))
{
pb.ioDTReqCount = kLargeIconSize;
pb.ioIconType = kLargeIcon;
}
else
{
pb.ioDTReqCount = kSmallIconSize;
pb.ioIconType = kSmallIcon;
}
// allocate a buffer large enough to handle the icon
bitmapData = (PRUint8 *) nsMemory::Alloc (pb.ioDTReqCount);
pb.ioDTBuffer = (Ptr) bitmapData;
err = PBDTGetIcon(&pb, false);
PRUint32 index = pb.ioDTReqCount/2;
while (index < pb.ioDTReqCount)
{
iconBuffer.Append((char) bitmapData[index]);
iconBuffer.Append((char) bitmapData[index + 1]);
if (numPixelsInRow == 32)
{
iconBuffer.Append((char) bitmapData[index + 2]);
iconBuffer.Append((char) bitmapData[index + 3]);
index += 4;
}
else
{
iconBuffer.Append((char) 255); // 2 bytes of padding
iconBuffer.Append((char) 255);
index += 2;
}
}
nsMemory::Free(bitmapData);
// turn our nsString into a stream looking object...
aListener->OnStartRequest(this, ctxt);
// turn our string into a stream...
nsCOMPtr<nsISupports> streamSupports;
NS_NewByteInputStream(getter_AddRefs(streamSupports), iconBuffer.get(), iconBuffer.Length());
nsCOMPtr<nsIInputStream> inputStr (do_QueryInterface(streamSupports));
aListener->OnDataAvailable(this, ctxt, inputStr, 0, iconBuffer.Length());
aListener->OnStopRequest(this, ctxt, NS_OK, nsnull);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadAttributes = aLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetContentType(char* *aContentType)
{
if (!aContentType) return NS_ERROR_NULL_POINTER;
*aContentType = nsCRT::strdup("image/icon");
if (!*aContentType) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsIconChannel::SetContentType(const char *aContentType)
{
//It doesn't make sense to set the content-type on this type
// of channel...
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
{
*aLoadGroup = mLoadGroup;
NS_IF_ADDREF(*aLoadGroup);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
{
mLoadGroup = aLoadGroup;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetOwner(nsISupports* *aOwner)
{
*aOwner = mOwner.get();
NS_IF_ADDREF(*aOwner);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
{
mOwner = aOwner;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{
*aNotificationCallbacks = mCallbacks.get();
NS_IF_ADDREF(*aNotificationCallbacks);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
{
mCallbacks = aNotificationCallbacks;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
*aSecurityInfo = nsnull;
return NS_OK;
}

View File

@@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#ifndef nsIconChannel_h___
#define nsIconChannel_h___
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsIInterfaceRequestor.h"
#include "nsIURI.h"
class nsIconChannel : public nsIChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUEST
NS_DECL_NSICHANNEL
nsIconChannel();
virtual ~nsIconChannel();
nsresult Init(nsIURI* uri);
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRUint32 mLoadAttributes;
PRInt32 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;
nsresult mStatus;
};
#endif /* nsIconChannel_h___ */

View File

@@ -0,0 +1,62 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Scott MacGregor <mscott@netscape.com>
#
DEPTH=..\..\..\..
include <$(DEPTH)/config/config.mak>
DIR=win
MODULE = imgicon
LIBRARY_NAME = imgicon
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\nsIconDecoder.obj \
.\$(OBJDIR)\nsIconModule.obj \
.\$(OBJDIR)\nsIconProtocolHandler.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\imgiconwin_s.lib \
$(NULL)
WIN_LIBS= shell32.lib
INCS = $(INCS) \
-I$(DEPTH)\dist\include \
-I$(DEPTH)\modules\libpr0n\decoders\icon\win \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,195 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*
*/
#include "nsIconDecoder.h"
#include "nsIInputStream.h"
#include "imgIContainer.h"
#include "imgIContainerObserver.h"
#include "nspr.h"
#include "nsIComponentManager.h"
#include "nsRect.h"
NS_IMPL_THREADSAFE_ADDREF(nsIconDecoder);
NS_IMPL_THREADSAFE_RELEASE(nsIconDecoder);
NS_INTERFACE_MAP_BEGIN(nsIconDecoder)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
NS_INTERFACE_MAP_ENTRY(imgIDecoder)
NS_INTERFACE_MAP_END_THREADSAFE
nsIconDecoder::nsIconDecoder()
{
NS_INIT_ISUPPORTS();
}
nsIconDecoder::~nsIconDecoder()
{ }
/** imgIDecoder methods **/
NS_IMETHODIMP nsIconDecoder::Init(imgIRequest *aRequest)
{
mRequest = aRequest;
mObserver = do_QueryInterface(aRequest); // we're holding 2 strong refs to the request.
aRequest->GetImage(getter_AddRefs(mImage));
mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
if (!mFrame) return NS_ERROR_FAILURE;
return NS_OK;
}
NS_IMETHODIMP nsIconDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/
NS_IMETHODIMP nsIconDecoder::Close()
{
if (mObserver)
{
mObserver->OnStopFrame(nsnull, nsnull, mFrame);
mObserver->OnStopContainer(nsnull, nsnull, mImage);
mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
return NS_OK;
}
NS_IMETHODIMP nsIconDecoder::Flush()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
nsresult rv;
char *buf = (char *)PR_Malloc(count);
if (!buf) return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
// read the data from the input stram...
PRUint32 readLen;
rv = inStr->Read(buf, count, &readLen);
char *data = buf;
if (NS_FAILED(rv)) return rv;
// since WriteFrom is only called once, go ahead and fire the on start notifications..
mObserver->OnStartDecode(nsnull, nsnull);
PRUint32 i = 0;
// Read size
PRInt32 w, h;
w = data[0];
h = data[1];
data += 2;
readLen -= i + 2;
mImage->Init(w, h, mObserver);
if (mObserver)
mObserver->OnStartContainer(nsnull, nsnull, mImage);
mFrame->Init(0, 0, w, h, gfxIFormats::RGB_A1);
mImage->AppendFrame(mFrame);
if (mObserver)
mObserver->OnStartFrame(nsnull, nsnull, mFrame);
PRUint32 bpr, abpr;
nscoord width, height;
mFrame->GetImageBytesPerRow(&bpr);
mFrame->GetAlphaBytesPerRow(&abpr);
mFrame->GetWidth(&width);
mFrame->GetHeight(&height);
i = 0;
PRInt32 rownum = 0; // XXX this better not have a decimal
PRInt32 wroteLen = 0;
do
{
PRUint8 *line = (PRUint8*)data + i*bpr;
mFrame->SetImageData(line, bpr, (rownum++)*bpr);
nsRect r(0, rownum, width, 1);
mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r);
wroteLen += bpr ;
i++;
} while(rownum < height);
// now we want to send in the alpha data...
for (rownum = 0; rownum < height; rownum ++)
{
PRUint8 * line = (PRUint8*) data + abpr * rownum + height*bpr;
mFrame->SetAlphaData(line, abpr, (rownum)*abpr);
}
PR_FREEIF(buf);
return NS_OK;
}
NS_IMETHODIMP nsIconDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#ifndef nsIconDecoder_h__
#define nsIconDecoder_h__
#include "imgIDecoder.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgIRequest.h"
#define NS_ICONDECODER_CID \
{ /* FFC08380-256C-11d5-9905-001083010E9B */ \
0xffc08380, \
0x256c, \
0x11d5, \
{ 0x99, 0x5, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } \
}
//////////////////////////////////////////////////////////////////////////////////////////////
// The icon decoder is a decoder specifically tailored for loading icons
// from the OS. We've defined our own little format to represent these icons
// and this decoder takes that format and converts it into 24-bit RGB with alpha channel
// support. It was modeled a bit off the PPM decoder.
//
// Assumptions about the decoder:
// (1) We receive ALL of the data from the icon channel in one OnDataAvailable call. We don't
// support multiple ODA calls yet.
// (2) the format of the incoming data is as follows:
// The first two bytes contain the width and the height of the icon.
// Followed by 3 bytes per pixel for the color bitmap row after row. (for heigh * width * 3 bytes)
// Followed by bit mask data (used for transparency on the alpha channel).
//
//
//////////////////////////////////////////////////////////////////////////////////////////////
class nsIconDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsIconDecoder();
virtual ~nsIconDecoder();
private:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
};
#endif // nsIconDecoder_h__

View File

@@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "nsIconDecoder.h"
#include "nsIconProtocolHandler.h"
// objects that just require generic constructors
/******************************************************************************
* Protocol CIDs
*/
#define NS_ICONPROTOCOL_CID { 0xd0f9db12, 0x249c, 0x11d5, { 0x99, 0x5, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } }
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIconDecoder)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIconProtocolHandler)
static nsModuleComponentInfo components[] =
{
{ "icon decoder",
NS_ICONDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/icon",
nsIconDecoderConstructor, },
{ "Icon Protocol Handler",
NS_ICONPROTOCOL_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "icon",
nsIconProtocolHandlerConstructor
}
};
NS_IMPL_NSGETMODULE("nsIconDecoderModule", components)

View File

@@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#include "nsIconChannel.h"
#include "nsIconProtocolHandler.h"
#include "nsIURL.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kStandardURICID, NS_STANDARDURL_CID);
////////////////////////////////////////////////////////////////////////////////
nsIconProtocolHandler::nsIconProtocolHandler()
{
NS_INIT_REFCNT();
}
nsIconProtocolHandler::~nsIconProtocolHandler()
{}
NS_IMPL_ISUPPORTS2(nsIconProtocolHandler, nsIProtocolHandler, nsISupportsWeakReference)
////////////////////////////////////////////////////////////////////////////////
// nsIProtocolHandler methods:
NS_IMETHODIMP nsIconProtocolHandler::GetScheme(char* *result)
{
*result = nsCRT::strdup("icon");
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP nsIconProtocolHandler::GetDefaultPort(PRInt32 *result)
{
*result = 0;
return NS_OK;
}
NS_IMETHODIMP nsIconProtocolHandler::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **result)
{
nsresult rv;
// no concept of a relative icon url
NS_ASSERTION(!aBaseURI, "base url passed into icon protocol handler");
nsCOMPtr<nsIURI> url = do_CreateInstance(kStandardURICID, &rv);
if (NS_FAILED(rv)) return rv;
rv = url->SetSpec((char*)aSpec);
*result = url;
NS_IF_ADDREF(*result);
return rv;
}
NS_IMETHODIMP nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
{
nsCOMPtr<nsIChannel> channel;
NS_NEWXPCOM(channel, nsIconChannel);
if (channel)
NS_STATIC_CAST(nsIconChannel*,NS_STATIC_CAST(nsIChannel*, channel))->Init(url);
*result = channel;
NS_IF_ADDREF(*result);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,43 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#ifndef nsIconProtocolHandler_h___
#define nsIconProtocolHandler_h___
#include "nsWeakReference.h"
#include "nsIProtocolHandler.h"
class nsIconProtocolHandler : public nsIProtocolHandler, public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROTOCOLHANDLER
// nsIconProtocolHandler methods:
nsIconProtocolHandler();
virtual ~nsIconProtocolHandler();
protected:
};
#endif /* nsIconProtocolHandler_h___ */

View File

@@ -0,0 +1,46 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Scott MacGregor <mscott@netscape.com>
DEPTH=..\..\..\..\..
MODULE=imgicon
LIBRARY_NAME=imgiconwin_s
CPP_OBJS=\
.\$(OBJDIR)\nsIconChannel.obj \
$(NULL)
INCS = $(INCS) \
-I$(DEPTH)\dist\include \
-I..\ \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
clobber::
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,377 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#include "nsIconChannel.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsXPIDLString.h"
#include "nsMimeTypes.h"
#include "nsMemory.h"
#include "nsIStringStream.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
// we need windows.h to read out registry information...
#include <windows.h>
#include <shellapi.h>
// nsIconChannel methods
nsIconChannel::nsIconChannel()
{
NS_INIT_REFCNT();
mStatus = NS_OK;
}
nsIconChannel::~nsIconChannel()
{}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsIconChannel,
nsIChannel,
nsIRequest)
nsresult nsIconChannel::Init(nsIURI* uri)
{
nsresult rv;
NS_ASSERTION(uri, "no uri");
mUrl = uri;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
NS_IMETHODIMP nsIconChannel::GetName(PRUnichar* *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::IsPending(PRBool *result)
{
NS_NOTREACHED("nsIconChannel::IsPending");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::GetStatus(nsresult *status)
{
*status = mStatus;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::Cancel(nsresult status)
{
NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code");
nsresult rv = NS_ERROR_FAILURE;
mStatus = status;
return rv;
}
NS_IMETHODIMP nsIconChannel::Suspend(void)
{
NS_NOTREACHED("nsIconChannel::Suspend");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::Resume(void)
{
NS_NOTREACHED("nsIconChannel::Resume");
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// nsIChannel methods:
NS_IMETHODIMP nsIconChannel::GetOriginalURI(nsIURI* *aURI)
{
*aURI = mOriginalURI ? mOriginalURI : mUrl;
NS_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetOriginalURI(nsIURI* aURI)
{
mOriginalURI = aURI;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetURI(nsIURI* *aURI)
{
*aURI = mUrl;
NS_IF_ADDREF(*aURI);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetURI(nsIURI* aURI)
{
mUrl = aURI;
return NS_OK;
}
NS_IMETHODIMP
nsIconChannel::Open(nsIInputStream **_retval)
{
return NS_ERROR_FAILURE;
}
void InvertRows(unsigned char * aInitialBuffer, PRUint32 sizeOfBuffer, PRUint32 numBytesPerRow)
{
PRUint32 numRows = sizeOfBuffer / numBytesPerRow;
void * temporaryRowHolder = (void *) nsMemory::Alloc(numBytesPerRow);
PRUint32 currentRow = 0;
PRUint32 lastRow = (numRows - 1) * numBytesPerRow;
while (currentRow < lastRow)
{
// store the current row into a temporary buffer
nsCRT::memcpy(temporaryRowHolder, (void *) &aInitialBuffer[currentRow], numBytesPerRow);
nsCRT::memcpy((void *) &aInitialBuffer[currentRow], (void *)&aInitialBuffer[lastRow], numBytesPerRow);
nsCRT::memcpy((void *) &aInitialBuffer[lastRow], temporaryRowHolder, numBytesPerRow);
lastRow -= numBytesPerRow;
currentRow += numBytesPerRow;
}
}
NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
{
// get the file name from the url
nsXPIDLCString fileName; // will contain a dummy file we'll use to figure out the type of icon desired.
nsXPIDLCString filePath; // will contain an optional parameter for small vs. large icon. default is small
mUrl->GetHost(getter_Copies(fileName));
nsCOMPtr<nsIURL> url (do_QueryInterface(mUrl));
if (url)
url->GetFileBaseName(getter_Copies(filePath));
// 1) get a hIcon for the file.
SHFILEINFO sfi;
UINT infoFlags = SHGFI_USEFILEATTRIBUTES | SHGFI_ICON;
if (filePath && !nsCRT::strcmp(filePath, "large"))
infoFlags |= SHGFI_LARGEICON;
else // default to small
infoFlags |= SHGFI_SMALLICON;
LONG result= SHGetFileInfo(fileName, FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
if (result > 0 && sfi.hIcon)
{
// we got a handle to an icon. Now we want to get a bitmap for the icon using GetIconInfo....
ICONINFO pIconInfo;
result = GetIconInfo(sfi.hIcon, &pIconInfo);
if (result > 0)
{
// now we have the bit map we need to get info about the bitmap
BITMAPINFO pBitMapInfo;
BITMAPINFOHEADER pBitMapInfoHeader;
pBitMapInfo.bmiHeader.biBitCount = 0;
pBitMapInfo.bmiHeader.biSize = sizeof(pBitMapInfoHeader);
HDC pDC = CreateCompatibleDC(NULL); // get a device context for the screen.
result = GetDIBits(pDC, pIconInfo.hbmColor, 0, 0, NULL, &pBitMapInfo, DIB_RGB_COLORS);
if (result > 0 && pBitMapInfo.bmiHeader.biSizeImage > 0)
{
// allocate a buffer to hold the bit map....this should be a buffer that's biSizeImage...
unsigned char * buffer = (PRUint8 *) nsMemory::Alloc(pBitMapInfo.bmiHeader.biSizeImage);
result = GetDIBits(pDC, pIconInfo.hbmColor, 0, pBitMapInfo.bmiHeader.biHeight, (void *) buffer, &pBitMapInfo, DIB_RGB_COLORS);
if (result > 0)
{
PRUint32 bytesPerPixel = pBitMapInfo.bmiHeader.biBitCount / 8;
InvertRows(buffer, pBitMapInfo.bmiHeader.biSizeImage, pBitMapInfo.bmiHeader.biWidth * bytesPerPixel);
// Convert our little icon buffer which is padded to 4 bytes per pixel into a nice 3 byte per pixel
// description.
nsCString iconBuffer;
iconBuffer.Assign((char) pBitMapInfo.bmiHeader.biWidth);
iconBuffer.Append((char) pBitMapInfo.bmiHeader.biHeight);
PRInt32 index = 0;
if (pBitMapInfo.bmiHeader.biBitCount == 16)
{
PRUint8 redValue, greenValue, blueValue, partialGreen;
while (index < pBitMapInfo.bmiHeader.biSizeImage)
{
DWORD dst=(DWORD) buffer[index];
PRUint16 num = 0;
num = (PRUint8) buffer[index];
num <<= 8;
num |= (PRUint8) buffer[index+1];
//blueValue = (PRUint8)((*dst)&(0x1F));
//greenValue = (PRUint8)(((*dst)>>5)&(0x1F));
//redValue = (PRUint8)(((*dst)>>10)&(0x1F));
redValue = ((PRUint32) (((float)(num & 0x7c00) / 0x7c00) * 0xFF0000) & 0xFF0000)>> 16;
greenValue = ((PRUint32)(((float)(num & 0x03E0) / 0x03E0) * 0x00FF00) & 0x00FF00)>> 8;
blueValue = ((PRUint32)(((float)(num & 0x001F) / 0x001F) * 0x0000FF) & 0x0000FF);
// now we have the right RGB values...
iconBuffer.Append((char) redValue);
iconBuffer.Append((char) greenValue);
iconBuffer.Append((char) blueValue);
index += bytesPerPixel;
}
}
else
{
while (index <pBitMapInfo.bmiHeader.biSizeImage)
{
iconBuffer.Append((char) buffer[index]);
iconBuffer.Append((char) buffer[index+1]);
iconBuffer.Append((char) buffer[index+2]);
index += bytesPerPixel;
}
}
// now we need to tack on the alpha data...which is hbmMask
pBitMapInfo.bmiHeader.biBitCount = 0;
pBitMapInfo.bmiHeader.biSize = sizeof(pBitMapInfoHeader);
result = GetDIBits(pDC, pIconInfo.hbmMask, 0, 0, NULL, &pBitMapInfo, DIB_RGB_COLORS);
if (result > 0 && pBitMapInfo.bmiHeader.biSizeImage > 0)
{
// allocate a buffer to hold the bit map....this should be a buffer that's biSizeImage...
unsigned char * maskBuffer = (PRUint8 *) nsMemory::Alloc(pBitMapInfo.bmiHeader.biSizeImage);
result = GetDIBits(pDC, pIconInfo.hbmMask, 0, pBitMapInfo.bmiHeader.biHeight, (void *) maskBuffer, &pBitMapInfo, DIB_RGB_COLORS);
if (result > 0)
{
InvertRows(maskBuffer, pBitMapInfo.bmiHeader.biSizeImage, 4);
index = 0;
// for some reason the bit mask on windows are flipped from the values we really want for transparency.
// So complement each byte in the bit mask.
while (index < pBitMapInfo.bmiHeader.biSizeImage)
{
maskBuffer[index]^=255;
index += 1;
}
iconBuffer.Append((char *) maskBuffer, pBitMapInfo.bmiHeader.biSizeImage);
}
nsMemory::Free(maskBuffer);
} // if we have a mask buffer to apply
// turn our nsString into a stream looking object...
aListener->OnStartRequest(this, ctxt);
// turn our string into a stream...
nsCOMPtr<nsISupports> streamSupports;
NS_NewByteInputStream(getter_AddRefs(streamSupports), iconBuffer.get(), iconBuffer.Length());
nsCOMPtr<nsIInputStream> inputStr (do_QueryInterface(streamSupports));
aListener->OnDataAvailable(this, ctxt, inputStr, 0, iconBuffer.Length());
aListener->OnStopRequest(this, ctxt, NS_OK, nsnull);
} // if we got valid bits for the main bitmap mask
nsMemory::Free(buffer);
}
DeleteDC(pDC);
}
}
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadAttributes = aLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetContentType(char* *aContentType)
{
if (!aContentType) return NS_ERROR_NULL_POINTER;
*aContentType = nsCRT::strdup("image/icon");
if (!*aContentType) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP
nsIconChannel::SetContentType(const char *aContentType)
{
//It doesn't make sense to set the content-type on this type
// of channel...
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsIconChannel::GetContentLength(PRInt32 *aContentLength)
{
*aContentLength = mContentLength;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetContentLength(PRInt32 aContentLength)
{
NS_NOTREACHED("nsIconChannel::SetContentLength");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsIconChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
{
*aLoadGroup = mLoadGroup;
NS_IF_ADDREF(*aLoadGroup);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
{
mLoadGroup = aLoadGroup;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetOwner(nsISupports* *aOwner)
{
*aOwner = mOwner.get();
NS_IF_ADDREF(*aOwner);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
{
mOwner = aOwner;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{
*aNotificationCallbacks = mCallbacks.get();
NS_IF_ADDREF(*aNotificationCallbacks);
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
{
mCallbacks = aNotificationCallbacks;
return NS_OK;
}
NS_IMETHODIMP nsIconChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
*aSecurityInfo = nsnull;
return NS_OK;
}

View File

@@ -0,0 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Brian Ryner.
* Portions created by Brian Ryner are Copyright (C) 2000 Brian Ryner.
* All Rights Reserved.
*
* Contributor(s):
* Scott MacGregor <mscott@netscape.com>
*/
#ifndef nsIconChannel_h___
#define nsIconChannel_h___
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsIInterfaceRequestor.h"
#include "nsIURI.h"
class nsIconChannel : public nsIChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUEST
NS_DECL_NSICHANNEL
nsIconChannel();
virtual ~nsIconChannel();
nsresult Init(nsIURI* uri);
protected:
nsCOMPtr<nsIURI> mUrl;
nsCOMPtr<nsIURI> mOriginalURI;
PRUint32 mLoadAttributes;
PRInt32 mContentLength;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
nsCOMPtr<nsISupports> mOwner;
nsresult mStatus;
};
#endif /* nsIconChannel_h___ */

View File

@@ -0,0 +1,42 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imgjpeg
LIBRARY_NAME = imgjpeg
IS_COMPONENT = 1
REQUIRES = xpcom string necko layout jpeg gfx2 imglib2
CPPSRCS = nsJPEGDecoder.cpp nsJPEGFactory.cpp
EXTRA_DSO_LDOPTS = $(JPEG_LIBS) $(ZLIB_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,52 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imgjpeg
LIBRARY_NAME = imgjpeg
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\nsJPEGDecoder.obj \
.\$(OBJDIR)\nsJPEGFactory.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\jpeg3250.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,829 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*
*/
#include "nsJPEGDecoder.h"
#include "nsIInputStream.h"
#include "nspr.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "imgIContainerObserver.h"
#include "ImageLogging.h"
NS_IMPL_ISUPPORTS2(nsJPEGDecoder, imgIDecoder, nsIOutputStream)
#if defined(PR_LOGGING)
PRLogModuleInfo *gJPEGlog = PR_NewLogModule("JPEGDecoder");
#else
#define gJPEGlog
#endif
void PR_CALLBACK init_source (j_decompress_ptr jd);
boolean PR_CALLBACK fill_input_buffer (j_decompress_ptr jd);
void PR_CALLBACK skip_input_data (j_decompress_ptr jd, long num_bytes);
void PR_CALLBACK term_source (j_decompress_ptr jd);
void PR_CALLBACK my_error_exit (j_common_ptr cinfo);
/* Normal JFIF markers can't have more bytes than this. */
#define MAX_JPEG_MARKER_LENGTH (((PRUint32)1 << 16) - 1)
/* Possible states for JPEG source manager */
enum data_source_state {
READING_BACK = 0, /* Must be zero for init purposes */
READING_NEW
};
/*
* Implementation of a JPEG src object that understands our state machine
*/
typedef struct {
/* public fields; must be first in this struct! */
struct jpeg_source_mgr pub;
nsJPEGDecoder *decoder;
} decoder_source_mgr;
nsJPEGDecoder::nsJPEGDecoder()
{
NS_INIT_ISUPPORTS();
mState = JPEG_HEADER;
mFillState = READING_BACK;
mSamples = nsnull;
mSamples3 = nsnull;
mRGBPadRow = nsnull;
mRGBPadRowLength = 0;
mBytesToSkip = 0;
memset(&mInfo, 0, sizeof(jpeg_decompress_struct));
mCompletedPasses = 0;
mBuffer = nsnull;
mBufferLen = mBufferSize = 0;
mBackBuffer = nsnull;
mBackBufferLen = mBackBufferSize = mBackBufferUnreadLen = 0;
}
nsJPEGDecoder::~nsJPEGDecoder()
{
if (mBuffer)
PR_Free(mBuffer);
if (mBackBuffer)
PR_Free(mBackBuffer);
if (mRGBPadRow)
PR_Free(mRGBPadRow);
}
/** imgIDecoder methods **/
/* void init (in imgIRequest aRequest); */
NS_IMETHODIMP nsJPEGDecoder::Init(imgIRequest *aRequest)
{
mRequest = aRequest;
mObserver = do_QueryInterface(mRequest);
aRequest->GetImage(getter_AddRefs(mImage));
/* We set up the normal JPEG error routines, then override error_exit. */
mInfo.err = jpeg_std_error(&mErr.pub);
/* mInfo.err = jpeg_std_error(&mErr.pub); */
mErr.pub.error_exit = my_error_exit;
/* Establish the setjmp return context for my_error_exit to use. */
if (setjmp(mErr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
*/
return NS_ERROR_FAILURE;
}
/* Step 1: allocate and initialize JPEG decompression object */
jpeg_create_decompress(&mInfo);
decoder_source_mgr *src;
if (mInfo.src == NULL) {
//mInfo.src = PR_NEWZAP(decoder_source_mgr);
src = PR_NEWZAP(decoder_source_mgr);
if (!src) {
return PR_FALSE;
}
mInfo.src = (struct jpeg_source_mgr *) src;
}
/* Step 2: specify data source (eg, a file) */
/* Setup callback functions. */
src->pub.init_source = init_source;
src->pub.fill_input_buffer = fill_input_buffer;
src->pub.skip_input_data = skip_input_data;
src->pub.resync_to_restart = jpeg_resync_to_restart;
src->pub.term_source = term_source;
src->decoder = this;
return NS_OK;
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsJPEGDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/
/* void close (); */
NS_IMETHODIMP nsJPEGDecoder::Close()
{
PR_LOG(gJPEGlog, PR_LOG_DEBUG,
("[this=%p] nsJPEGDecoder::Close\n", this));
if (mState != JPEG_DONE && mState != JPEG_SINK_NON_JPEG_TRAILER)
NS_WARNING("Never finished decoding the JPEG.");
/* Step 8: Release JPEG decompression object */
/* This is an important step since it will release a good deal of memory. */
jpeg_destroy_decompress(&mInfo);
return NS_OK;
}
/* void flush (); */
NS_IMETHODIMP nsJPEGDecoder::Flush()
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::Flush");
PRUint32 ret;
if (mState != JPEG_DONE && mState != JPEG_SINK_NON_JPEG_TRAILER)
return this->WriteFrom(nsnull, 0, &ret);
return NS_OK;
}
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
LOG_SCOPE_WITH_PARAM(gJPEGlog, "nsJPEGDecoder::WriteFrom", "count", count);
/* We use our private extension JPEG error handler.
* Note that this struct must live as long as the main JPEG parameter
* struct, to avoid dangling-pointer problems.
*/
// XXX above what is this?
if (inStr) {
if (!mBuffer) {
mBuffer = (JOCTET *)PR_Malloc(count);
mBufferSize = count;
} else if (count > mBufferSize) {
mBuffer = (JOCTET *)PR_Realloc(mBuffer, count);
mBufferSize = count;
}
nsresult rv = inStr->Read((char*)mBuffer, count, &mBufferLen);
*_retval = mBufferLen;
//nsresult rv = mOutStream->WriteFrom(inStr, count, _retval);
NS_ASSERTION(NS_SUCCEEDED(rv), "nsJPEGDecoder::WriteFrom -- mOutStream->WriteFrom failed");
}
// else no input stream.. Flush() ?
nsresult error_code = NS_ERROR_FAILURE;
/* Return here if there is a fatal error. */
if ((error_code = setjmp(mErr.setjmp_buffer)) != 0) {
return error_code;
}
PR_LOG(gJPEGlog, PR_LOG_DEBUG,
("[this=%p] nsJPEGDecoder::WriteFrom -- processing JPEG data\n", this));
decoder_source_mgr *src = NS_REINTERPRET_CAST(decoder_source_mgr *, mInfo.src);
switch (mState) {
case JPEG_HEADER:
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- entering JPEG_HEADER case");
/* Step 3: read file parameters with jpeg_read_header() */
if (jpeg_read_header(&mInfo, TRUE) == JPEG_SUSPENDED)
return NS_OK; /* I/O suspension */
/*
* Don't allocate a giant and superfluous memory buffer
* when the image is a sequential JPEG.
*/
mInfo.buffered_image = jpeg_has_multiple_scans(&mInfo);
/* Used to set up image size so arrays can be allocated */
jpeg_calc_output_dimensions(&mInfo);
mObserver->OnStartDecode(nsnull, nsnull);
mImage->Init(mInfo.image_width, mInfo.image_height, mObserver);
mObserver->OnStartContainer(nsnull, nsnull, mImage);
mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
gfx_format format;
#ifdef XP_PC
format = gfxIFormats::BGR;
#else
format = gfxIFormats::RGB;
#endif
mFrame->Init(0, 0, mInfo.image_width, mInfo.image_height, format);
mImage->AppendFrame(mFrame);
mObserver->OnStartFrame(nsnull, nsnull, mFrame);
/*
* Make a one-row-high sample array that will go away
* when done with image. Always make it big enough to
* hold an RGB row. Since this uses the IJG memory
* manager, it must be allocated before the call to
* jpeg_start_compress().
*/
int row_stride;
if(mInfo.output_components == 1)
row_stride = mInfo.output_width;
else
row_stride = mInfo.output_width * 4; // use 4 instead of mInfo.output_components
// so we don't have to fuss with byte alignment.
// Mac wants 4 anyways.
mSamples = (*mInfo.mem->alloc_sarray)((j_common_ptr) &mInfo,
JPOOL_IMAGE,
row_stride, 1);
#if defined(XP_PC) || defined(XP_MAC)
// allocate buffer to do byte flipping if needed
if (mInfo.output_components == 3) {
mRGBPadRow = (PRUint8*) PR_MALLOC(row_stride);
mRGBPadRowLength = row_stride;
memset(mRGBPadRow, 0, mRGBPadRowLength);
}
#endif
/* Allocate RGB buffer for conversion from greyscale. */
if (mInfo.output_components != 3) {
row_stride = mInfo.output_width * 4;
mSamples3 = (*mInfo.mem->alloc_sarray)((j_common_ptr) &mInfo,
JPOOL_IMAGE,
row_stride, 1);
}
mState = JPEG_START_DECOMPRESS;
}
case JPEG_START_DECOMPRESS:
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- entering JPEG_START_DECOMPRESS case");
/* Step 4: set parameters for decompression */
/* FIXME -- Should reset dct_method and dither mode
* for final pass of progressive JPEG
*/
mInfo.dct_method = JDCT_FASTEST;
mInfo.dither_mode = JDITHER_ORDERED;
mInfo.do_fancy_upsampling = FALSE;
mInfo.enable_2pass_quant = FALSE;
mInfo.do_block_smoothing = TRUE;
/* Step 5: Start decompressor */
if (jpeg_start_decompress(&mInfo) == FALSE)
return NS_OK; /* I/O suspension */
/* If this is a progressive JPEG ... */
if (mInfo.buffered_image) {
mState = JPEG_DECOMPRESS_PROGRESSIVE;
} else {
mState = JPEG_DECOMPRESS_SEQUENTIAL;
}
}
case JPEG_DECOMPRESS_SEQUENTIAL:
{
if (mState == JPEG_DECOMPRESS_SEQUENTIAL)
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- JPEG_DECOMPRESS_SEQUENTIAL case");
if (OutputScanlines(-1) == PR_FALSE)
return NS_OK; /* I/O suspension */
/* If we've completed image output ... */
NS_ASSERTION(mInfo.output_scanline == mInfo.output_height, "We didn't process all of the data!");
mState = JPEG_DONE;
}
}
case JPEG_DECOMPRESS_PROGRESSIVE:
{
if (mState == JPEG_DECOMPRESS_PROGRESSIVE)
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- JPEG_DECOMPRESS_PROGRESSIVE case");
int status;
do {
status = jpeg_consume_input(&mInfo);
} while (!((status == JPEG_SUSPENDED) ||
(status == JPEG_REACHED_EOI)));
switch (status) {
case JPEG_REACHED_EOI:
// End of image
mState = JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT;
break;
case JPEG_SUSPENDED:
PR_LOG(gJPEGlog, PR_LOG_DEBUG,
("[this=%p] nsJPEGDecoder::WriteFrom -- suspending\n", this));
return NS_OK; /* I/O suspension */
default:
printf("got someo other state!?\n");
}
}
}
case JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT:
{
if (mState == JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT)
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- entering JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT case");
// XXX progressive? ;)
// not really progressive according to the state machine... -saari
jpeg_start_output(&mInfo, mInfo.input_scan_number);
if (OutputScanlines(-1) == PR_FALSE)
return NS_OK; /* I/O suspension */
jpeg_finish_output(&mInfo);
mState = JPEG_DONE;
}
}
case JPEG_DONE:
{
LOG_SCOPE(gJPEGlog, "nsJPEGDecoder::WriteFrom -- entering JPEG_DONE case");
/* Step 7: Finish decompression */
if (jpeg_finish_decompress(&mInfo) == FALSE)
return NS_OK; /* I/O suspension */
mState = JPEG_SINK_NON_JPEG_TRAILER;
/* we're done dude */
break;
}
case JPEG_SINK_NON_JPEG_TRAILER:
PR_LOG(gJPEGlog, PR_LOG_DEBUG,
("[this=%p] nsJPEGDecoder::WriteFrom -- entering JPEG_SINK_NON_JPEG_TRAILER case\n", this));
break;
}
return NS_OK;
}
int
nsJPEGDecoder::OutputScanlines(int num_scanlines)
{
int pass = 0;
if (mState == JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT)
pass = -1;
else
pass = mCompletedPasses + 1;
while ((mInfo.output_scanline < mInfo.output_height) && num_scanlines--) {
JSAMPROW samples;
/* Request one scanline. Returns 0 or 1 scanlines. */
int ns = jpeg_read_scanlines(&mInfo, mSamples, 1);
if (ns != 1) {
return PR_FALSE; /* suspend */
}
/* If grayscale image ... */
if (mInfo.output_components == 1) {
JSAMPLE j;
JSAMPLE *j1 = mSamples[0];
const JSAMPLE *j1end = j1 + mInfo.output_width;
JSAMPLE *j3 = mSamples3[0];
/* Convert from grayscale to RGB. */
while (j1 < j1end) {
#ifdef XP_MAC
j = *j1++;
j3[0] = 0;
j3[1] = j;
j3[2] = j;
j3[3] = j;
j3 += 4;
#else
j = *j1++;
j3[0] = j;
j3[1] = j;
j3[2] = j;
j3 += 3;
#endif
}
samples = mSamples3[0];
} else {
/* 24-bit color image */
#ifdef XP_PC
memset(mRGBPadRow, 0, mInfo.output_width * 4);
PRUint8 *ptrOutputBuf = mRGBPadRow;
JSAMPLE *j1 = mSamples[0];
for (PRUint32 i=0;i<mInfo.output_width;++i) {
ptrOutputBuf[2] = *j1++;
ptrOutputBuf[1] = *j1++;
ptrOutputBuf[0] = *j1++;
ptrOutputBuf += 3;
}
samples = mRGBPadRow;
#else
#ifdef XP_MAC
memset(mRGBPadRow, 0, mInfo.output_width * 4);
PRUint8 *ptrOutputBuf = mRGBPadRow;
JSAMPLE *j1 = mSamples[0];
for (PRUint32 i=0;i<mInfo.output_width;++i) {
ptrOutputBuf[0] = 0;
ptrOutputBuf[1] = *j1++;
ptrOutputBuf[2] = *j1++;
ptrOutputBuf[3] = *j1++;
ptrOutputBuf += 4;
}
samples = mRGBPadRow;
#else
samples = mSamples[0];
#endif
#endif
}
PRUint32 bpr;
mFrame->GetImageBytesPerRow(&bpr);
mFrame->SetImageData(
samples, // data
bpr, // length
(mInfo.output_scanline-1) * bpr); // offset
nsRect r(0, mInfo.output_scanline, mInfo.output_width, 1);
mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r);
}
return PR_TRUE;
}
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsJPEGDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsJPEGDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsJPEGDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsJPEGDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsJPEGDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* Override the standard error method in the IJG JPEG decoder code. */
void PR_CALLBACK
my_error_exit (j_common_ptr cinfo)
{
nsresult error_code = NS_ERROR_FAILURE;
decoder_error_mgr *err = (decoder_error_mgr *) cinfo->err;
#if 0
#ifdef DEBUG
/*ptn fix later */
if (il_debug >= 1) {
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(*cinfo->err->format_message) (cinfo, buffer);
ILTRACE(1,("%s\n", buffer));
}
#endif
/* Convert error to a browser error code */
if (cinfo->err->msg_code == JERR_OUT_OF_MEMORY)
error_code = MK_OUT_OF_MEMORY;
else
error_code = MK_IMAGE_LOSSAGE;
#endif
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(*cinfo->err->format_message) (cinfo, buffer);
fprintf(stderr, "my_error_exit()\n%s\n", buffer);
/* Return control to the setjmp point. */
longjmp(err->setjmp_buffer, error_code);
}
/******************************************************************************/
/*-----------------------------------------------------------------------------
* This is the callback routine from the IJG JPEG library used to supply new
* data to the decompressor when its input buffer is exhausted. It juggles
* multiple buffers in an attempt to avoid unnecessary copying of input data.
*
* (A simpler scheme is possible: It's much easier to use only a single
* buffer; when fill_input_buffer() is called, move any unconsumed data
* (beyond the current pointer/count) down to the beginning of this buffer and
* then load new data into the remaining buffer space. This approach requires
* a little more data copying but is far easier to get right.)
*
* At any one time, the JPEG decompressor is either reading from the necko
* input buffer, which is volatile across top-level calls to the IJG library,
* or the "backtrack" buffer. The backtrack buffer contains the remaining
* unconsumed data from the necko buffer after parsing was suspended due
* to insufficient data in some previous call to the IJG library.
*
* When suspending, the decompressor will back up to a convenient restart
* point (typically the start of the current MCU). The variables
* next_input_byte & bytes_in_buffer indicate where the restart point will be
* if the current call returns FALSE. Data beyond this point must be
* rescanned after resumption, so it must be preserved in case the decompressor
* decides to backtrack.
*
* Returns:
* TRUE if additional data is available, FALSE if no data present and
* the JPEG library should therefore suspend processing of input stream
*---------------------------------------------------------------------------*/
/******************************************************************************/
/* data source manager method
/******************************************************************************/
/******************************************************************************/
/* data source manager method
Initialize source. This is called by jpeg_read_header() before any
data is actually read. May leave
bytes_in_buffer set to 0 (in which case a fill_input_buffer() call
will occur immediately).
*/
void PR_CALLBACK
init_source (j_decompress_ptr jd)
{
}
/******************************************************************************/
/* data source manager method
Skip num_bytes worth of data. The buffer pointer and count should
be advanced over num_bytes input bytes, refilling the buffer as
needed. This is used to skip over a potentially large amount of
uninteresting data (such as an APPn marker). In some applications
it may be possible to optimize away the reading of the skipped data,
but it's not clear that being smart is worth much trouble; large
skips are uncommon. bytes_in_buffer may be zero on return.
A zero or negative skip count should be treated as a no-op.
*/
void PR_CALLBACK
skip_input_data (j_decompress_ptr jd, long num_bytes)
{
decoder_source_mgr *src = (decoder_source_mgr *)jd->src;
if (num_bytes > (long)src->pub.bytes_in_buffer) {
/*
* Can't skip it all right now until we get more data from
* network stream. Set things up so that fill_input_buffer
* will skip remaining amount.
*/
src->decoder->mBytesToSkip = (size_t)num_bytes - src->pub.bytes_in_buffer;
src->pub.next_input_byte += src->pub.bytes_in_buffer;
src->pub.bytes_in_buffer = 0;
} else {
/* Simple case. Just advance buffer pointer */
src->pub.bytes_in_buffer -= (size_t)num_bytes;
src->pub.next_input_byte += num_bytes;
}
}
/******************************************************************************/
/* data source manager method
This is called whenever bytes_in_buffer has reached zero and more
data is wanted. In typical applications, it should read fresh data
into the buffer (ignoring the current state of next_input_byte and
bytes_in_buffer), reset the pointer & count to the start of the
buffer, and return TRUE indicating that the buffer has been reloaded.
It is not necessary to fill the buffer entirely, only to obtain at
least one more byte. bytes_in_buffer MUST be set to a positive value
if TRUE is returned. A FALSE return should only be used when I/O
suspension is desired.
*/
boolean PR_CALLBACK
fill_input_buffer (j_decompress_ptr jd)
{
decoder_source_mgr *src = (decoder_source_mgr *)jd->src;
unsigned char *new_buffer = (unsigned char *)src->decoder->mBuffer;
PRUint32 new_buflen = src->decoder->mBufferLen;
PRUint32 bytesToSkip = src->decoder->mBytesToSkip;
switch(src->decoder->mFillState) {
case READING_BACK:
{
if (!new_buffer || new_buflen == 0)
return PR_FALSE; /* suspend */
src->decoder->mBufferLen = 0;
if (bytesToSkip != 0) {
if (bytesToSkip < new_buflen) {
/* All done skipping bytes; Return what's left. */
new_buffer += bytesToSkip;
new_buflen -= bytesToSkip;
src->decoder->mBytesToSkip = 0;
} else {
/* Still need to skip some more data in the future */
src->decoder->mBytesToSkip -= (size_t)new_buflen;
return PR_FALSE; /* suspend */
}
}
src->decoder->mBackBufferUnreadLen = src->pub.bytes_in_buffer;
src->pub.next_input_byte = new_buffer;
src->pub.bytes_in_buffer = (size_t)new_buflen;
src->decoder->mFillState = READING_NEW;
return PR_TRUE;
}
break;
case READING_NEW:
{
if (src->pub.next_input_byte != src->decoder->mBuffer) {
/* Backtrack data has been permanently consumed. */
src->decoder->mBackBufferUnreadLen = 0;
src->decoder->mBackBufferLen = 0;
}
/* Save remainder of netlib buffer in backtrack buffer */
PRUint32 new_backtrack_buflen = src->pub.bytes_in_buffer + src->decoder->mBackBufferLen;
/* Make sure backtrack buffer is big enough to hold new data. */
if (src->decoder->mBackBufferSize < new_backtrack_buflen) {
/* Round up to multiple of 16 bytes. */
PRUint32 roundup_buflen = ((new_backtrack_buflen + 15) >> 4) << 4;
if (src->decoder->mBackBufferSize) {
src->decoder->mBackBuffer =
(JOCTET *)PR_REALLOC(src->decoder->mBackBuffer, roundup_buflen);
} else {
src->decoder->mBackBuffer = (JOCTET*)PR_MALLOC(roundup_buflen);
}
/* Check for OOM */
if (!src->decoder->mBackBuffer) {
#if 0
j_common_ptr cinfo = (j_common_ptr)(&src->js->jd);
cinfo->err->msg_code = JERR_OUT_OF_MEMORY;
my_error_exit(cinfo);
#endif
}
src->decoder->mBackBufferSize = (size_t)roundup_buflen;
/* Check for malformed MARKER segment lengths. */
if (new_backtrack_buflen > MAX_JPEG_MARKER_LENGTH) {
my_error_exit((j_common_ptr)(&src->decoder->mInfo));
}
}
/* Copy remainder of netlib buffer into backtrack buffer. */
nsCRT::memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen,
src->pub.next_input_byte,
src->pub.bytes_in_buffer);
/* Point to start of data to be rescanned. */
src->pub.next_input_byte = src->decoder->mBackBuffer + src->decoder->mBackBufferLen - src->decoder->mBackBufferUnreadLen;
src->pub.bytes_in_buffer += src->decoder->mBackBufferUnreadLen;
src->decoder->mBackBufferLen = (size_t)new_backtrack_buflen;
src->decoder->mFillState = READING_BACK;
return PR_FALSE;
}
break;
}
return PR_FALSE;
}
/******************************************************************************/
/* data source manager method */
/*
* Terminate source --- called by jpeg_finish_decompress() after all
* data has been read to clean up JPEG source manager. NOT called by
* jpeg_abort() or jpeg_destroy().
*/
void PR_CALLBACK
term_source (j_decompress_ptr jd)
{
decoder_source_mgr *src = (decoder_source_mgr *)jd->src;
if (src->decoder->mObserver) {
src->decoder->mObserver->OnStopFrame(nsnull, nsnull, src->decoder->mFrame);
src->decoder->mObserver->OnStopContainer(nsnull, nsnull, src->decoder->mImage);
src->decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
/* No work necessary here */
}

View File

@@ -0,0 +1,121 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef nsJPEGDecoder_h__
#define nsJPEGDecoder_h__
#include "imgIDecoder.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "imgIDecoderObserver.h"
#include "imgIRequest.h"
#include "nsIInputStream.h"
#include "nsIPipe.h"
extern "C" {
#include "jpeglib.h"
}
#include <setjmp.h>
#define NS_JPEGDECODER_CID \
{ /* 5871a422-1dd2-11b2-ab3f-e2e56be5da9c */ \
0x5871a422, \
0x1dd2, \
0x11b2, \
{0xab, 0x3f, 0xe2, 0xe5, 0x6b, 0xe5, 0xda, 0x9c} \
}
typedef struct {
struct jpeg_error_mgr pub; /* "public" fields for IJG library*/
jmp_buf setjmp_buffer; /* For handling catastropic errors */
} decoder_error_mgr;
typedef enum {
JPEG_HEADER, /* Reading JFIF headers */
JPEG_START_DECOMPRESS,
JPEG_DECOMPRESS_PROGRESSIVE, /* Output progressive pixels */
JPEG_DECOMPRESS_SEQUENTIAL, /* Output sequential pixels */
JPEG_FINAL_PROGRESSIVE_SCAN_OUTPUT,
JPEG_DONE,
JPEG_SINK_NON_JPEG_TRAILER, /* Some image files have a */
/* non-JPEG trailer */
JPEG_ERROR
} jstate;
class nsJPEGDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsJPEGDecoder();
virtual ~nsJPEGDecoder();
PRBool FillInput(j_decompress_ptr jd);
PRUint32 mBytesToSkip;
protected:
int OutputScanlines(int num_scanlines);
public:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<imgIDecoderObserver> mObserver;
struct jpeg_decompress_struct mInfo;
decoder_error_mgr mErr;
jstate mState;
JSAMPARRAY mSamples;
JSAMPARRAY mSamples3;
PRUint8* mRGBPadRow;
PRUint32 mRGBPadRowLength;
PRInt32 mCompletedPasses;
PRInt32 mPasses;
int mFillState;
JOCTET *mBuffer;
PRUint32 mBufferLen; // amount of data currently in mBuffer
PRUint32 mBufferSize; // size in bytes what mBuffer was created with
JOCTET *mBackBuffer;
PRUint32 mBackBufferLen; // Offset of end of active backtrack data
PRUint32 mBackBufferSize; // size in bytes what mBackBuffer was created with
PRUint32 mBackBufferUnreadLen; // amount of data currently in mBackBuffer
};
#endif // nsJPEGDecoder_h__

View File

@@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "nsJPEGDecoder.h"
// objects that just require generic constructors
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJPEGDecoder)
static nsModuleComponentInfo components[] =
{
{ "ppm decoder",
NS_JPEGDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/jpeg",
nsJPEGDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsJPEGDecoderModule", components)

View File

@@ -0,0 +1,16 @@
?Release@nsJPEGDecoder@@UAGKXZ ; 172
?AddRef@nsJPEGDecoder@@UAGKXZ ; 172
?fill_input_buffer@@YAEPAUjpeg_decompress_struct@@@Z ; 126
?skip_input_data@@YAXPAUjpeg_decompress_struct@@J@Z ; 109
?WriteFrom@nsJPEGDecoder@@UAGIPAVnsIInputStream@@IPAI@Z ; 106
?OutputScanlines@nsJPEGDecoder@@IAEHH@Z ; 93
?init_source@@YAXPAUjpeg_decompress_struct@@@Z ; 86
??1nsJPEGDecoder@@UAE@XZ ; 86
?Close@nsJPEGDecoder@@UAGIXZ ; 86
?term_source@@YAXPAUjpeg_decompress_struct@@@Z ; 86
?Init@nsJPEGDecoder@@UAGIPAVimgIRequest@@@Z ; 86
??0nsJPEGDecoder@@QAE@XZ ; 86
?Flush@nsJPEGDecoder@@UAGIXZ ; 86
?QueryInterface@nsJPEGDecoder@@UAGIABUnsID@@PAPAX@Z ; 86
??_EnsJPEGDecoder@@UAEPAXI@Z ; 86
_NSGetModule ; 1

View File

@@ -0,0 +1,26 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH=..\..\..
DIRS = ppm gif png jpeg
!include $(DEPTH)\config\rules.mak

View File

@@ -0,0 +1,42 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imgpng
LIBRARY_NAME = imgpng
IS_COMPONENT = 1
REQUIRES = xpcom necko layout png gfx2 imglib2
CPPSRCS = nsPNGDecoder.cpp nsPNGFactory.cpp
EXTRA_DSO_LDOPTS = $(PNG_LIBS) $(ZLIB_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,53 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imgpng
LIBRARY_NAME = imgpng
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\nsPNGDecoder.obj \
.\$(OBJDIR)\nsPNGFactory.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\png.lib \
$(DIST)\lib\zlib.lib \
$(DIST)\lib\gkgfxwin.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,553 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*
*/
#include "nsPNGDecoder.h"
#include "nsIInputStream.h"
#include "nspr.h"
#include "nsIComponentManager.h"
#include "png.h"
#include "nsIStreamObserver.h"
#include "nsRect.h"
#include "nsMemory.h"
#include "imgIContainerObserver.h"
// XXX we need to be sure to fire onStopDecode messages to mObserver in error cases.
NS_IMPL_ISUPPORTS2(nsPNGDecoder, imgIDecoder, nsIOutputStream)
nsPNGDecoder::nsPNGDecoder()
{
NS_INIT_ISUPPORTS();
mPNG = nsnull;
mInfo = nsnull;
colorLine = 0;
alphaLine = 0;
interlacebuf = 0;
}
nsPNGDecoder::~nsPNGDecoder()
{
if (colorLine)
nsMemory::Free(colorLine);
if (alphaLine)
nsMemory::Free(alphaLine);
if (interlacebuf)
nsMemory::Free(interlacebuf);
}
/** imgIDecoder methods **/
/* void init (in imgIRequest aRequest); */
NS_IMETHODIMP nsPNGDecoder::Init(imgIRequest *aRequest)
{
mRequest = aRequest;
mObserver = do_QueryInterface(aRequest); // we're holding 2 strong refs to the request.
aRequest->GetImage(getter_AddRefs(mImage));
/* do png init stuff */
/* Initialize the container's source image header. */
/* Always decode to 24 bit pixdepth */
mPNG = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL,
NULL);
if (!mPNG) {
return NS_ERROR_FAILURE;
}
mInfo = png_create_info_struct(mPNG);
if (!mInfo) {
png_destroy_read_struct(&mPNG, NULL, NULL);
return NS_ERROR_FAILURE;
}
/* use ic as libpng "progressive pointer" (retrieve in callbacks) */
png_set_progressive_read_fn(mPNG, NS_STATIC_CAST(png_voidp, this), nsPNGDecoder::info_callback, nsPNGDecoder::row_callback, nsPNGDecoder::end_callback);
return NS_OK;
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsPNGDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/
/* void close (); */
NS_IMETHODIMP nsPNGDecoder::Close()
{
if (mPNG)
png_destroy_read_struct(&mPNG, mInfo ? &mInfo : NULL, NULL);
return NS_OK;
}
/* void flush (); */
NS_IMETHODIMP nsPNGDecoder::Flush()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsPNGDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static NS_METHOD ReadDataOut(nsIInputStream* in,
void* closure,
const char* fromRawSegment,
PRUint32 toOffset,
PRUint32 count,
PRUint32 *writeCount)
{
nsPNGDecoder *decoder = NS_STATIC_CAST(nsPNGDecoder*, closure);
// we need to do the setjmp here otherwise bad things will happen
if (setjmp(decoder->mPNG->jmpbuf)) {
png_destroy_read_struct(&decoder->mPNG, &decoder->mInfo, NULL);
// is this NS_ERROR_FAILURE enough?
decoder->mRequest->Cancel(NS_BINDING_ABORTED); // XXX is this the correct error ?
return NS_ERROR_FAILURE;
}
*writeCount = decoder->ProcessData((unsigned char*)fromRawSegment, count);
return NS_OK;
}
PRUint32 nsPNGDecoder::ProcessData(unsigned char *data, PRUint32 count)
{
png_process_data(mPNG, mInfo, data, count);
return count; // we always consume all the data
}
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP nsPNGDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
// PRUint32 sourceOffset = *_retval;
inStr->ReadSegments(ReadDataOut, this, count, _retval);
return NS_OK;
}
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsPNGDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsPNGDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPNGDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsPNGDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPNGDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
{
/* int number_passes; NOT USED */
png_uint_32 width, height;
int bit_depth, color_type, interlace_type, compression_type, filter_type;
int channels;
double LUT_exponent, CRT_exponent = 2.2, display_exponent, aGamma;
png_bytep trans=NULL;
int num_trans =0;
/* always decode to 24-bit RGB or 32-bit RGBA */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, &compression_type, &filter_type);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
png_set_expand(png_ptr);
}
if (bit_depth == 16)
png_set_strip_16(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
#ifdef XP_PC
// windows likes BGR
png_set_bgr(png_ptr);
#endif
/* set up gamma correction for Mac, Unix and (Win32 and everything else)
* using educated guesses for display-system exponents; do preferences
* later */
#if defined(XP_MAC)
LUT_exponent = 1.8 / 2.61;
#elif defined(XP_UNIX)
# if defined(__sgi)
LUT_exponent = 1.0 / 1.7; /* typical default for SGI console */
# elif defined(NeXT)
LUT_exponent = 1.0 / 2.2; /* typical default for NeXT cube */
# else
LUT_exponent = 1.0; /* default for most other Unix workstations */
# endif
#else
LUT_exponent = 1.0; /* virtually all PCs and most other systems */
#endif
/* (alternatively, could check for SCREEN_GAMMA environment variable) */
display_exponent = LUT_exponent * CRT_exponent;
if (png_get_gAMA(png_ptr, info_ptr, &aGamma))
png_set_gamma(png_ptr, display_exponent, aGamma);
else
png_set_gamma(png_ptr, display_exponent, 0.45455);
/* let libpng expand interlaced images */
if (interlace_type == PNG_INTERLACE_ADAM7) {
/* number_passes = */
png_set_interlace_handling(png_ptr);
}
/* now all of those things we set above are used to update various struct
* members and whatnot, after which we can get channels, rowbytes, etc. */
png_read_update_info(png_ptr, info_ptr);
channels = png_get_channels(png_ptr, info_ptr);
PR_ASSERT(channels == 3 || channels == 4);
/*---------------------------------------------------------------*/
/* copy PNG info into imagelib structs (formerly png_set_dims()) */
/*---------------------------------------------------------------*/
PRInt32 alpha_bits = 1;
if (channels > 3) {
/* check if alpha is coming from a tRNS chunk and is binary */
if (num_trans) {
/* if it's not a indexed color image, tRNS means binary */
if (color_type == PNG_COLOR_TYPE_PALETTE) {
for (int i=0; i<num_trans; i++) {
if ((trans[i] != 0) && (trans[i] != 255)) {
alpha_bits = 8;
break;
}
}
}
} else {
alpha_bits = 8;
}
}
nsPNGDecoder *decoder = NS_STATIC_CAST(nsPNGDecoder*, png_get_progressive_ptr(png_ptr));
if (decoder->mObserver)
decoder->mObserver->OnStartDecode(nsnull, nsnull);
// since the png is only 1 frame, initalize the container to the width and height of the frame
decoder->mImage->Init(width, height, decoder->mObserver);
if (decoder->mObserver)
decoder->mObserver->OnStartContainer(nsnull, nsnull, decoder->mImage);
decoder->mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
#if 0
// XXX should we longjmp to png_ptr->jumpbuf here if we failed?
if (!decoder->mFrame)
return NS_ERROR_FAILURE;
#endif
gfx_format format;
if (channels == 3) {
format = gfxIFormats::RGB;
} else if (channels > 3) {
if (alpha_bits == 8) {
decoder->mImage->GetPreferredAlphaChannelFormat(&format);
} else if (alpha_bits == 1) {
format = gfxIFormats::RGB_A1;
}
}
#ifdef XP_PC
// XXX this works...
format += 1; // RGB to BGR
#endif
// then initalize the frame and append it to the container
decoder->mFrame->Init(0, 0, width, height, format);
decoder->mImage->AppendFrame(decoder->mFrame);
if (decoder->mObserver)
decoder->mObserver->OnStartFrame(nsnull, nsnull, decoder->mFrame);
PRUint32 bpr, abpr;
decoder->mFrame->GetImageBytesPerRow(&bpr);
decoder->mFrame->GetAlphaBytesPerRow(&abpr);
decoder->colorLine = (PRUint8 *)nsMemory::Alloc(bpr);
if (channels > 3)
decoder->alphaLine = (PRUint8 *)nsMemory::Alloc(abpr);
if (interlace_type == PNG_INTERLACE_ADAM7) {
decoder->interlacebuf = (PRUint8 *)nsMemory::Alloc(channels*width*height);
decoder->ibpr = channels*width;
if (!decoder->interlacebuf) {
// return NS_ERROR_FAILURE;
}
}
return;
}
void
nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
{
/* libpng comments:
*
* this function is called for every row in the image. If the
* image is interlacing, and you turned on the interlace handler,
* this function will be called for every row in every pass.
* Some of these rows will not be changed from the previous pass.
* When the row is not changed, the new_row variable will be NULL.
* The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it
* may make your life easier.
*
* For the non-NULL rows of interlaced images, you must call
* png_progressive_combine_row() passing in the row and the
* old row. You can call this function for NULL rows (it will
* just return) and for non-interlaced images (it just does the
* memcpy for you) if it will make the code easier. Thus, you
* can just do this for all cases:
*
* png_progressive_combine_row(png_ptr, old_row, new_row);
*
* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have
* to pass the current row, and the function will combine the
* old row and the new row.
*/
nsPNGDecoder *decoder = NS_STATIC_CAST(nsPNGDecoder*, png_get_progressive_ptr(png_ptr));
PRUint32 bpr, abpr;
decoder->mFrame->GetImageBytesPerRow(&bpr);
decoder->mFrame->GetAlphaBytesPerRow(&abpr);
png_bytep line;
if (decoder->interlacebuf) {
line = decoder->interlacebuf+(row_num*decoder->ibpr);
png_progressive_combine_row(png_ptr, line, new_row);
}
else
line = new_row;
if (new_row) {
nscoord width;
decoder->mFrame->GetWidth(&width);
PRUint32 iwidth = width;
gfx_format format;
decoder->mFrame->GetFormat(&format);
PRUint8 *aptr, *cptr;
// The mac specific ifdefs in the code below are there to make sure we
// always fill in 4 byte pixels right now, which is what the mac always
// allocates for its pixel buffers in true color mode. This will change
// when we start storing images with color palettes when they don't need
// true color support (GIFs).
switch (format) {
case gfxIFormats::RGB:
case gfxIFormats::BGR:
#ifdef XP_MAC
cptr = decoder->colorLine;
for (PRUint32 x=0; x<iwidth; x++) {
*cptr++ = 0;
*cptr++ = *line++;
*cptr++ = *line++;
*cptr++ = *line++;
}
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
#else
decoder->mFrame->SetImageData((PRUint8*)line, bpr, row_num*bpr);
#endif
break;
case gfxIFormats::RGB_A1:
case gfxIFormats::BGR_A1:
{
cptr = decoder->colorLine;
aptr = decoder->alphaLine;
memset(aptr, 0, abpr);
for (PRUint32 x=0; x<iwidth; x++) {
#ifdef XP_MAC
*cptr++ = 0;
#endif
*cptr++ = *line++;
*cptr++ = *line++;
*cptr++ = *line++;
if (*line++) {
aptr[x>>3] |= 1<<(7-x&0x7);
}
}
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
decoder->mFrame->SetAlphaData(decoder->alphaLine, abpr, row_num*abpr);
}
break;
case gfxIFormats::RGB_A8:
case gfxIFormats::BGR_A8:
{
cptr = decoder->colorLine;
aptr = decoder->alphaLine;
for (PRUint32 x=0; x<iwidth; x++) {
#ifdef XP_MAC
*cptr++ = 0;
#endif
*cptr++ = *line++;
*cptr++ = *line++;
*cptr++ = *line++;
*aptr++ = *line++;
}
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
decoder->mFrame->SetAlphaData(decoder->alphaLine, abpr, row_num*abpr);
}
break;
case gfxIFormats::RGBA:
case gfxIFormats::BGRA:
#ifdef XP_MAC
{
cptr = decoder->colorLine;
aptr = decoder->alphaLine;
for (PRUint32 x=0; x<iwidth; x++) {
*cptr++ = 0;
*cptr++ = *line++;
*cptr++ = *line++;
*cptr++ = *line++;
*aptr++ = *line++;
}
decoder->mFrame->SetImageData(decoder->colorLine, bpr, row_num*bpr);
decoder->mFrame->SetAlphaData(decoder->alphaLine, abpr, row_num*abpr);
}
#else
decoder->mFrame->SetImageData(line, bpr, row_num*bpr);
#endif
break;
}
nsRect r(0, row_num, width, 1);
decoder->mObserver->OnDataAvailable(nsnull, nsnull, decoder->mFrame, &r);
}
}
void
nsPNGDecoder::end_callback(png_structp png_ptr, png_infop info_ptr)
{
/* libpng comments:
*
* this function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
nsPNGDecoder *decoder = NS_STATIC_CAST(nsPNGDecoder*, png_get_progressive_ptr(png_ptr));
if (decoder->mObserver) {
decoder->mObserver->OnStopFrame(nsnull, nsnull, decoder->mFrame);
decoder->mObserver->OnStopContainer(nsnull, nsnull, decoder->mImage);
decoder->mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
}

View File

@@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef nsPNGDecoder_h__
#define nsPNGDecoder_h__
#include "imgIDecoder.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgIRequest.h"
#include "nsCOMPtr.h"
#include "png.h"
#define NS_PNGDECODER_CID \
{ /* 36fa00c2-1dd2-11b2-be07-d16eeb4c50ed */ \
0x36fa00c2, \
0x1dd2, \
0x11b2, \
{0xbe, 0x07, 0xd1, 0x6e, 0xeb, 0x4c, 0x50, 0xed} \
}
class nsPNGDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsPNGDecoder();
virtual ~nsPNGDecoder();
PR_STATIC_CALLBACK(void)
info_callback(png_structp png_ptr, png_infop info_ptr);
PR_STATIC_CALLBACK(void)
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass);
PR_STATIC_CALLBACK(void)
end_callback(png_structp png_ptr, png_infop info_ptr);
inline PRUint32 ProcessData(unsigned char *data, PRUint32 count);
public:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
png_structp mPNG;
png_infop mInfo;
PRUint8 *colorLine, *alphaLine;
PRUint8 *interlacebuf;
PRUint32 ibpr;
};
#endif // nsPNGDecoder_h__

View File

@@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "nsPNGDecoder.h"
// objects that just require generic constructors
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGDecoder)
static nsModuleComponentInfo components[] =
{
{ "PNG decoder",
NS_PNGDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/png",
nsPNGDecoderConstructor, },
{ "PNG decoder",
NS_PNGDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/x-png",
nsPNGDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsPNGDecoderModule", components)

View File

@@ -0,0 +1,42 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imgppm
LIBRARY_NAME = imgppm
IS_COMPONENT = 1
REQUIRES = xpcom layout necko gfx2 imglib2
CPPSRCS = nsPPMDecoder.cpp nsPPMFactory.cpp
EXTRA_DSO_LDOPTS = \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,51 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imgppm
LIBRARY_NAME = imgppm
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\nsPPMDecoder.obj \
.\$(OBJDIR)\nsPPMFactory.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,305 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*
*/
#include "nsPPMDecoder.h"
#include "nsIInputStream.h"
#include "imgIContainer.h"
#include "imgIContainerObserver.h"
#include "nspr.h"
#include "nsIComponentManager.h"
#include "nsRect.h"
NS_IMPL_ISUPPORTS2(nsPPMDecoder, imgIDecoder, nsIOutputStream)
nsPPMDecoder::nsPPMDecoder()
{
NS_INIT_ISUPPORTS();
mDataReceived = 0;
mDataWritten = 0;
mDataLeft = 0;
mPrevData = nsnull;
}
nsPPMDecoder::~nsPPMDecoder()
{
}
/** imgIDecoder methods **/
/* void init (in imgIRequest aRequest); */
NS_IMETHODIMP nsPPMDecoder::Init(imgIRequest *aRequest)
{
mRequest = aRequest;
mObserver = do_QueryInterface(aRequest); // we're holding 2 strong refs to the request.
aRequest->GetImage(getter_AddRefs(mImage));
mFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
if (!mFrame)
return NS_ERROR_FAILURE;
return NS_OK;
}
/* readonly attribute imgIRequest request; */
NS_IMETHODIMP nsPPMDecoder::GetRequest(imgIRequest * *aRequest)
{
*aRequest = mRequest;
NS_ADDREF(*aRequest);
return NS_OK;
}
/** nsIOutputStream methods **/
/* void close (); */
NS_IMETHODIMP nsPPMDecoder::Close()
{
if (mObserver) {
mObserver->OnStopFrame(nsnull, nsnull, mFrame);
mObserver->OnStopContainer(nsnull, nsnull, mImage);
mObserver->OnStopDecode(nsnull, nsnull, NS_OK, nsnull);
}
return NS_OK;
}
/* void flush (); */
NS_IMETHODIMP nsPPMDecoder::Flush()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long write (in string buf, in unsigned long count); */
NS_IMETHODIMP nsPPMDecoder::Write(const char *buf, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static char *__itoa(int n)
{
char *s;
int i, j, sign, tmp;
/* check sign and convert to positive to stringify numbers */
if ( (sign = n) < 0)
n = -n;
i = 0;
s = (char*) malloc(sizeof(char));
/* grow string as needed to add numbers from powers of 10
* down till none left
*/
do
{
s = (char*) realloc(s, (i+1)*sizeof(char));
s[i++] = n % 10 + '0'; /* '0' or 30 is where ASCII numbers start */
s[i] = '\0';
}
while( (n /= 10) > 0);
/* tack on minus sign if we found earlier that this was negative */
if (sign < 0)
{
s = (char*) realloc(s, (i+1)*sizeof(char));
s[i++] = '-';
}
s[i] = '\0';
/* pop numbers (and sign) off of string to push back into right direction */
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
{
tmp = s[i];
s[i] = s[j];
s[j] = tmp;
}
return s;
}
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP nsPPMDecoder::WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval)
{
nsresult rv;
char *buf = (char *)PR_Malloc(count + mDataLeft);
if (!buf)
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
// read the data from the input stram...
PRUint32 readLen;
rv = inStr->Read(buf+mDataLeft, count, &readLen);
PRUint32 dataLen = readLen + mDataLeft;
if (mPrevData) {
strncpy(buf, mPrevData, mDataLeft);
PR_Free(mPrevData);
mPrevData = nsnull;
mDataLeft = 0;
}
char *data = buf;
if (NS_FAILED(rv)) return rv;
if (mDataReceived == 0) {
mObserver->OnStartDecode(nsnull, nsnull);
// Check the magic number
char type;
if ((sscanf(data, "P%c\n", &type) !=1) || (type != '6')) {
return NS_ERROR_FAILURE;
}
int i = 3;
data += i;
#if 0
// XXX
// Ignore comments
while ((input = fgetc(f)) == '#')
fgets(junk, 512, f);
ungetc(input, f);
#endif
// Read size
int w, h, mcv;
if (sscanf(data, "%d %d\n%d\n", &w, &h, &mcv) != 3) {
return NS_ERROR_FAILURE;
}
char *ws = __itoa(w), *hs = __itoa(h), *mcvs = __itoa(mcv);
int j = strlen(ws) + strlen(hs) + strlen(mcvs) + 3;
data += j;
// free(ws);
// free(hs);
// free(mcvs);
readLen -= i + j;
dataLen = readLen; // since this is the first pass, we don't have any data waiting that we need to keep track of
mImage->Init(w, h, mObserver);
if (mObserver)
mObserver->OnStartContainer(nsnull, nsnull, mImage);
mFrame->Init(0, 0, w, h, gfxIFormats::RGB);
mImage->AppendFrame(mFrame);
if (mObserver)
mObserver->OnStartFrame(nsnull, nsnull, mFrame);
}
PRUint32 bpr;
nscoord width;
mFrame->GetImageBytesPerRow(&bpr);
mFrame->GetWidth(&width);
// XXX ceil?
PRUint32 real_bpr = width * 3;
PRUint32 i = 0;
PRUint32 rownum = mDataWritten / real_bpr; // XXX this better not have a decimal
PRUint32 wroteLen = 0;
if (readLen > real_bpr) {
do {
PRUint8 *line = (PRUint8*)data + i*real_bpr;
mFrame->SetImageData(line, real_bpr, (rownum++)*bpr);
nsRect r(0, rownum, width, 1);
mObserver->OnDataAvailable(nsnull, nsnull, mFrame, &r);
wroteLen += real_bpr ;
i++;
} while(dataLen >= real_bpr * (i+1));
}
mDataReceived += readLen; // don't double count previous data that is in 'dataLen'
mDataWritten += wroteLen;
PRUint32 dataLeft = dataLen - wroteLen;
if (dataLeft > 0) {
if (mPrevData) {
mPrevData = (char *)PR_Realloc(mPrevData, mDataLeft + dataLeft);
strncpy(mPrevData + mDataLeft, data+wroteLen, dataLeft);
mDataLeft += dataLeft;
} else {
mDataLeft = dataLeft;
mPrevData = (char *)PR_Malloc(mDataLeft);
strncpy(mPrevData, data+wroteLen, mDataLeft);
}
}
PR_FREEIF(buf);
return NS_OK;
}
/* [noscript] unsigned long writeSegments (in nsReadSegmentFun reader, in voidPtr closure, in unsigned long count); */
NS_IMETHODIMP nsPPMDecoder::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean nonBlocking; */
NS_IMETHODIMP nsPPMDecoder::GetNonBlocking(PRBool *aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPPMDecoder::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIOutputStreamObserver observer; */
NS_IMETHODIMP nsPPMDecoder::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPPMDecoder::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef nsPPMDecoder_h__
#define nsPPMDecoder_h__
#include "imgIDecoder.h"
#include "nsCOMPtr.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "imgIRequest.h"
#define NS_PPMDECODER_CID \
{ /* e90bfa06-1dd1-11b2-8217-f38fe5d431a2 */ \
0xe90bfa06, \
0x1dd1, \
0x11b2, \
{0x82, 0x17, 0xf3, 0x8f, 0xe5, 0xd4, 0x31, 0xa2} \
}
class nsPPMDecoder : public imgIDecoder
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIDECODER
NS_DECL_NSIOUTPUTSTREAM
nsPPMDecoder();
virtual ~nsPPMDecoder();
private:
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<gfxIImageFrame> mFrame;
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<imgIDecoderObserver> mObserver; // this is just qi'd from mRequest for speed
PRUint32 mDataReceived;
PRUint32 mDataWritten;
PRUint32 mDataLeft;
char *mPrevData;
};
#endif // nsPPMDecoder_h__

View File

@@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "nsPPMDecoder.h"
// objects that just require generic constructors
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPPMDecoder)
static nsModuleComponentInfo components[] =
{
{ "ppm decoder",
NS_PPMDECODER_CID,
"@mozilla.org/image/decoder;2?type=image/x-portable-pixmap",
nsPPMDecoderConstructor, },
};
NS_IMPL_NSGETMODULE("nsPPMDecoderModule", components)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,25 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..
DIRS = public src decoders
!include $(DEPTH)\config\rules.mak

View File

@@ -0,0 +1,111 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "prlog.h"
#include "nsString.h"
#if defined(PR_LOGGING)
extern PRLogModuleInfo *gImgLog;
class LogScope {
public:
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s {ENTER}\n",
mFrom, mFunc.get()));
}
/* const char * constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, const char *paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s (%s=\"%s\") {ENTER}\n",
mFrom, mFunc.get(),
paramName.get(),
paramValue));
}
/* void ptr constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, const void *paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s (%s=%p) {ENTER}\n",
mFrom, mFunc.get(),
paramName.get(),
paramValue));
}
/* PRInt32 constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, PRInt32 paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s (%s=\"%d\") {ENTER}\n",
mFrom, mFunc.get(),
paramName.get(),
paramValue));
}
/* PRUint32 constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, PRUint32 paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s (%s=\"%d\") {ENTER}\n",
mFrom, mFunc.get(),
paramName.get(),
paramValue));
}
~LogScope() {
PR_LOG(mLog, PR_LOG_DEBUG, ("[this=%p] %s {EXIT}\n",
mFrom, mFunc.get()));
}
private:
PRLogModuleInfo *mLog;
void *mFrom;
nsCAutoString mFunc;
};
#define LOG_SCOPE(l, s) \
LogScope LOG_SCOPE_TMP_VAR ##__LINE__ (l, \
NS_STATIC_CAST(void *, this), \
NS_LITERAL_CSTRING(s))
#define LOG_SCOPE_WITH_PARAM(l, s, pn, pv) \
LogScope LOG_SCOPE_TMP_VAR ##__LINE__ (l, \
NS_STATIC_CAST(void *, this), \
NS_LITERAL_CSTRING(s), \
NS_LITERAL_CSTRING(pn), pv)
#else
#define LOG_SCOPE(l, s)
#define LOG_SCOPE_WITH_PARAM(l, s, pn, pv)
#endif

View File

@@ -0,0 +1 @@
ImageLogging.h

View File

@@ -0,0 +1,6 @@
imgIContainer.idl
imgIContainerObserver.idl
imgIDecoder.idl
imgIDecoderObserver.idl
imgILoader.idl
imgIRequest.idl

View File

@@ -0,0 +1,41 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imglib2
EXPORTS = ImageLogging.h
XPIDLSRCS = imgIContainer.idl \
imgIContainerObserver.idl \
imgIDecoder.idl \
imgIDecoderObserver.idl \
imgILoader.idl \
imgIRequest.idl
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,109 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
#include "gfxIFormats.idl"
interface gfxIImageFrame;
interface nsIEnumerator;
interface imgIContainerObserver;
/**
* gfxIImageContainer interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see "gfx2"
*/
[scriptable, uuid(5e8405a4-1dd2-11b2-8385-bc8e3446cad3)]
interface imgIContainer : nsISupports
{
/**
* Create a new \a aWidth x \a aHeight sized image container.
*
* @param aWidth The width of the container in which all the
* gfxIImageFrame children will fit.
* @param aHeight The height of the container in which all the
* gfxIImageFrame children will fit.
* @param aObserver Observer to send animation notifications to.
*/
void init(in nscoord aWidth,
in nscoord aHeight,
in imgIContainerObserver aObserver);
/* this should probably be on the device context (or equiv) */
readonly attribute gfx_format preferredAlphaChannelFormat;
/**
* The width of the container rectangle.
*/
readonly attribute nscoord width;
/**
* The height of the container rectangle.
*/
readonly attribute nscoord height;
/**
* Get the current frame that would be drawn if the image was to be drawn now
*/
readonly attribute gfxIImageFrame currentFrame;
readonly attribute unsigned long numFrames;
gfxIImageFrame getFrameAt(in unsigned long index);
/**
* Adds \a item to the end of the list of frames.
* @param item frame to add.
*/
void appendFrame(in gfxIImageFrame item);
void removeFrame(in gfxIImageFrame item);
/* notification when the current frame is done decoding */
void endFrameDecode(in unsigned long framenumber, in unsigned long timeout);
/* notification that the entire image has been decoded */
void decodingComplete();
nsIEnumerator enumerate();
void clear();
void startAnimation();
void stopAnimation();
/* animation stuff */
/**
* number of times to loop the image.
* @note -1 means forever.
*/
attribute long loopCount;
};

View File

@@ -0,0 +1,46 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
%{C++
#include "nsRect.h"
%}
interface imgIContainer;
interface gfxIImageFrame;
/**
* imgIContainerObserver interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
*/
[uuid(153f1518-1dd2-11b2-b9cd-b16eb63e0471)]
interface imgIContainerObserver : nsISupports
{
[noscript] void frameChanged(in imgIContainer aContainer, in nsISupports aCX,
in gfxIImageFrame aFrame, in nsRect aDirtyRect);
};

View File

@@ -0,0 +1,53 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "nsIOutputStream.idl"
#include "gfxtypes.idl"
interface imgIRequest;
/**
* imgIDecoder interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(9eebf43a-1dd1-11b2-953e-f1782f4cbad3)]
interface imgIDecoder : nsIOutputStream
{
/**
* Initalize an image decoder.
* @param aRequest the request that owns the decoder.
*
* @note The decode should QI \a aRequest to an imgIDecoderObserver
* and should send decoder notifications to the request.
* The decoder should always pass NULL as the first two parameters to
* all of the imgIDecoderObserver APIs.
*/
void init(in imgIRequest aRequest);
/// allows access to the nsIImage we have to put bits in to.
readonly attribute imgIRequest request;
};

View File

@@ -0,0 +1,80 @@
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgIContainerObserver.idl"
interface imgIRequest;
interface imgIContainer;
interface gfxIImageFrame;
%{C++
#include "nsRect.h"
%}
/**
* imgIDecoderObserver interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(350163d2-1dd2-11b2-9e69-89959ecec1f3)]
interface imgIDecoderObserver : imgIContainerObserver
{
/**
* called as soon as the image begins getting decoded
*/
void onStartDecode(in imgIRequest aRequest, in nsISupports cx);
/**
* called once the image has been inited and therefore has a width and height
*/
void onStartContainer(in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer);
/**
* called when each frame is created
*/
void onStartFrame(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame);
/**
* called when some part of the frame has new data in it
*/
[noscript] void onDataAvailable(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame, [const] in nsRect aRect);
/**
* called when a frame is finished decoding
*/
void onStopFrame(in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame);
/**
* probably not needed. called right before onStopDecode
*/
void onStopContainer(in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer);
/**
* called when the decoder is dying off
*/
void onStopDecode(in imgIRequest aRequest, in nsISupports cx,
in nsresult status, in wstring statusArg);
};

View File

@@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "gfxtypes.idl"
interface imgIDecoderObserver;
interface imgIRequest;
interface nsIChannel;
interface nsILoadGroup;
interface nsIStreamListener;
interface nsIURI;
interface nsISimpleEnumerator;
/**
* imgILoader interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(4c8cf1e0-1dd2-11b2-aff9-c51cdbfcb6da)]
interface imgILoader : nsISupports
{
/**
* Start the load and decode of an image.
* @param uri the URI to load
* @param aObserver the observer
* @param cx some random data
*/
imgIRequest loadImage(in nsIURI uri, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports cx);
/**
* Start the load and decode of an image.
* @param uri the URI to load
* @param aObserver the observer
* @param cx some random data
*/
imgIRequest loadImageWithChannel(in nsIChannel aChannel, in imgIDecoderObserver aObserver, in nsISupports cx, out nsIStreamListener aListener);
};

View File

@@ -0,0 +1,80 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsISupports.idl"
#include "nsIRequest.idl"
interface imgIContainer;
interface imgIDecoderObserver;
interface nsIURI;
/**
* imgIRequest interface
*
* @author Stuart Parmenter <pavlov@netscape.com>
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(ccf705f6-1dd1-11b2-82ef-e18eccf7f7ec)]
interface imgIRequest : nsIRequest
{
/**
* the image container...
* @return the image object associated with the request.
* @attention NEED DOCS
*/
readonly attribute imgIContainer image;
/**
* Bits set in the return value from imageStatus
* @name statusflags
*/
//@{
const long STATUS_NONE = 0x0;
const long STATUS_SIZE_AVAILABLE = 0x1;
const long STATUS_LOAD_COMPLETE = 0x2;
const long STATUS_ERROR = 0x4;
//@}
/**
* something
* @attention NEED DOCS
*/
readonly attribute unsigned long imageStatus;
readonly attribute nsIURI URI;
readonly attribute imgIDecoderObserver decoderObserver;
};
%{C++
/**
* imagelib specific nsresult success and error codes
*/
#define NS_IMAGELIB_SUCCESS_LOAD_FINISHED NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_IMGLIB, 0)
#define NS_IMAGELIB_ERROR_FAILURE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 5)
#define NS_IMAGELIB_ERROR_NO_DECODER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_IMGLIB, 6)
%}

View File

@@ -0,0 +1,43 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH = ..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imglib2
XPIDL_MODULE = imglib2
EXPORTS = ImageLogging.h
XPIDLSRCS = \
.\imgIContainer.idl \
.\imgIContainerObserver.idl \
.\imgIDecoder.idl \
.\imgIDecoderObserver.idl \
.\imgILoader.idl \
.\imgIRequest.idl \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,146 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "DummyChannel.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
NS_IMPL_ISUPPORTS1(DummyChannel, nsIChannel)
DummyChannel::DummyChannel(imgIRequest *aRequest, nsILoadGroup *aLoadGroup) :
mRequest(aRequest),
mLoadGroup(aLoadGroup),
mLoadFlags(nsIChannel::LOAD_NORMAL)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
DummyChannel::~DummyChannel()
{
/* destructor code */
}
/* attribute nsIURI originalURI; */
NS_IMETHODIMP DummyChannel::GetOriginalURI(nsIURI * *aOriginalURI)
{
return mRequest->GetURI(aOriginalURI);
}
NS_IMETHODIMP DummyChannel::SetOriginalURI(nsIURI * aOriginalURI)
{
return NS_ERROR_FAILURE;
}
/* attribute nsIURI URI; */
NS_IMETHODIMP DummyChannel::GetURI(nsIURI * *aURI)
{
return mRequest->GetURI(aURI);
}
NS_IMETHODIMP DummyChannel::SetURI(nsIURI * aURI)
{
return NS_ERROR_FAILURE;
}
/* attribute nsISupports owner; */
NS_IMETHODIMP DummyChannel::GetOwner(nsISupports * *aOwner)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP DummyChannel::SetOwner(nsISupports * aOwner)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsILoadGroup loadGroup; */
NS_IMETHODIMP DummyChannel::GetLoadGroup(nsILoadGroup * *aLoadGroup)
{
*aLoadGroup = mLoadGroup;
NS_IF_ADDREF(*aLoadGroup);
return NS_OK;
}
NS_IMETHODIMP DummyChannel::SetLoadGroup(nsILoadGroup * aLoadGroup)
{
return NS_ERROR_FAILURE;
}
/* attribute nsLoadFlags loadAttributes; */
NS_IMETHODIMP DummyChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
{
*aLoadAttributes = mLoadFlags;
return NS_OK;
}
NS_IMETHODIMP DummyChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
{
mLoadFlags = aLoadAttributes;
return NS_OK;
}
/* attribute nsIInterfaceRequestor notificationCallbacks; */
NS_IMETHODIMP DummyChannel::GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks)
{
return NS_OK;
}
NS_IMETHODIMP DummyChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks)
{
return NS_OK;
}
/* readonly attribute nsISupports securityInfo; */
NS_IMETHODIMP DummyChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute string contentType; */
NS_IMETHODIMP DummyChannel::GetContentType(char * *aContentType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP DummyChannel::SetContentType(const char * aContentType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute long contentLength; */
NS_IMETHODIMP DummyChannel::GetContentLength(PRInt32 *aContentLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP DummyChannel::SetContentLength(PRInt32 aContentLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIInputStream open (); */
NS_IMETHODIMP DummyChannel::Open(nsIInputStream **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void asyncOpen (in nsIStreamListener listener, in nsISupports ctxt); */
NS_IMETHODIMP DummyChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef DummyChannel_h__
#define DummyChannel_h__
#include "nsIChannel.h"
#include "nsIRequest.h"
#include "nsILoadGroup.h"
#include "imgIRequest.h"
#include "nsCOMPtr.h"
class DummyChannel : public nsIChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNEL
NS_FORWARD_NSIREQUEST(mRequest->)
DummyChannel(imgIRequest *aRequest, nsILoadGroup *aLoadGroup);
~DummyChannel();
private:
/* additional members */
nsCOMPtr<imgIRequest> mRequest;
nsCOMPtr<nsILoadGroup> mLoadGroup;
nsLoadFlags mLoadFlags;
};
#endif

View File

@@ -0,0 +1,166 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "ImageCache.h"
#ifdef MOZ_NEW_CACHE
#include "prlog.h"
#if defined(PR_LOGGING)
extern PRLogModuleInfo *gImgLog;
#else
#define gImgLog
#endif
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsICache.h"
#include "nsICacheService.h"
#include "nsICacheSession.h"
#include "nsICacheEntryDescriptor.h"
static nsCOMPtr<nsICacheSession> gSession = nsnull;
ImageCache::ImageCache()
{
/* member initializers and constructor code */
}
ImageCache::~ImageCache()
{
/* destructor code */
}
void GetCacheSession(nsICacheSession **_retval)
{
if (!gSession) {
nsCOMPtr<nsICacheService> cacheService(do_GetService("@mozilla.org/network/cache-service;1"));
NS_ASSERTION(cacheService, "Unable to get the cache service");
cacheService->CreateSession("images", nsICache::NOT_STREAM_BASED, PR_FALSE, getter_AddRefs(gSession));
NS_ASSERTION(gSession, "Unable to create a cache session");
}
*_retval = gSession;
NS_IF_ADDREF(*_retval);
}
void ImageCache::Shutdown()
{
gSession = nsnull;
}
PRBool ImageCache::Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor **aEntry)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("ImageCache::Put\n"));
nsresult rv;
nsCOMPtr<nsICacheSession> ses;
GetCacheSession(getter_AddRefs(ses));
nsXPIDLCString spec;
aKey->GetSpec(getter_Copies(spec));
nsCOMPtr<nsICacheEntryDescriptor> entry;
rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_WRITE, getter_AddRefs(entry));
if (!entry || NS_FAILED(rv))
return PR_FALSE;
entry->SetCacheElement(NS_STATIC_CAST(nsISupports *, NS_STATIC_CAST(imgIRequest*, request)));
entry->MarkValid();
*aEntry = entry;
NS_ADDREF(*aEntry);
return PR_TRUE;
}
PRBool ImageCache::Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("ImageCache::Get\n"));
nsresult rv;
nsCOMPtr<nsICacheSession> ses;
GetCacheSession(getter_AddRefs(ses));
nsXPIDLCString spec;
aKey->GetSpec(getter_Copies(spec));
nsCOMPtr<nsICacheEntryDescriptor> entry;
rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_READ, getter_AddRefs(entry));
if (!entry || NS_FAILED(rv))
return PR_FALSE;
nsCOMPtr<nsISupports> sup;
entry->GetCacheElement(getter_AddRefs(sup));
nsCOMPtr<imgIRequest> req(do_QueryInterface(sup));
*aRequest = NS_REINTERPRET_CAST(imgRequest*, req.get());
NS_IF_ADDREF(*aRequest);
*aEntry = entry;
NS_ADDREF(*aEntry);
return PR_TRUE;
}
PRBool ImageCache::Remove(nsIURI *aKey)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("ImageCache::Remove\n"));
nsresult rv;
nsCOMPtr<nsICacheSession> ses;
GetCacheSession(getter_AddRefs(ses));
nsXPIDLCString spec;
aKey->GetSpec(getter_Copies(spec));
nsCOMPtr<nsICacheEntryDescriptor> entry;
rv = ses->OpenCacheEntry(spec, nsICache::ACCESS_READ, getter_AddRefs(entry));
if (!entry || NS_FAILED(rv))
return PR_FALSE;
entry->Doom();
return PR_TRUE;
}
#endif /* MOZ_NEW_CACHE */

View File

@@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef ImageCache_h__
#define ImageCache_h__
#include "nsIURI.h"
#include "imgRequest.h"
#include "prtypes.h"
#ifdef MOZ_NEW_CACHE
#include "nsICacheEntryDescriptor.h"
#else
class nsICacheEntryDescriptor;
#endif
class ImageCache
{
public:
#ifdef MOZ_NEW_CACHE
ImageCache();
~ImageCache();
static void Shutdown(); // for use by the factory
/* additional members */
static PRBool Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor **aEntry);
static PRBool Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry);
static PRBool Remove(nsIURI *aKey);
#else
ImageCache() { }
~ImageCache() { }
static void Shutdown() { }
/* additional members */
static PRBool Put(nsIURI *aKey, imgRequest *request, nsICacheEntryDescriptor **aEntry) {
return PR_FALSE;
}
static PRBool Get(nsIURI *aKey, imgRequest **aRequest, nsICacheEntryDescriptor **aEntry) {
return PR_FALSE;
}
static PRBool Remove(nsIURI *aKey) {
return PR_FALSE;
}
#endif /* MOZ_NEW_CACHE */
};
#endif

View File

@@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "nsIGenericFactory.h"
#include "nsIModule.h"
#include "imgContainer.h"
#include "imgLoader.h"
#include "imgRequest.h"
#include "imgRequestProxy.h"
#include "ImageCache.h"
// objects that just require generic constructors
NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainer)
NS_GENERIC_FACTORY_CONSTRUCTOR(imgLoader)
NS_GENERIC_FACTORY_CONSTRUCTOR(imgRequest)
NS_GENERIC_FACTORY_CONSTRUCTOR(imgRequestProxy)
static nsModuleComponentInfo components[] =
{
{ "image container",
NS_IMGCONTAINER_CID,
"@mozilla.org/image/container;1",
imgContainerConstructor, },
{ "image loader",
NS_IMGLOADER_CID,
"@mozilla.org/image/loader;1",
imgLoaderConstructor, },
{ "image request",
NS_IMGREQUEST_CID,
"@mozilla.org/image/request/real;1",
imgRequestConstructor, },
{ "image request proxy",
NS_IMGREQUESTPROXY_CID,
"@mozilla.org/image/request/proxy;1",
imgRequestProxyConstructor, },
};
PR_STATIC_CALLBACK(void)
ImageModuleDestructor(nsIModule *self)
{
ImageCache::Shutdown();
}
NS_IMPL_NSGETMODULE_WITH_DTOR("nsImageLib2Module", components, ImageModuleDestructor)

View File

@@ -0,0 +1,49 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = imglib2
LIBRARY_NAME = imglib2
IS_COMPONENT = 1
REQUIRES = xpcom string necko nkcache layout timer gfx2
CPPSRCS = \
DummyChannel.cpp \
ImageCache.cpp \
ImageFactory.cpp \
imgContainer.cpp \
imgLoader.cpp \
imgRequest.cpp \
imgRequestProxy.cpp
EXTRA_DSO_LDOPTS = \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,555 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Chris Saari <saari@netscape.com>
*/
#include "imgContainer.h"
#include "nsIServiceManager.h"
#include "nsIInterfaceRequestor.h"
#include "gfxIImageFrame.h"
#include "nsIImage.h"
NS_IMPL_ISUPPORTS3(imgContainer, imgIContainer, nsITimerCallback,imgIDecoderObserver)
//******************************************************************************
imgContainer::imgContainer()
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
mCurrentDecodingFrameIndex = 0;
mCurrentAnimationFrameIndex = 0;
mCurrentFrameIsFinishedDecoding = PR_FALSE;
mDoneDecoding = PR_FALSE;
mAnimating = PR_FALSE;
mObserver = nsnull;
}
//******************************************************************************
imgContainer::~imgContainer()
{
if (mTimer)
mTimer->Cancel();
/* destructor code */
mFrames.Clear();
}
//******************************************************************************
/* void init (in nscoord aWidth, in nscoord aHeight, in imgIContainerObserver aObserver); */
NS_IMETHODIMP imgContainer::Init(nscoord aWidth, nscoord aHeight, imgIContainerObserver *aObserver)
{
if (aWidth <= 0 || aHeight <= 0) {
NS_WARNING("error - negative image size\n");
return NS_ERROR_FAILURE;
}
mSize.SizeTo(aWidth, aHeight);
mObserver = getter_AddRefs(NS_GetWeakReference(aObserver));
return NS_OK;
}
//******************************************************************************
/* readonly attribute gfx_format preferredAlphaChannelFormat; */
NS_IMETHODIMP imgContainer::GetPreferredAlphaChannelFormat(gfx_format *aFormat)
{
/* default.. platform's should probably overwrite this */
*aFormat = gfxIFormats::RGB_A8;
return NS_OK;
}
//******************************************************************************
/* readonly attribute nscoord width; */
NS_IMETHODIMP imgContainer::GetWidth(nscoord *aWidth)
{
*aWidth = mSize.width;
return NS_OK;
}
//******************************************************************************
/* readonly attribute nscoord height; */
NS_IMETHODIMP imgContainer::GetHeight(nscoord *aHeight)
{
*aHeight = mSize.height;
return NS_OK;
}
//******************************************************************************
/* readonly attribute gfxIImageFrame currentFrame; */
NS_IMETHODIMP imgContainer::GetCurrentFrame(gfxIImageFrame * *aCurrentFrame)
{
if(mCompositingFrame)
return mCompositingFrame->QueryInterface(NS_GET_IID(gfxIImageFrame), (void**)aCurrentFrame); // addrefs again
else
return this->GetFrameAt(mCurrentAnimationFrameIndex, aCurrentFrame);
}
//******************************************************************************
/* readonly attribute unsigned long numFrames; */
NS_IMETHODIMP imgContainer::GetNumFrames(PRUint32 *aNumFrames)
{
return mFrames.Count(aNumFrames);
}
//******************************************************************************
/* gfxIImageFrame getFrameAt (in unsigned long index); */
NS_IMETHODIMP imgContainer::GetFrameAt(PRUint32 index, gfxIImageFrame **_retval)
{
nsISupports *sup = mFrames.ElementAt(index); // addrefs
if (!sup)
return NS_ERROR_FAILURE;
nsresult rv;
rv = sup->QueryInterface(NS_GET_IID(gfxIImageFrame), (void**)_retval); // addrefs again
NS_RELEASE(sup);
return rv;
}
//******************************************************************************
/* void appendFrame (in gfxIImageFrame item); */
NS_IMETHODIMP imgContainer::AppendFrame(gfxIImageFrame *item)
{
// If we don't have a composite frame already allocated, make sure that our container
// size is the same the frame size. Otherwise, we'll either need the composite frame
// for animation compositing (GIF) or for filling in with a background color.
// XXX IMPORTANT: this means that the frame should be initialized BEFORE appending to container
PRUint32 numFrames;
this->GetNumFrames(&numFrames);
if(!mCompositingFrame) {
nsRect frameRect;
item->GetRect(frameRect);
// We used to create a compositing frame if any frame was smaller than the logical
// image size. You could create a single frame that was 10x10 in the middle of
// an 20x20 logical screen and have the extra screen space filled by the image
// background color. However, it turns out that neither NS4.x nor IE correctly
// support this, and as a result there are many GIFs out there that look "wrong"
// when this is correctly supported. So for now, we only create a compositing frame
// if we have more than one frame in the image.
if(/*(frameRect.x != 0) ||
(frameRect.y != 0) ||
(frameRect.width != mSize.width) ||
(frameRect.height != mSize.height) ||*/
(numFrames >= 1)) // Not sure if I want to create a composite frame for every anim. Could be smarter.
{
mCompositingFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");
mCompositingFrame->Init(0, 0, mSize.width, mSize.height, gfxIFormats::RGB);
nsCOMPtr<nsIImage> img(do_GetInterface(mCompositingFrame));
img->SetDecodedRect(0, 0, mSize.width, mSize.height);
nsCOMPtr<gfxIImageFrame> firstFrame;
this->GetFrameAt(0, getter_AddRefs(firstFrame));
firstFrame->DrawTo(mCompositingFrame, 0, 0, mSize.width, mSize.height);
}
}
// If this is our second frame, init a timer so we don't display
// the next frame until the delay timer has expired for the current
// frame.
if (!mTimer && (numFrames >= 1)) {
PRInt32 timeout;
nsCOMPtr<gfxIImageFrame> currentFrame;
this->GetFrameAt(mCurrentDecodingFrameIndex, getter_AddRefs(currentFrame));
currentFrame->GetTimeout(&timeout);
if (timeout != -1 &&
timeout >= 0) { // -1 means display this frame forever
if(mAnimating) {
// Since we have more than one frame we need a timer
mTimer = do_CreateInstance("@mozilla.org/timer;1");
mTimer->Init(
NS_STATIC_CAST(nsITimerCallback*, this),
timeout, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
}
}
}
if (numFrames > 0) mCurrentDecodingFrameIndex++;
mCurrentFrameIsFinishedDecoding = PR_FALSE;
return mFrames.AppendElement(NS_STATIC_CAST(nsISupports*, item));
}
//******************************************************************************
/* void removeFrame (in gfxIImageFrame item); */
NS_IMETHODIMP imgContainer::RemoveFrame(gfxIImageFrame *item)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* void endFrameDecode (in gfxIImageFrame item, in unsigned long timeout); */
NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum, PRUint32 aTimeout)
{
// It is now okay to start the timer for the next frame in the animation
mCurrentFrameIsFinishedDecoding = PR_TRUE;
nsCOMPtr<gfxIImageFrame> currentFrame;
this->GetFrameAt(aFrameNum-1, getter_AddRefs(currentFrame));
currentFrame->SetTimeout(aTimeout);
if (!mTimer && mAnimating){
PRUint32 numFrames;
this->GetNumFrames(&numFrames);
if (numFrames > 1) {
if (aTimeout != -1 &&
aTimeout >= 0) { // -1 means display this frame forever
mAnimating = PR_TRUE;
mTimer = do_CreateInstance("@mozilla.org/timer;1");
mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this),
aTimeout, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
}
}
}
return NS_OK;
}
//******************************************************************************
/* void decodingComplete (); */
NS_IMETHODIMP imgContainer::DecodingComplete(void)
{
mDoneDecoding = PR_TRUE;
return NS_OK;
}
//******************************************************************************
/* nsIEnumerator enumerate (); */
NS_IMETHODIMP imgContainer::Enumerate(nsIEnumerator **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void clear (); */
NS_IMETHODIMP imgContainer::Clear()
{
return mFrames.Clear();
}
//******************************************************************************
/* void startAnimation () */
NS_IMETHODIMP imgContainer::StartAnimation()
{
mAnimating = PR_TRUE;
if (mTimer)
return NS_OK;
PRUint32 numFrames;
this->GetNumFrames(&numFrames);
if (numFrames > 1) {
PRInt32 timeout;
nsCOMPtr<gfxIImageFrame> currentFrame;
this->GetCurrentFrame(getter_AddRefs(currentFrame));
if (currentFrame) {
currentFrame->GetTimeout(&timeout);
if (timeout != -1 &&
timeout >= 0) { // -1 means display this frame forever
mAnimating = PR_TRUE;
if(!mTimer) mTimer = do_CreateInstance("@mozilla.org/timer;1");
mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this),
timeout, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
}
} else {
// XXX hack.. the timer notify code will do the right thing, so just get that started
mAnimating = PR_TRUE;
if(!mTimer) mTimer = do_CreateInstance("@mozilla.org/timer;1");
mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this),
100, NS_PRIORITY_NORMAL, NS_TYPE_REPEATING_SLACK);
}
}
return NS_OK;
}
//******************************************************************************
/* void stopAnimation (); */
NS_IMETHODIMP imgContainer::StopAnimation()
{
mAnimating = PR_FALSE;
if (!mTimer)
return NS_OK;
mTimer->Cancel();
mTimer = nsnull;
// don't bother trying to change the frame (to 0, etc.) here.
// No one is listening.
return NS_OK;
}
//******************************************************************************
/* attribute long loopCount; */
NS_IMETHODIMP imgContainer::GetLoopCount(PRInt32 *aLoopCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP imgContainer::SetLoopCount(PRInt32 aLoopCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP_(void) imgContainer::Notify(nsITimer *timer)
{
NS_ASSERTION(mTimer == timer, "uh");
if(!mAnimating || !mTimer)
return;
nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
if (!observer) {
// the imgRequest that owns us is dead, we should die now too.
this->StopAnimation();
return;
}
nsCOMPtr<gfxIImageFrame> nextFrame;
PRInt32 timeout = 100;
PRUint32 numFrames;
GetNumFrames(&numFrames);
if(!numFrames)
return;
// If we're done decoding the next frame, go ahead and display it now and reinit
// the timer with the next frame's delay time.
PRUint32 previousAnimationFrameIndex = mCurrentAnimationFrameIndex;
if (mCurrentFrameIsFinishedDecoding && !mDoneDecoding) {
// If we have the next frame in the sequence set the timer callback from it
GetFrameAt(mCurrentAnimationFrameIndex+1, getter_AddRefs(nextFrame));
if (nextFrame) {
// Go to next frame in sequence
nextFrame->GetTimeout(&timeout);
mCurrentAnimationFrameIndex++;
} else {
// twiddle our thumbs
GetFrameAt(mCurrentAnimationFrameIndex, getter_AddRefs(nextFrame));
if(!nextFrame) return;
nextFrame->GetTimeout(&timeout);
}
} else if (mDoneDecoding){
if ((numFrames-1) == mCurrentAnimationFrameIndex) {
// Go back to the beginning of the animation
GetFrameAt(0, getter_AddRefs(nextFrame));
if(!nextFrame) return;
mCurrentAnimationFrameIndex = 0;
nextFrame->GetTimeout(&timeout);
} else {
mCurrentAnimationFrameIndex++;
GetFrameAt(mCurrentAnimationFrameIndex, getter_AddRefs(nextFrame));
if(!nextFrame) return;
nextFrame->GetTimeout(&timeout);
}
} else {
GetFrameAt(mCurrentAnimationFrameIndex, getter_AddRefs(nextFrame));
if(!nextFrame) return;
}
if(timeout >= 0)
mTimer->SetDelay(timeout);
else
this->StopAnimation();
nsRect dirtyRect;
// update the composited frame
if(mCompositingFrame && (previousAnimationFrameIndex != mCurrentAnimationFrameIndex)) {
nsCOMPtr<gfxIImageFrame> frameToUse;
DoComposite(getter_AddRefs(frameToUse), &dirtyRect, previousAnimationFrameIndex, mCurrentAnimationFrameIndex);
// do notification to FE to draw this frame, but hand it the compositing frame
observer->FrameChanged(this, nsnull, mCompositingFrame, &dirtyRect);
}
else {
nextFrame->GetRect(dirtyRect);
// do notification to FE to draw this frame
observer->FrameChanged(this, nsnull, nextFrame, &dirtyRect);
}
}
//******************************************************************************
// DoComposite gets called when the timer for animation get fired and we have to
// update the composited frame of the animation.
void imgContainer::DoComposite(gfxIImageFrame** aFrameToUse, nsRect* aDirtyRect, PRInt32 aPrevFrame, PRInt32 aNextFrame)
{
NS_ASSERTION(aDirtyRect, "DoComposite aDirtyRect is null");
NS_ASSERTION(mCompositingFrame, "DoComposite mCompositingFrame is null");
*aFrameToUse = nsnull;
PRUint32 numFrames;
this->GetNumFrames(&numFrames);
PRInt32 nextFrameIndex = aNextFrame;
PRInt32 prevFrameIndex = aPrevFrame;
if(nextFrameIndex >= numFrames) nextFrameIndex = numFrames-1;
if(prevFrameIndex >= numFrames) prevFrameIndex = numFrames-1;
nsCOMPtr<gfxIImageFrame> prevFrame;
this->GetFrameAt(prevFrameIndex, getter_AddRefs(prevFrame));
PRInt32 prevFrameDisposalMethod;
prevFrame->GetFrameDisposalMethod(&prevFrameDisposalMethod);
nsCOMPtr<gfxIImageFrame> nextFrame;
this->GetFrameAt(nextFrameIndex, getter_AddRefs(nextFrame));
PRInt32 x;
PRInt32 y;
PRInt32 width;
PRInt32 height;
nextFrame->GetX(&x);
nextFrame->GetY(&y);
nextFrame->GetWidth(&width);
nextFrame->GetHeight(&height);
switch (prevFrameDisposalMethod) {
default:
case 0: // DISPOSE_NOT_SPECIFIED
case 1: // DISPOSE_KEEP Leave previous frame in the framebuffer
mCompositingFrame->QueryInterface(NS_GET_IID(gfxIImageFrame), (void**)aFrameToUse); // addrefs again
//XXX blit into the composite frame too!!!
nextFrame->DrawTo(mCompositingFrame, x, y, width, height);
// we're drawing only the updated frame
(*aDirtyRect).x = x;
(*aDirtyRect).y = y;
(*aDirtyRect).width = width;
(*aDirtyRect).height = height;
break;
case 2: // DISPOSE_OVERWRITE_BGCOLOR Overwrite with background color
//XXX overwrite mCompositeFrame with background color
gfx_color backgroundColor;
nextFrame->GetBackgroundColor(&backgroundColor);
//XXX Do background color overwrite of mCompositeFrame here
// blit next frame into this clean slate
nextFrame->DrawTo(mCompositingFrame, x, y, width, height);
// In this case we need to blit the whole composite frame
(*aDirtyRect).x = 0;
(*aDirtyRect).y = 0;
(*aDirtyRect).width = mSize.width;
(*aDirtyRect).height = mSize.height;
mCompositingFrame->QueryInterface(NS_GET_IID(gfxIImageFrame), (void**)aFrameToUse); // addrefs again
break;
case 4: // DISPOSE_OVERWRITE_PREVIOUS Save-under
//XXX Reblit previous composite into frame buffer
//
(*aDirtyRect).x = 0;
(*aDirtyRect).y = 0;
(*aDirtyRect).width = mSize.width;
(*aDirtyRect).height = mSize.height;
break;
}
// Get the next frame's disposal method, if it is it DISPOSE_OVER, save off
// this mCompositeFrame for reblitting when this timer gets fired again and
// we
PRInt32 nextFrameDisposalMethod;
nextFrame->GetFrameDisposalMethod(&nextFrameDisposalMethod);
//XXX if(nextFrameDisposalMethod == 4)
// blit mPreviousCompositeFrame with this frame
}
//******************************************************************************
/* void onStartDecode (in imgIRequest aRequest, in nsISupports cx); */
NS_IMETHODIMP imgContainer::OnStartDecode(imgIRequest *aRequest, nsISupports *cx)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* void onStartContainer (in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer); */
NS_IMETHODIMP imgContainer::OnStartContainer(imgIRequest *aRequest, nsISupports *cx, imgIContainer *aContainer)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* void onStartFrame (in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame); */
NS_IMETHODIMP imgContainer::OnStartFrame(imgIRequest *aRequest, nsISupports *cx, gfxIImageFrame *aFrame)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* [noscript] void onDataAvailable (in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame, [const] in nsRect aRect); */
NS_IMETHODIMP imgContainer::OnDataAvailable(imgIRequest *aRequest, nsISupports *cx, gfxIImageFrame *aFrame, const nsRect * aRect)
{
if(mCompositingFrame && !mCurrentDecodingFrameIndex) {
// Update the composite frame
PRInt32 x;
aFrame->GetX(&x);
aFrame->DrawTo(mCompositingFrame, x, aRect->y, aRect->width, aRect->height);
}
return NS_OK;
}
//******************************************************************************
/* void onStopFrame (in imgIRequest aRequest, in nsISupports cx, in gfxIImageFrame aFrame); */
NS_IMETHODIMP imgContainer::OnStopFrame(imgIRequest *aRequest, nsISupports *cx, gfxIImageFrame *aFrame)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* void onStopContainer (in imgIRequest aRequest, in nsISupports cx, in imgIContainer aContainer); */
NS_IMETHODIMP imgContainer::OnStopContainer(imgIRequest *aRequest, nsISupports *cx, imgIContainer *aContainer)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* void onStopDecode (in imgIRequest aRequest, in nsISupports cx, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP imgContainer::OnStopDecode(imgIRequest *aRequest, nsISupports *cx, nsresult status, const PRUnichar *statusArg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//******************************************************************************
/* [noscript] void frameChanged (in imgIContainer aContainer, in nsISupports aCX, in gfxIImageFrame aFrame, in nsRect aDirtyRect); */
NS_IMETHODIMP imgContainer::FrameChanged(imgIContainer *aContainer, nsISupports *aCX, gfxIImageFrame *aFrame, nsRect * aDirtyRect)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -0,0 +1,95 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
* Chris Saari <saari@netscape.com>
*/
#ifndef __imgContainer_h__
#define __imgContainer_h__
#include "imgIContainer.h"
#include "imgIContainerObserver.h"
#include "nsSize.h"
#include "nsSupportsArray.h"
#include "nsCOMPtr.h"
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
#include "nsWeakReference.h"
#define NS_IMGCONTAINER_CID \
{ /* 5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0 */ \
0x5e04ec5e, \
0x1dd2, \
0x11b2, \
{0x8f, 0xda, 0xc4, 0xdb, 0x5f, 0xb6, 0x66, 0xe0} \
}
class imgContainer : public imgIContainer,
public nsITimerCallback,
public imgIDecoderObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGICONTAINER
NS_DECL_IMGIDECODEROBSERVER
NS_DECL_IMGICONTAINEROBSERVER
NS_IMETHOD_(void) Notify(nsITimer *timer);
imgContainer();
virtual ~imgContainer();
private:
/* additional members */
nsSupportsArray mFrames;
nsSize mSize;
PRUint32 mCurrentDecodingFrameIndex; // 0 to numFrames-1
PRUint32 mCurrentAnimationFrameIndex; // 0 to numFrames-1
PRBool mCurrentFrameIsFinishedDecoding;
PRBool mDoneDecoding;
PRBool mAnimating;
nsWeakPtr mObserver;
// GIF specific bits
nsCOMPtr<nsITimer> mTimer;
// GIF animations will use the mCompositingFrame to composite images
// and just hand this back to the caller when it is time to draw the frame.
nsCOMPtr<gfxIImageFrame> mCompositingFrame;
// Private function for doing the frame compositing of animations and in cases
// where there is a backgound color and single frame placed withing a larger
// logical screen size. Smart GIF compressors may do this to save space.
void DoComposite(gfxIImageFrame** aFrameToUse, nsRect* aDirtyRect,
PRInt32 aPrevFrame, PRInt32 aNextFrame);
};
#endif /* __imgContainer_h__ */

View File

@@ -0,0 +1,242 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgLoader.h"
#include "imgIRequest.h"
#include "nsIServiceManager.h"
#include "nsIChannel.h"
#include "nsIIOService.h"
#include "nsILoadGroup.h"
#include "nsIStreamListener.h"
#include "nsIURI.h"
#include "imgRequest.h"
#include "imgRequestProxy.h"
#include "ImageCache.h"
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "ImageLogging.h"
NS_IMPL_ISUPPORTS1(imgLoader, imgILoader)
imgLoader::imgLoader()
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
imgLoader::~imgLoader()
{
/* destructor code */
}
/* imgIRequest loadImage (in nsIURI uri, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports cx); */
NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver, nsISupports *cx, imgIRequest **_retval)
{
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
if (!aURI)
return NS_ERROR_NULL_POINTER;
#if defined(PR_LOGGING)
nsXPIDLCString spec;
aURI->GetSpec(getter_Copies(spec));
LOG_SCOPE_WITH_PARAM(gImgLog, "imgLoader::LoadImage", "aURI", spec.get());
#endif
imgRequest *request = nsnull;
#ifdef MOZ_NEW_CACHE
nsCOMPtr<nsICacheEntryDescriptor> entry;
ImageCache::Get(aURI, &request, getter_AddRefs(entry)); // addrefs request
if (request && entry && aLoadGroup) {
/* this isn't exactly what I want here. This code will re-doom every cache hit in a document while
it is force reloading. So for multiple copies of an image on a page, when you force reload, this
will cause you to get seperate loads for each copy of the image... this sucks.
*/
PRUint32 flags = 0;
PRBool doomRequest = PR_FALSE;
aLoadGroup->GetDefaultLoadAttributes(&flags);
if (flags & nsIChannel::FORCE_RELOAD)
doomRequest = PR_TRUE;
else {
nsCOMPtr<nsIRequest> r;
aLoadGroup->GetDefaultLoadRequest(getter_AddRefs(r));
if (r) {
nsCOMPtr<nsIChannel> c(do_QueryInterface(r));
if (c) {
c->GetLoadAttributes(&flags);
if (flags & nsIChannel::FORCE_RELOAD)
doomRequest = PR_TRUE;
}
}
}
if (doomRequest) {
entry->Doom(); // doom this thing.
entry = nsnull;
NS_RELEASE(request);
request = nsnull;
}
}
#endif
if (!request) {
/* no request from the cache. do a new load */
LOG_SCOPE(gImgLog, "imgLoader::LoadImage |cache miss|");
nsCOMPtr<nsIIOService> ioserv(do_GetService("@mozilla.org/network/io-service;1"));
if (!ioserv) return NS_ERROR_FAILURE;
nsCOMPtr<nsIChannel> newChannel;
ioserv->NewChannelFromURI(aURI, getter_AddRefs(newChannel));
if (!newChannel) return NS_ERROR_FAILURE;
if (aLoadGroup) {
PRUint32 flags;
aLoadGroup->GetDefaultLoadAttributes(&flags);
newChannel->SetLoadAttributes(flags);
}
NS_NEWXPCOM(request, imgRequest);
if (!request) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(request);
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request));
#ifdef MOZ_NEW_CACHE
ImageCache::Put(aURI, request, getter_AddRefs(entry));
#endif
#ifdef MOZ_NEW_CACHE
request->Init(newChannel, entry);
#else
request->Init(newChannel, nsnull);
#endif
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- Calling channel->AsyncOpen()\n", this));
// XXX are we calling this too early?
newChannel->AsyncOpen(NS_STATIC_CAST(nsIStreamListener *, request), nsnull);
} else {
/* request found in cache. use it */
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage |cache hit| [request=%p]\n",
this, request));
}
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- creating proxy request.\n", this));
imgRequestProxy *proxyRequest;
NS_NEWXPCOM(proxyRequest, imgRequestProxy);
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(proxyRequest);
// init adds itself to imgRequest's list of observers
proxyRequest->Init(request, aLoadGroup, aObserver, cx);
NS_RELEASE(request);
*_retval = NS_STATIC_CAST(imgIRequest*, proxyRequest);
NS_ADDREF(*_retval);
NS_RELEASE(proxyRequest);
return NS_OK;
}
/* imgIRequest loadImageWithChannel(in nsIChannel, in imgIDecoderObserver aObserver, in nsISupports cx, out nsIStreamListener); */
NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderObserver *aObserver, nsISupports *cx, nsIStreamListener **listener, imgIRequest **_retval)
{
NS_ASSERTION(channel, "imgLoader::LoadImageWithChannel -- NULL channel pointer");
imgRequest *request = nsnull;
nsCOMPtr<nsIURI> uri;
channel->GetOriginalURI(getter_AddRefs(uri));
#ifdef MOZ_NEW_CACHE
nsCOMPtr<nsICacheEntryDescriptor> entry;
ImageCache::Get(uri, &request, getter_AddRefs(entry)); // addrefs request
#endif
if (request) {
// we have this in our cache already.. cancel the current (document) load
// XXX
// if *listener is null when we return here, the caller should probably cancel
// the channel instead of us doing it here.
channel->Cancel(NS_BINDING_ABORTED); // this should fire an OnStopRequest
*listener = nsnull; // give them back a null nsIStreamListener
} else {
NS_NEWXPCOM(request, imgRequest);
if (!request) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(request);
#ifdef MOZ_NEW_CACHE
ImageCache::Put(uri, request, getter_AddRefs(entry));
#endif
#ifdef MOZ_NEW_CACHE
request->Init(channel, entry);
#else
request->Init(channel, nsnull);
#endif
*listener = NS_STATIC_CAST(nsIStreamListener*, request);
NS_IF_ADDREF(*listener);
}
imgRequestProxy *proxyRequest;
NS_NEWXPCOM(proxyRequest, imgRequestProxy);
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(proxyRequest);
// init adds itself to imgRequest's list of observers
proxyRequest->Init(request, nsnull, aObserver, cx);
NS_RELEASE(request);
*_retval = NS_STATIC_CAST(imgIRequest*, proxyRequest);
NS_ADDREF(*_retval);
NS_RELEASE(proxyRequest);
return NS_OK;
}

View File

@@ -0,0 +1,48 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgILoader.h"
#ifdef LOADER_THREADSAFE
#include "prlock.h"
#endif
#define NS_IMGLOADER_CID \
{ /* 9f6a0d2e-1dd1-11b2-a5b8-951f13c846f7 */ \
0x9f6a0d2e, \
0x1dd1, \
0x11b2, \
{0xa5, 0xb8, 0x95, 0x1f, 0x13, 0xc8, 0x46, 0xf7} \
}
class imgLoader : public imgILoader
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGILOADER
imgLoader();
virtual ~imgLoader();
private:
};

View File

@@ -0,0 +1,821 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgRequest.h"
#include "nsIAtom.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsIHTTPChannel.h"
#include "nsIInputStream.h"
#include "imgILoader.h"
#include "nsIComponentManager.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "gfxIImageFrame.h"
#ifdef MOZ_NEW_CACHE
#include "nsICachingChannel.h"
#endif
#include "ImageCache.h"
#include "ImageLogging.h"
#if defined(PR_LOGGING)
PRLogModuleInfo *gImgLog = PR_NewLogModule("imgRequest");
#endif
NS_IMPL_ISUPPORTS7(imgRequest, imgIRequest, nsIRequest,
imgIDecoderObserver, imgIContainerObserver,
nsIStreamListener, nsIStreamObserver,
nsISupportsWeakReference)
imgRequest::imgRequest() :
mObservers(0), mLoading(PR_FALSE), mProcessing(PR_FALSE), mStatus(imgIRequest::STATUS_NONE), mState(0)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
imgRequest::~imgRequest()
{
/* destructor code */
}
nsresult imgRequest::Init(nsIChannel *aChannel, nsICacheEntryDescriptor *aCacheEntry)
{
// XXX we should save off the thread we are getting called on here so that we can proxy all calls to mDecoder to it.
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::Init\n", this));
NS_ASSERTION(!mImage, "imgRequest::Init -- Multiple calls to init");
NS_ASSERTION(aChannel, "imgRequest::Init -- No channel");
mChannel = aChannel;
#ifdef MOZ_NEW_CACHE
mCacheEntry = aCacheEntry;
#endif
// XXX do not init the image here. this has to be done from the image decoder.
mImage = do_CreateInstance("@mozilla.org/image/container;1");
return NS_OK;
}
nsresult imgRequest::AddObserver(imgIDecoderObserver *observer)
{
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::AddObserver", "observer", observer);
mObservers.AppendElement(NS_STATIC_CAST(void*, observer));
// OnStartDecode
if (mState & onStartDecode)
observer->OnStartDecode(nsnull, nsnull);
// OnStartContainer
if (mState & onStartContainer)
observer->OnStartContainer(nsnull, nsnull, mImage);
// Send frame messages (OnStartFrame, OnDataAvailable, OnStopFrame)
PRUint32 nframes;
mImage->GetNumFrames(&nframes);
if (nframes > 0) {
nsCOMPtr<gfxIImageFrame> frame;
// Is this a single frame image?
if (nframes == 1) {
// Get the first frame
mImage->GetFrameAt(0, getter_AddRefs(frame));
NS_ASSERTION(frame, "GetFrameAt gave back a null frame!");
} else if (nframes > 1) {
/* multiple frames, we'll use the current one */
mImage->GetCurrentFrame(getter_AddRefs(frame));
NS_ASSERTION(frame, "GetCurrentFrame gave back a null frame!");
}
// OnStartFrame
observer->OnStartFrame(nsnull, nsnull, frame);
if (!(mState & onStopContainer)) {
// OnDataAvailable
nsRect r;
frame->GetRect(r); // XXX we shouldn't send the whole rect here
observer->OnDataAvailable(nsnull, nsnull, frame, &r);
} else {
// OnDataAvailable
nsRect r;
frame->GetRect(r); // We're done loading this image, send the the whole rect
observer->OnDataAvailable(nsnull, nsnull, frame, &r);
// OnStopFrame
observer->OnStopFrame(nsnull, nsnull, frame);
}
}
// OnStopContainer
if (mState & onStopContainer)
observer->OnStopContainer(nsnull, nsnull, mImage);
nsresult status;
if (mStatus & imgIRequest::STATUS_LOAD_COMPLETE)
status = NS_IMAGELIB_SUCCESS_LOAD_FINISHED;
else if (mStatus & imgIRequest::STATUS_ERROR)
status = NS_IMAGELIB_ERROR_FAILURE;
// OnStopDecode
if (mState & onStopDecode)
observer->OnStopDecode(nsnull, nsnull, status, nsnull);
if (mImage && (mObservers.Count() == 1)) {
PRUint32 nframes;
mImage->GetNumFrames(&nframes);
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::AddObserver -- starting animation\n", this));
mImage->StartAnimation();
}
if (mState & onStopRequest) {
nsCOMPtr<nsIStreamObserver> ob(do_QueryInterface(observer));
PR_ASSERT(observer);
ob->OnStopRequest(nsnull, nsnull, status, nsnull);
}
return NS_OK;
}
nsresult imgRequest::RemoveObserver(imgIDecoderObserver *observer, nsresult status)
{
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::RemoveObserver", "observer", observer);
mObservers.RemoveElement(NS_STATIC_CAST(void*, observer));
if (mObservers.Count() == 0) {
if (mImage) {
PRUint32 nframes;
mImage->GetNumFrames(&nframes);
if (nframes > 1) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::RemoveObserver -- stopping animation\n", this));
mImage->StopAnimation();
}
}
if (mChannel && mLoading) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::RemoveObserver -- load in progress. canceling\n", this));
this->RemoveFromCache();
this->Cancel(NS_BINDING_ABORTED);
if (!(mState & onStopDecode)) {
// make sure that observer gets an onStopRequest message sent to it
observer->OnStopDecode(nsnull, nsnull, NS_IMAGELIB_ERROR_FAILURE, nsnull);
}
if (!(mState & onStopRequest)) {
// make sure that observer gets an onStopRequest message sent to it
nsCOMPtr<nsIStreamObserver> ob(do_QueryInterface(observer));
PR_ASSERT(observer);
ob->OnStopRequest(nsnull, nsnull, NS_BINDING_ABORTED, nsnull);
}
}
}
return NS_OK;
}
PRBool imgRequest::RemoveFromCache()
{
LOG_SCOPE(gImgLog, "imgRequest::RemoveFromCache");
#ifdef MOZ_NEW_CACHE
if (mCacheEntry) {
mCacheEntry->Doom();
mCacheEntry = nsnull;
} else {
NS_WARNING("imgRequest::RemoveFromCache -- no entry!");
}
#endif
return PR_TRUE;
}
/** nsIRequest / imgIRequest methods **/
/* readonly attribute wstring name; */
NS_IMETHODIMP imgRequest::GetName(PRUnichar * *aName)
{
NS_NOTYETIMPLEMENTED("imgRequest::GetName");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean isPending (); */
NS_IMETHODIMP imgRequest::IsPending(PRBool *_retval)
{
NS_NOTYETIMPLEMENTED("imgRequest::IsPending");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsresult status; */
NS_IMETHODIMP imgRequest::GetStatus(nsresult *aStatus)
{
NS_NOTYETIMPLEMENTED("imgRequest::GetStatus");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void cancel (in nsresult status); */
NS_IMETHODIMP imgRequest::Cancel(nsresult status)
{
LOG_SCOPE(gImgLog, "imgRequest::Cancel");
if (mImage) {
PRUint32 nframes;
mImage->GetNumFrames(&nframes);
if (nframes > 1) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::RemoveObserver -- stopping animation\n", this));
mImage->StopAnimation();
}
}
if (mChannel && mLoading)
mChannel->Cancel(NS_BINDING_ABORTED); // should prolly use status here
return NS_OK;
}
/* void suspend (); */
NS_IMETHODIMP imgRequest::Suspend()
{
NS_NOTYETIMPLEMENTED("imgRequest::Suspend");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void resume (); */
NS_IMETHODIMP imgRequest::Resume()
{
NS_NOTYETIMPLEMENTED("imgRequest::Resume");
return NS_ERROR_NOT_IMPLEMENTED;
}
/** imgIRequest methods **/
/* readonly attribute imgIContainer image; */
NS_IMETHODIMP imgRequest::GetImage(imgIContainer * *aImage)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::GetImage\n", this));
*aImage = mImage;
NS_IF_ADDREF(*aImage);
return NS_OK;
}
/* readonly attribute unsigned long imageStatus; */
NS_IMETHODIMP imgRequest::GetImageStatus(PRUint32 *aStatus)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::GetImageStatus\n", this));
*aStatus = mStatus;
return NS_OK;
}
/* readonly attribute nsIURI URI; */
NS_IMETHODIMP imgRequest::GetURI(nsIURI **aURI)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::GetURI\n", this));
if (mChannel)
return mChannel->GetOriginalURI(aURI);
else if (mURI) {
*aURI = mURI;
NS_ADDREF(*aURI);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute imgIDecoderObserver decoderObserver; */
NS_IMETHODIMP imgRequest::GetDecoderObserver(imgIDecoderObserver **aDecoderObserver)
{
return NS_ERROR_FAILURE;
}
/** imgIContainerObserver methods **/
/* [noscript] void frameChanged (in imgIContainer container, in nsISupports cx, in gfxIImageFrame newframe, in nsRect dirtyRect); */
NS_IMETHODIMP imgRequest::FrameChanged(imgIContainer *container, nsISupports *cx, gfxIImageFrame *newframe, nsRect * dirtyRect)
{
LOG_SCOPE(gImgLog, "imgRequest::FrameChanged");
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->FrameChanged(container, cx, newframe, dirtyRect);
}
return NS_OK;
}
/** imgIDecoderObserver methods **/
/* void onStartDecode (in imgIRequest request, in nsISupports cx); */
NS_IMETHODIMP imgRequest::OnStartDecode(imgIRequest *request, nsISupports *cx)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStartDecode");
mState |= onStartDecode;
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStartDecode(request, cx);
}
return NS_OK;
}
/* void onStartContainer (in imgIRequest request, in nsISupports cx, in imgIContainer image); */
NS_IMETHODIMP imgRequest::OnStartContainer(imgIRequest *request, nsISupports *cx, imgIContainer *image)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStartContainer");
mState |= onStartContainer;
mStatus |= imgIRequest::STATUS_SIZE_AVAILABLE;
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStartContainer(request, cx, image);
}
return NS_OK;
}
/* void onStartFrame (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame); */
NS_IMETHODIMP imgRequest::OnStartFrame(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStartFrame");
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStartFrame(request, cx, frame);
}
return NS_OK;
}
/* [noscript] void onDataAvailable (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame, [const] in nsRect rect); */
NS_IMETHODIMP imgRequest::OnDataAvailable(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame, const nsRect * rect)
{
LOG_SCOPE(gImgLog, "imgRequest::OnDataAvailable");
nsCOMPtr<imgIDecoderObserver> container = do_QueryInterface(mImage);
container->OnDataAvailable(request, cx, frame, rect);
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnDataAvailable(request, cx, frame, rect);
}
return NS_OK;
}
/* void onStopFrame (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame); */
NS_IMETHODIMP imgRequest::OnStopFrame(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame)
{
NS_ASSERTION(frame, "imgRequest::OnStopFrame called with NULL frame");
LOG_SCOPE(gImgLog, "imgRequest::OnStopFrame");
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
#ifdef MOZ_NEW_CACHE
if (mCacheEntry) {
PRUint32 cacheSize = 0;
mCacheEntry->GetDataSize(&cacheSize);
PRUint32 imageSize = 0;
PRUint32 alphaSize = 0;
frame->GetImageDataLength(&imageSize);
frame->GetAlphaDataLength(&alphaSize);
mCacheEntry->SetDataSize(cacheSize + imageSize + alphaSize);
}
#endif
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStopFrame(request, cx, frame);
}
return NS_OK;
}
/* void onStopContainer (in imgIRequest request, in nsISupports cx, in imgIContainer image); */
NS_IMETHODIMP imgRequest::OnStopContainer(imgIRequest *request, nsISupports *cx, imgIContainer *image)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStopContainer");
mState |= onStopContainer;
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStopContainer(request, cx, image);
}
return NS_OK;
}
/* void onStopDecode (in imgIRequest request, in nsISupports cx, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP imgRequest::OnStopDecode(imgIRequest *aRequest, nsISupports *aCX, nsresult aStatus, const PRUnichar *aStatusArg)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStopDecode");
if (mState & onStopDecode) {
NS_WARNING("OnStopDecode called multiple times.");
return NS_OK;
}
mState |= onStopDecode;
if (!(mStatus & imgIRequest::STATUS_ERROR) && NS_FAILED(aStatus))
mStatus |= imgIRequest::STATUS_ERROR;
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
nsresult status;
if (mStatus & imgIRequest::STATUS_LOAD_COMPLETE)
status = NS_IMAGELIB_SUCCESS_LOAD_FINISHED;
else if (mStatus & imgIRequest::STATUS_ERROR)
status = NS_IMAGELIB_ERROR_FAILURE;
while (++i < count) {
imgIDecoderObserver *ob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (ob) ob->OnStopDecode(aRequest, aCX, status, aStatusArg);
}
return NS_OK;
}
/** nsIStreamObserver methods **/
/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt)
{
LOG_SCOPE(gImgLog, "imgRequest::OnStartRequest");
NS_ASSERTION(!mDecoder, "imgRequest::OnStartRequest -- we already have a decoder");
NS_ASSERTION(!mLoading, "imgRequest::OnStartRequest -- we are loading again?");
/* set our loading flag to true */
mLoading = PR_TRUE;
/* notify our kids */
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
imgIDecoderObserver *iob = NS_STATIC_CAST(imgIDecoderObserver*, mObservers[i]);
if (iob) {
nsCOMPtr<nsIStreamObserver> ob(do_QueryInterface(iob));
if (ob) ob->OnStartRequest(aRequest, ctxt);
}
}
/* do our real work */
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
if (!mChannel) {
PR_LOG(gImgLog, PR_LOG_ALWAYS,
(" `-> Channel already stopped or no channel!?.\n"));
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIHTTPChannel> httpChannel(do_QueryInterface(chan));
if (httpChannel) {
PRUint32 httpStatus;
httpChannel->GetResponseStatus(&httpStatus);
if (httpStatus == 404) {
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::OnStartRequest -- http status = 404. canceling.\n", this));
mStatus |= imgIRequest::STATUS_ERROR;
this->Cancel(NS_BINDING_ABORTED);
this->RemoveFromCache();
return NS_BINDING_ABORTED;
}
}
/* get the expires info */
#if defined(MOZ_NEW_CACHE)
if (mCacheEntry) {
nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(chan));
if (cacheChannel) {
nsCOMPtr<nsISupports> cacheToken;
cacheChannel->GetCacheToken(getter_AddRefs(cacheToken));
if (cacheToken) {
nsCOMPtr<nsICacheEntryDescriptor> entryDesc(do_QueryInterface(cacheToken));
if (entryDesc) {
PRUint32 expiration;
/* get the expiration time from the caching channel's token */
entryDesc->GetExpirationTime(&expiration);
/* set the expiration time on our entry */
mCacheEntry->SetExpirationTime(expiration);
}
}
}
}
#endif
return NS_OK;
}
/* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::OnStopRequest\n", this));
NS_ASSERTION(mChannel && mLoading, "imgRequest::OnStopRequest -- received multiple OnStopRequest");
mState |= onStopRequest;
/* set our loading flag to false */
mLoading = PR_FALSE;
/* set our processing flag to false */
mProcessing = PR_FALSE;
#ifdef MOZ_NEW_CACHE
/* break the cycle from the cache entry. */
mCacheEntry = nsnull;
#endif
if (NS_FAILED(status)) {
mStatus |= imgIRequest::STATUS_ERROR;
this->RemoveFromCache();
this->Cancel(status); // stops animations
} else {
mStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
}
mChannel->GetOriginalURI(getter_AddRefs(mURI));
mChannel = nsnull; // we no longer need the channel
if (mDecoder) {
mDecoder->Flush();
mDecoder->Close();
mDecoder = nsnull; // release the decoder so that it can rest peacefully ;)
}
/* notify the kids */
PRInt32 i = -1;
PRInt32 count = mObservers.Count();
while (++i < count) {
void *item = NS_STATIC_CAST(void *, mObservers[i]);
if (item) {
imgIDecoderObserver *iob = NS_STATIC_CAST(imgIDecoderObserver*, item);
if (iob) {
nsCOMPtr<nsIStreamObserver> ob(do_QueryInterface(iob));
if (ob) ob->OnStopRequest(aRequest, ctxt, status, statusArg);
}
}
}
// if there was an error loading the image, (mState & onStopDecode) won't be true.
// Send an onStopDecode message
if (!(mState & onStopDecode)) {
this->OnStopDecode(nsnull, nsnull, status, statusArg);
}
return NS_OK;
}
/* prototype for this defined below */
static NS_METHOD sniff_mimetype_callback(nsIInputStream* in, void* closure, const char* fromRawSegment,
PRUint32 toOffset, PRUint32 count, PRUint32 *writeCount);
/** nsIStreamListener methods **/
/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::OnDataAvailable\n", this));
NS_ASSERTION(mChannel, "imgRequest::OnDataAvailable -- no channel!");
if (!mProcessing) {
/* set our processing flag to true if this is the first OnDataAvailable() */
mProcessing = PR_TRUE;
/* look at the first few bytes and see if we can tell what the data is from that
* since servers tend to lie. :(
*/
PRUint32 out;
inStr->ReadSegments(sniff_mimetype_callback, this, count, &out);
#ifdef NS_DEBUG
/* NS_WARNING if the content type from the channel isn't the same if the sniffing */
#endif
if (!mContentType.get()) {
nsXPIDLCString contentType;
nsresult rv = mChannel->GetContentType(getter_Copies(contentType));
if (NS_FAILED(rv)) {
PR_LOG(gImgLog, PR_LOG_ERROR,
("[this=%p] imgRequest::OnStartRequest -- Content type unavailable from the channel\n",
this));
this->RemoveFromCache();
return NS_BINDING_ABORTED; //NS_BASE_STREAM_CLOSED;
}
mContentType = contentType;
}
#if defined(PR_LOGGING)
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequest::OnStartRequest -- Content type is %s\n", this, mContentType.get()));
#endif
nsCAutoString conid("@mozilla.org/image/decoder;2?type=");
conid += mContentType.get();
mDecoder = do_CreateInstance(conid);
if (!mDecoder) {
PR_LOG(gImgLog, PR_LOG_WARNING,
("[this=%p] imgRequest::OnStartRequest -- Decoder not available\n", this));
// no image decoder for this mimetype :(
this->Cancel(NS_BINDING_ABORTED);
this->RemoveFromCache();
// XXX notify the person that owns us now that wants the imgIContainer off of us?
return NS_IMAGELIB_ERROR_NO_DECODER;
}
mDecoder->Init(NS_STATIC_CAST(imgIRequest*, this));
}
if (!mDecoder) {
PR_LOG(gImgLog, PR_LOG_WARNING,
("[this=%p] imgRequest::OnDataAvailable -- no decoder\n", this));
return NS_BASE_STREAM_CLOSED;
}
PRUint32 wrote;
nsresult rv = mDecoder->WriteFrom(inStr, count, &wrote);
return NS_OK;
}
static NS_METHOD sniff_mimetype_callback(nsIInputStream* in,
void* closure,
const char* fromRawSegment,
PRUint32 toOffset,
PRUint32 count,
PRUint32 *writeCount)
{
imgRequest *request = NS_STATIC_CAST(imgRequest*, closure);
NS_ASSERTION(request, "request is null!");
if (count > 0)
request->SniffMimeType(fromRawSegment, count);
*writeCount = 0;
return NS_ERROR_FAILURE;
}
void
imgRequest::SniffMimeType(const char *buf, PRUint32 len)
{
/* Is it a GIF? */
if (len >= 4 && !nsCRT::strncmp(buf, "GIF8", 4)) {
mContentType = NS_LITERAL_CSTRING("image/gif");
return;
}
/* or a PNG? */
if (len >= 4 && ((unsigned char)buf[0]==0x89 &&
(unsigned char)buf[1]==0x50 &&
(unsigned char)buf[2]==0x4E &&
(unsigned char)buf[3]==0x47))
{
mContentType = NS_LITERAL_CSTRING("image/png");
return;
}
/* maybe a JPEG (JFIF)? */
/* JFIF files start with SOI APP0 but older files can start with SOI DQT
* so we test for SOI followed by any marker, i.e. FF D8 FF
* this will also work for SPIFF JPEG files if they appear in the future.
*
* (JFIF is 0XFF 0XD8 0XFF 0XE0 <skip 2> 0X4A 0X46 0X49 0X46 0X00)
*/
if (len >= 3 &&
((unsigned char)buf[0])==0xFF &&
((unsigned char)buf[1])==0xD8 &&
((unsigned char)buf[2])==0xFF)
{
mContentType = NS_LITERAL_CSTRING("image/jpeg");
return;
}
/* or how about ART? */
/* ART begins with JG (4A 47). Major version offset 2.
* Minor version offset 3. Offset 4 must be NULL.
*/
if (len >= 5 &&
((unsigned char) buf[0])==0x4a &&
((unsigned char) buf[1])==0x47 &&
((unsigned char) buf[4])==0x00 )
{
mContentType = NS_LITERAL_CSTRING("image/x-jg");
return;
}
/* none of the above? I give up */
}

View File

@@ -0,0 +1,113 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef imgRequest_h__
#define imgRequest_h__
#include "imgIRequest.h"
#include "nsIRunnable.h"
#include "nsIChannel.h"
#include "nsIURI.h"
#include "imgIContainer.h"
#include "imgIDecoder.h"
#include "imgIDecoderObserver.h"
#include "nsIStreamListener.h"
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsWeakReference.h"
#include "nsString.h"
#ifdef MOZ_NEW_CACHE
#include "nsICacheEntryDescriptor.h"
#else
class nsICacheEntryDescriptor;
#endif
#define NS_IMGREQUEST_CID \
{ /* 9f733dd6-1dd1-11b2-8cdf-effb70d1ea71 */ \
0x9f733dd6, \
0x1dd1, \
0x11b2, \
{0x8c, 0xdf, 0xef, 0xfb, 0x70, 0xd1, 0xea, 0x71} \
}
enum {
onStartDecode = 0x1,
onStartContainer = 0x2,
onStopContainer = 0x4,
onStopDecode = 0x8,
onStopRequest = 0x16
};
class imgRequest : public imgIRequest,
public imgIDecoderObserver,
public nsIStreamListener,
public nsSupportsWeakReference
{
public:
imgRequest();
virtual ~imgRequest();
/* additional members */
nsresult Init(nsIChannel *aChannel, nsICacheEntryDescriptor *aCacheEntry);
nsresult AddObserver(imgIDecoderObserver *observer);
nsresult RemoveObserver(imgIDecoderObserver *observer, nsresult status);
PRBool RemoveFromCache();
void SniffMimeType(const char *buf, PRUint32 len);
NS_DECL_ISUPPORTS
NS_DECL_IMGIREQUEST
NS_DECL_NSIREQUEST
NS_DECL_IMGIDECODEROBSERVER
NS_DECL_IMGICONTAINEROBSERVER
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSISTREAMOBSERVER
private:
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<imgIContainer> mImage;
nsCOMPtr<imgIDecoder> mDecoder;
nsVoidArray mObservers;
PRBool mLoading;
PRBool mProcessing;
PRUint32 mStatus;
PRUint32 mState;
nsCString mContentType;
#ifdef MOZ_NEW_CACHE
nsCOMPtr<nsICacheEntryDescriptor> mCacheEntry; /* we hold on to this to this so long as we have observers */
#endif
};
#endif

View File

@@ -0,0 +1,316 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgRequestProxy.h"
#include "nsXPIDLString.h"
#include "nsIInputStream.h"
#include "imgILoader.h"
#include "nsIComponentManager.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "imgRequest.h"
#include "nsString.h"
#include "DummyChannel.h"
#include "nspr.h"
#include "ImageLogging.h"
NS_IMPL_ISUPPORTS5(imgRequestProxy, imgIRequest, nsIRequest, imgIDecoderObserver, imgIContainerObserver, nsIStreamObserver)
imgRequestProxy::imgRequestProxy() :
mCanceled(PR_FALSE)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
imgRequestProxy::~imgRequestProxy()
{
/* destructor code */
// XXX pav
// it isn't the job of the request proxy to cancel itself.
// if your object goes away and you want to cancel the load, then do it yourself.
// cancel here for now until i make this work right like the above comment
Cancel(NS_ERROR_FAILURE);
}
nsresult imgRequestProxy::Init(imgRequest *request, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver, nsISupports *cx)
{
PR_ASSERT(request);
LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequestProxy::Init", "request", request);
mOwner = NS_STATIC_CAST(imgIRequest*, request);
mObserver = aObserver;
// XXX we should save off the thread we are getting called on here so that we can proxy all calls to mDecoder to it.
mContext = cx;
// XXX we should only create a channel, etc if the image isn't finished loading already.
nsISupports *inst = nsnull;
inst = new DummyChannel(this, aLoadGroup);
NS_ADDREF(inst);
nsresult res = inst->QueryInterface(NS_GET_IID(nsIChannel), getter_AddRefs(mDummyChannel));
NS_RELEASE(inst);
nsCOMPtr<nsILoadGroup> loadGroup;
mDummyChannel->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup) {
loadGroup->AddRequest(mDummyChannel, cx);
}
request->AddObserver(this);
return NS_OK;
}
/** nsIRequest / imgIRequest methods **/
/* readonly attribute wstring name; */
NS_IMETHODIMP imgRequestProxy::GetName(PRUnichar * *aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean isPending (); */
NS_IMETHODIMP imgRequestProxy::IsPending(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsresult status; */
NS_IMETHODIMP imgRequestProxy::GetStatus(nsresult *aStatus)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void cancel (in nsresult status); */
NS_IMETHODIMP imgRequestProxy::Cancel(nsresult status)
{
if (mCanceled)
return NS_ERROR_FAILURE;
LOG_SCOPE(gImgLog, "imgRequestProxy::Cancel");
mCanceled = PR_TRUE;
NS_ASSERTION(mOwner, "canceling request proxy twice");
nsresult rv = NS_REINTERPRET_CAST(imgRequest*, mOwner.get())->RemoveObserver(this, status);
mOwner = nsnull;
return rv;
}
/* void suspend (); */
NS_IMETHODIMP imgRequestProxy::Suspend()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void resume (); */
NS_IMETHODIMP imgRequestProxy::Resume()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/** imgIRequest methods **/
/* readonly attribute imgIContainer image; */
NS_IMETHODIMP imgRequestProxy::GetImage(imgIContainer * *aImage)
{
if (!mOwner)
return NS_ERROR_FAILURE;
return mOwner->GetImage(aImage);
}
/* readonly attribute unsigned long imageStatus; */
NS_IMETHODIMP imgRequestProxy::GetImageStatus(PRUint32 *aStatus)
{
if (!mOwner) {
*aStatus = imgIRequest::STATUS_ERROR;
return NS_ERROR_FAILURE;
}
return mOwner->GetImageStatus(aStatus);
}
/* readonly attribute nsIURI URI; */
NS_IMETHODIMP imgRequestProxy::GetURI(nsIURI **aURI)
{
if (!mOwner)
return NS_ERROR_FAILURE;
return mOwner->GetURI(aURI);
}
/* readonly attribute imgIDecoderObserver decoderObserver; */
NS_IMETHODIMP imgRequestProxy::GetDecoderObserver(imgIDecoderObserver **aDecoderObserver)
{
*aDecoderObserver = mObserver;
NS_IF_ADDREF(*aDecoderObserver);
return NS_OK;
}
/** imgIContainerObserver methods **/
/* [noscript] void frameChanged (in imgIContainer container, in nsISupports cx, in gfxIImageFrame newframe, in nsRect dirtyRect); */
NS_IMETHODIMP imgRequestProxy::FrameChanged(imgIContainer *container, nsISupports *cx, gfxIImageFrame *newframe, nsRect * dirtyRect)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::FrameChanged\n", this));
if (mObserver)
mObserver->FrameChanged(container, mContext, newframe, dirtyRect);
return NS_OK;
}
/** imgIDecoderObserver methods **/
/* void onStartDecode (in imgIRequest request, in nsISupports cx); */
NS_IMETHODIMP imgRequestProxy::OnStartDecode(imgIRequest *request, nsISupports *cx)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStartDecode\n", this));
if (mObserver)
mObserver->OnStartDecode(this, mContext);
return NS_OK;
}
/* void onStartContainer (in imgIRequest request, in nsISupports cx, in imgIContainer image); */
NS_IMETHODIMP imgRequestProxy::OnStartContainer(imgIRequest *request, nsISupports *cx, imgIContainer *image)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStartContainer\n", this));
if (mObserver)
mObserver->OnStartContainer(this, mContext, image);
return NS_OK;
}
/* void onStartFrame (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame); */
NS_IMETHODIMP imgRequestProxy::OnStartFrame(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStartFrame\n", this));
if (mObserver)
mObserver->OnStartFrame(this, mContext, frame);
return NS_OK;
}
/* [noscript] void onDataAvailable (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame, [const] in nsRect rect); */
NS_IMETHODIMP imgRequestProxy::OnDataAvailable(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame, const nsRect * rect)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnDataAvailable\n", this));
if (mObserver)
mObserver->OnDataAvailable(this, mContext, frame, rect);
return NS_OK;
}
/* void onStopFrame (in imgIRequest request, in nsISupports cx, in gfxIImageFrame frame); */
NS_IMETHODIMP imgRequestProxy::OnStopFrame(imgIRequest *request, nsISupports *cx, gfxIImageFrame *frame)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStopFrame\n", this));
if (mObserver)
mObserver->OnStopFrame(this, mContext, frame);
return NS_OK;
}
/* void onStopContainer (in imgIRequest request, in nsISupports cx, in imgIContainer image); */
NS_IMETHODIMP imgRequestProxy::OnStopContainer(imgIRequest *request, nsISupports *cx, imgIContainer *image)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStopContainer\n", this));
if (mObserver)
mObserver->OnStopContainer(this, mContext, image);
return NS_OK;
}
/* void onStopDecode (in imgIRequest request, in nsISupports cx, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP imgRequestProxy::OnStopDecode(imgIRequest *request, nsISupports *cx, nsresult status, const PRUnichar *statusArg)
{
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgRequestProxy::OnStopDecode\n", this));
if (mObserver)
mObserver->OnStopDecode(this, mContext, status, statusArg);
return NS_OK;
}
/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
NS_IMETHODIMP imgRequestProxy::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
return NS_OK;
}
/* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult statusCode, in wstring statusText); */
NS_IMETHODIMP imgRequestProxy::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode, const PRUnichar *statusText)
{
if (!mDummyChannel)
return NS_OK;
nsCOMPtr<nsILoadGroup> loadGroup;
mDummyChannel->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup) {
loadGroup->RemoveRequest(mDummyChannel, mContext, statusCode, statusText);
}
mDummyChannel = nsnull;
return NS_OK;
}

View File

@@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2001 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#include "imgRequest.h"
#include "imgIDecoderObserver.h"
#include "imgIContainer.h"
#include "imgIDecoder.h"
#include "nsIStreamObserver.h"
#include "nsIChannel.h"
#include "nsILoadGroup.h"
#include "nsCOMPtr.h"
#define NS_IMGREQUESTPROXY_CID \
{ /* 20557898-1dd2-11b2-8f65-9c462ee2bc95 */ \
0x20557898, \
0x1dd2, \
0x11b2, \
{0x8f, 0x65, 0x9c, 0x46, 0x2e, 0xe2, 0xbc, 0x95} \
}
class imgRequestProxy : public imgIRequest,
public imgIDecoderObserver,
public nsIStreamObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_IMGIREQUEST
NS_DECL_NSIREQUEST
NS_DECL_IMGIDECODEROBSERVER
NS_DECL_IMGICONTAINEROBSERVER
NS_DECL_NSISTREAMOBSERVER
imgRequestProxy();
virtual ~imgRequestProxy();
/* additional members */
nsresult Init(imgRequest *request, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver, nsISupports *cx);
private:
nsCOMPtr<imgIDecoderObserver> mObserver;
nsCOMPtr<nsISupports> mContext;
nsCOMPtr<imgIRequest> mOwner;
nsCOMPtr<nsIChannel> mDummyChannel;
PRBool mCanceled;
};

View File

@@ -0,0 +1,56 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 2001 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Stuart Parmenter <pavlov@netscape.com>
#
DEPTH=..\..\..
include <$(DEPTH)/config/config.mak>
MODULE = imglib2
LIBRARY_NAME = imglib2
DLL = $(OBJDIR)\$(LIBRARY_NAME).dll
MAKE_OBJ_TYPE = DLL
OBJS = \
.\$(OBJDIR)\DummyChannel.obj \
.\$(OBJDIR)\ImageCache.obj \
.\$(OBJDIR)\ImageFactory.obj \
.\$(OBJDIR)\imgContainer.obj \
.\$(OBJDIR)\imgLoader.obj \
.\$(OBJDIR)\imgRequest.obj \
.\$(OBJDIR)\imgRequestProxy.obj \
$(NULL)
LLIBS=\
$(LIBNSPR) \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfxwin.lib \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(LIBRARY_NAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\components\$(LIBRARY_NAME).dll
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib

View File

@@ -0,0 +1,90 @@
?AddRef@imgRequestProxy@@UAGKXZ ; 143798
?Release@imgContainer@@UAGKXZ ; 120291
?OnDataAvailable@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@PBUnsRect@@@Z ; 84442
?QueryInterface@imgContainer@@UAGIABUnsID@@PAPAX@Z ; 76980
?OnDataAvailable@imgContainer@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@PBUnsRect@@@Z ; 75604
?OnDataAvailable@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@PBUnsRect@@@Z ; 75604
?AddRef@DummyChannel@@UAGKXZ ; 45629
?QueryInterface@DummyChannel@@UAGIABUnsID@@PAPAX@Z ; 45310
?GetImage@imgRequest@@UAGIPAPAVimgIContainer@@@Z ; 41814
?Release@DummyChannel@@UAGKXZ ; 41716
?GetImage@imgRequestProxy@@UAGIPAPAVimgIContainer@@@Z ; 40453
?GetFrameAt@imgContainer@@UAGIIPAPAVgfxIImageFrame@@@Z ; 39613
?GetHeight@imgContainer@@UAGIPAH@Z ; 32348
?Release@imgRequest@@UAGKXZ ; 31603
?AddRef@imgRequest@@UAGKXZ ; 31603
?GetNumFrames@imgContainer@@UAGIPAI@Z ; 28342
?GetImageStatus@imgRequestProxy@@UAGIPAI@Z ; 27464
?Release@imgRequestProxy@@UAGKXZ ; 23383
?GetCurrentFrame@imgContainer@@UAGIPAPAVgfxIImageFrame@@@Z ; 19319
?QueryInterface@imgRequest@@UAGIABUnsID@@PAPAX@Z ; 16120
?assign_assuming_AddRef@nsCOMPtr_base@@IAEXPAVnsISupports@@@Z ; 13764
?FrameChanged@imgRequestProxy@@UAGIPAVimgIContainer@@PAVnsISupports@@PAVgfxIImageFrame@@PAUnsRect@@@Z ; 13455
?QueryInterface@imgRequestProxy@@UAGIABUnsID@@PAPAX@Z ; 10170
?Notify@imgContainer@@UAGXPAVnsITimer@@@Z ; 9611
??0nsQueryReferent@@QAE@PAVnsIWeakReference@@PAI@Z ; 9611
?FrameChanged@imgRequest@@UAGIPAVimgIContainer@@PAVnsISupports@@PAVgfxIImageFrame@@PAUnsRect@@@Z ; 9609
?DoComposite@imgContainer@@AAEXPAPAVgfxIImageFrame@@PAUnsRect@@HH@Z ; 9608
?GetLoadAttributes@DummyChannel@@UAGIPAI@Z ; 8258
?Cancel@imgRequestProxy@@UAGII@Z ; 7509
?GetLoadGroup@DummyChannel@@UAGIPAPAVnsILoadGroup@@@Z ; 7456
?GetURI@imgRequest@@UAGIPAPAVnsIURI@@@Z ; 5395
?GetURI@imgRequestProxy@@UAGIPAPAVnsIURI@@@Z ; 5395
?GetCacheSession@@YAXPAPAVnsICacheSession@@@Z ; 5165
?GetWidth@imgContainer@@UAGIPAH@Z ; 4675
?Release@imgLoader@@UAGKXZ ; 3791
?AddObserver@imgRequest@@QAEIPAVimgIDecoderObserver@@@Z ; 3789
?Get@ImageCache@@SAHPAVnsIURI@@PAPAVimgRequest@@PAPAVnsICacheEntryDescriptor@@@Z ; 3789
?RemoveObserver@imgRequest@@QAEIPAVimgIDecoderObserver@@I@Z ; 3789
?Init@imgRequestProxy@@QAEIPAVimgRequest@@PAVnsILoadGroup@@PAVimgIDecoderObserver@@PAVnsISupports@@@Z ; 3789
?QueryInterface@imgLoader@@UAGIABUnsID@@PAPAX@Z ; 3789
??0imgRequestProxy@@QAE@XZ ; 3789
??0DummyChannel@@QAE@PAVimgIRequest@@PAVnsILoadGroup@@@Z ; 3789
?LoadImage@imgLoader@@UAGIPAVnsIURI@@PAVnsILoadGroup@@PAVimgIDecoderObserver@@PAVnsISupports@@PAPAVimgIRequest@@@Z ; 3789
??1imgRequestProxy@@UAE@XZ ; 3667
??1DummyChannel@@QAE@XZ ; 3667
??_EimgRequestProxy@@UAEPAXI@Z ; 3667
?OnStopRequest@imgRequestProxy@@UAGIPAVnsIRequest@@PAVnsISupports@@IPBG@Z ; 3667
?OnStopDecode@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@IPBG@Z ; 3652
?OnStartContainer@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVimgIContainer@@@Z ; 3652
?OnStopContainer@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVimgIContainer@@@Z ; 3652
?OnStartDecode@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@@Z ; 3652
?OnStopFrame@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@@Z ; 3491
?OnStartFrame@imgRequestProxy@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@@Z ; 3491
?OnStartRequest@imgRequestProxy@@UAGIPAVnsIRequest@@PAVnsISupports@@@Z ; 2714
?OnStopFrame@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@@Z ; 2082
?AppendFrame@imgContainer@@UAGIPAVgfxIImageFrame@@@Z ; 2082
?OnStartFrame@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVgfxIImageFrame@@@Z ; 2082
?EndFrameDecode@imgContainer@@UAGIII@Z ; 1996
?StartAnimation@imgContainer@@UAGIXZ ; 1747
?OnDataAvailable@imgRequest@@UAGIPAVnsIRequest@@PAVnsISupports@@PAVnsIInputStream@@II@Z ; 1415
??0imgContainer@@QAE@XZ ; 1376
??1imgRequest@@UAE@XZ ; 1376
?OnStopRequest@imgRequest@@UAGIPAVnsIRequest@@PAVnsISupports@@IPBG@Z ; 1376
?Init@imgRequest@@QAEIPAVnsIChannel@@PAVnsICacheEntryDescriptor@@@Z ; 1376
??1imgContainer@@UAE@XZ ; 1376
?Put@ImageCache@@SAHPAVnsIURI@@PAVimgRequest@@PAPAVnsICacheEntryDescriptor@@@Z ; 1376
??_GimgRequest@@UAEPAXI@Z ; 1376
??_EimgContainer@@UAEPAXI@Z ; 1376
??0imgRequest@@QAE@XZ ; 1376
?OnStartRequest@imgRequest@@UAGIPAVnsIRequest@@PAVnsISupports@@@Z ; 1367
?OnStartContainer@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVimgIContainer@@@Z ; 1361
?Init@imgContainer@@UAGIHHPAVimgIContainerObserver@@@Z ; 1361
?OnStartDecode@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@@Z ; 1361
?SniffMimeType@imgRequest@@QAEXPBDI@Z ; 1361
?OnStopContainer@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@PAVimgIContainer@@@Z ; 1361
?OnStopDecode@imgRequest@@UAGIPAVimgIRequest@@PAVnsISupports@@IPBG@Z ; 1361
?GetContentType@DummyChannel@@UAGIPAPAD@Z ; 1275
?DecodingComplete@imgContainer@@UAGIXZ ; 1275
?Cancel@DummyChannel@@UAGII@Z ; 122
?StopAnimation@imgContainer@@UAGIXZ ; 121
?GetDecoderObserver@imgRequestProxy@@UAGIPAPAVimgIDecoderObserver@@@Z ; 84
??0nsGetInterface@@QAE@PAVnsISupports@@PAI@Z ; 77
_NSGetModule ; 1
??_EimgLoader@@UAEPAXI@Z ; 1
??1imgLoader@@UAE@XZ ; 1
?Shutdown@ImageCache@@SAXXZ ; 1
??0imgLoader@@QAE@XZ ; 1
?do_GetService@@YA?BVnsGetServiceByContractID@@PBDPAI@Z ; 1
?Cancel@imgRequest@@UAGII@Z ; 1
?RemoveFromCache@imgRequest@@QAEHXZ ; 1

View File

@@ -1,2 +0,0 @@
This is the source code for the "mozbot" robot that hangs out on the #mozilla
irc channel (server irc.mozilla.org).

View File

@@ -1,101 +0,0 @@
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Harrison Page <harrison@netscape.com>
# Terry Weissman <terry@mozilla.org>
# harrison@netscape.com
#
# 1.0 10/16/98
package Tinderbox;
require Exporter;
use strict 'vars';
use vars qw (@ISA @EXPORT $VERSION);
use LWP::Simple;
# use HTML::Parse;
use Carp;
@ISA = qw (Exporter);
@EXPORT = qw (status statuz);
my $VERSION = "1.0";
# status wants a reference to a list of tinderbox trees
# and a url ending with tree=, default to mozilla.org's
# server if not provided. status returns two references
# to hashes. the first contains tree names as key,
# tree status as value. second hash contains trees to
# whether or tree is open or closed.
#
# tree status can be horked or success.
#
# barf.
sub status
{
my $trees = shift;
my $url = shift;
my %info; my %tree_state;
# maybe this is too helpful
if (ref ($trees) ne "ARRAY")
{
carp "status method wants a reference to a list, not a " . ref ($trees);
return;
}
$url = $url || "http://tinderbox.mozilla.org/" .
"showbuilds.cgi?quickparse=1&tree=";
my $output = get $url . join ',', @$trees;
return if (! $output);
my @qp = split /\n/, $output;
# loop through quickparse output
foreach my $op (@qp)
{
my ($type, $tree, $build, $state) = split /\|/, $op;
if ($type eq "State")
{
$tree_state{$tree} = $state;
}
elsif ($type eq "Build")
{
if ($state =~ /success/i) {
$state = "Success";
} elsif ($state =~ /testfailed/i) {
$state = "Test Failed";
} else {
$state = "Horked";
}
$info{$tree}{$build} = $state;
}
}
return (\%info, \%tree_state);
}
1;

View File

@@ -1,160 +0,0 @@
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
#
#
#
# Most of this module is rudely swiped from infobot. Here are the various
# licensing words I found with it:
# --
#
# The license for this stuff is yet to be written.
# Please don't do anything good with it without at
# least mentioning this work, perhaps the author (Kevin
# Lenzo, lenzo@cs.cmu.edu), and the Carnegie Mellon
# University, which supports my study.
#
# Also, there is work being done on various bits of this
# now by various people; if you have any corrections
# or contributions, please send them to me. Flat
# ascii files of databases, made with dump_db, are
# wonderful things to share, and a repository will be
# set up.
#
# ---
#
# This program is copyright Jonathan Feinberg 1999.
#
# This program is distributed under the same terms as infobot.
#
# Jonathan Feinberg
# jdf@pobox.com
# http://pobox.com/~jdf/
#
# Version 1.0
# First public release.
#
# ---------------------- (End of licensing words) ------------------------
package babel;
use strict;
use diagnostics;
my $no_babel;
BEGIN {
eval "use URI::Escape"; # utility functions for encoding the
if ($@) { $no_babel++}; # babelfish request
eval "use LWP::UserAgent";
if ($@) { $no_babel++};
}
BEGIN {
# Translate some feasible abbreviations into the ones babelfish
# expects.
use vars qw!%lang_code $lang_regex!;
%lang_code = (
fr => 'fr',
sp => 'es',
po => 'pt',
pt => 'pt',
it => 'it',
ge => 'de',
de => 'de',
gr => 'de',
en => 'en'
);
# Here's how we recognize the language you're asking for. It looks
# like RTSL saves you a few keystrokes in #perl, huh?
$lang_regex = join '|', keys %lang_code;
}
sub babelfish {
return '' if $no_babel;
my ($direction, $lang, $phrase) = @_;
$lang = $lang_code{$lang};
my $ua = new LWP::UserAgent;
$ua->timeout(4);
my $req =
HTTP::Request->new('POST',
'http://babelfish.altavista.digital.com/cgi-bin/translate');
$req->content_type('application/x-www-form-urlencoded');
my $tolang = "en_$lang";
my $toenglish = "${lang}_en";
if ($direction eq 'to') {
return translate($phrase, $tolang, $req, $ua);
}
elsif ($direction eq 'from') {
return translate($phrase, $toenglish, $req, $ua);
}
my $last_english = $phrase;
my $last_lang;
my %results = ();
my $i = 0;
while ($i++ < 7) {
last if $results{$phrase}++;
$last_lang = $phrase = translate($phrase, $tolang, $req, $ua);
last if $results{$phrase}++;
$last_english = $phrase = translate($phrase, $toenglish, $req, $ua);
}
return $last_english;
}
sub translate {
return '' if $no_babel;
my ($phrase, $languagepair, $req, $ua) = @_;
my $urltext = uri_escape($phrase);
$req->content("urltext=$urltext&lp=$languagepair&doit=done");
my $res = $ua->request($req);
if ($res->is_success) {
my $html = $res->content;
# This method subject to change with the whims of Altavista's design
# staff.
my ($translated) =
($html =~ m{<br>
\s+
<font\ face="arial,\ helvetica">
\s*
(?:\*\*\s+time\ out\s+\*\*)?
\s*
([^<]*)
}sx);
$translated =~ s/\n/ /g;
$translated =~ s/\s*$//;
return $translated;
} else {
return ":("; # failure
}
}
"Hello. I'm a true value.";

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +0,0 @@
CFLAGS=-g
OBJS=md5.o token.o main.o
all: $(OBJS) uuidgen
uuidgen: $(OBJS)
gcc -o uuidgen $(OBJS)
md5.o: md5.c md5.h
token.o: token.c token.h
main.o: main.c
clean:
rm -f *.o *~ core uuidgen

View File

@@ -1,17 +0,0 @@
/* copyright? hah! it's 10 lines of code! */
#include <stdio.h>
#include "token.h"
int main(int argc, char **argv) {
uuid_state state;
uuid_t uuid;
char output[1024];
create_uuid_state(&state);
create_token(&state, &uuid);
format_token(output, &uuid);
printf("%s\n", output);
}

View File

@@ -1,263 +0,0 @@
/*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
/* Brutally hacked by John Walker back from ANSI C to K&R (no
prototypes) to maintain the tradition that Netfone will compile
with Sun's original "cc". */
#include <memory.h> /* for memcpy() */
#include "md5.h"
#ifdef sgi
#define HIGHFIRST
#endif
#ifdef sun
#define HIGHFIRST
#endif
#ifndef HIGHFIRST
#define byteReverse(buf, len) /* Nothing */
#else
/*
* Note: this code is harmless on little-endian machines.
*/
void byteReverse(buf, longs)
unsigned char *buf; unsigned longs;
{
uint32 t;
do {
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(uint32 *) buf = t;
buf += 4;
} while (--longs);
}
#endif
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void MD5Init(ctx)
struct MD5Context *ctx;
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void MD5Update(ctx, buf, len)
struct MD5Context *ctx; unsigned char *buf; unsigned len;
{
uint32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
memcpy(p, buf, len);
return;
}
memcpy(p, buf, t);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Final(digest, ctx)
unsigned char digest[16]; struct MD5Context *ctx;
{
unsigned count;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32 *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((uint32 *) ctx->in)[14] = ctx->bits[0];
((uint32 *) ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void MD5Transform(buf, in)
uint32 buf[4]; uint32 in[16];
{
register uint32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}

View File

@@ -1,26 +0,0 @@
#ifndef MD5_H
#define MD5_H
#ifdef __alpha
typedef unsigned int uint32;
#else
typedef unsigned long uint32;
#endif
struct MD5Context {
uint32 buf[4];
uint32 bits[2];
unsigned char in[64];
};
extern void MD5Init();
extern void MD5Update();
extern void MD5Final();
extern void MD5Transform();
/*
* This is needed to make RSAREF happy on some MS-DOS compilers.
*/
typedef struct MD5Context MD5_CTX;
#endif /* !MD5_H */

View File

@@ -1,356 +0,0 @@
/*
** Copyright (C) 1998-1999 Greg Stein. All Rights Reserved.
**
** By using this file, you agree to the terms and conditions set forth in
** the LICENSE.html file which can be found at the top level of the mod_dav
** distribution or at http://www.webdav.org/mod_dav/license-1.html.
**
** Contact information:
** Greg Stein, PO Box 3151, Redmond, WA, 98073
** gstein@lyra.org, http://www.webdav.org/mod_dav/
*/
/*
** DAV opaquelocktoken scheme implementation
**
** Written 5/99 by Keith Wannamaker, wannamak@us.ibm.com
** Adapted from ISO/DCE RPC spec and a former Internet Draft
** by Leach and Salz:
** http://www.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01
**
** Portions of the code are covered by the following license:
**
** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
** Digital Equipment Corporation, Maynard, Mass.
** Copyright (c) 1998 Microsoft.
** To anyone who acknowledges that this file is provided "AS IS"
** without any express or implied warranty: permission to use, copy,
** modify, and distribute this file for any purpose is hereby
** granted without fee, provided that the above copyright notices and
** this notice appears in all source code copies, and that none of
** the names of Open Software Foundation, Inc., Hewlett-Packard
** Company, or Digital Equipment Corporation be used in advertising
** or publicity pertaining to distribution of the software without
** specific, written prior permission. Neither Open Software
** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
** Corporation makes any representations about the suitability of
** this software for any purpose.
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "md5.h"
#include "token.h"
#ifdef WIN32
#include <windows.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#include <sys/sysinfo.h>
#endif
/* set the following to the number of 100ns ticks of the actual resolution of
your system's clock */
#define UUIDS_PER_TICK 1024
/* Set this to what your compiler uses for 64 bit data type */
#ifdef WIN32
#define unsigned64_t unsigned __int64
#define I64(C) C
#else
#define unsigned64_t unsigned long long
#define I64(C) C##LL
#endif
typedef unsigned64_t uuid_time_t;
const uuid_t null_locktoken = {0};
static void format_uuid_v1(uuid_t * uuid, unsigned16 clockseq, uuid_time_t timestamp, uuid_node_t node);
static void get_current_time(uuid_time_t * timestamp);
static unsigned16 true_random(void);
static void get_pseudo_node_identifier(uuid_node_t *node);
static void get_system_time(uuid_time_t *uuid_time);
static void get_random_info(unsigned char seed[16]);
/* dav_create_opaquelocktoken - generates a UUID version 1 token.
* Clock_sequence and node_address set to pseudo-random
* numbers during init.
*
* Should postpend pid to account for non-seralized creation?
*/
int create_token(uuid_state *st, uuid_t *u)
{
uuid_time_t timestamp;
get_current_time(&timestamp);
format_uuid_v1(u, st->cs, timestamp, st->node);
return 1;
}
/*
* dav_create_uuid_state - seed UUID state with pseudorandom data
*/
void create_uuid_state(uuid_state *st)
{
st->cs = true_random();
get_pseudo_node_identifier(&st->node);
}
/*
* dav_format_opaquelocktoken - generates a text representation
* of an opaquelocktoken
*/
void format_token(char *target, const uuid_t *u)
{
sprintf(target, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
u->time_low, u->time_mid, u->time_hi_and_version,
u->clock_seq_hi_and_reserved, u->clock_seq_low,
u->node[0], u->node[1], u->node[2],
u->node[3], u->node[4], u->node[5]);
}
/* convert a pair of hex digits to an integer value [0,255] */
static int dav_parse_hexpair(const char *s)
{
int result;
int temp;
result = s[0] - '0';
if (result > 48)
result = (result - 39) << 4;
else if (result > 16)
result = (result - 7) << 4;
else
result = result << 4;
temp = s[1] - '0';
if (temp > 48)
result |= temp - 39;
else if (temp > 16)
result |= temp - 7;
else
result |= temp;
return result;
}
/* dav_parse_locktoken: Parses string produced from
* dav_format_opaquelocktoken back into a uuid_t
* structure. On failure, return DAV_IF_ERROR_PARSE,
* else DAV_IF_ERROR_NONE.
*/
int parse_token(const char *char_token, uuid_t *bin_token)
{
int i;
for (i = 0; i < 36; ++i) {
char c = char_token[i];
if (!isxdigit(c) &&
!(c == '-' && (i == 8 || i == 13 || i == 18 || i == 23)))
return -1;
}
if (char_token[36] != '\0')
return -1;
bin_token->time_low =
(dav_parse_hexpair(&char_token[0]) << 24) |
(dav_parse_hexpair(&char_token[2]) << 16) |
(dav_parse_hexpair(&char_token[4]) << 8) |
dav_parse_hexpair(&char_token[6]);
bin_token->time_mid =
(dav_parse_hexpair(&char_token[9]) << 8) |
dav_parse_hexpair(&char_token[11]);
bin_token->time_hi_and_version =
(dav_parse_hexpair(&char_token[14]) << 8) |
dav_parse_hexpair(&char_token[16]);
bin_token->clock_seq_hi_and_reserved = dav_parse_hexpair(&char_token[19]);
bin_token->clock_seq_low = dav_parse_hexpair(&char_token[21]);
for (i = 6; i--;)
bin_token->node[i] = dav_parse_hexpair(&char_token[i*2+24]);
return -1;
}
/* dav_compare_opaquelocktoken:
* < 0 : a < b
* == 0 : a = b
* > 0 : a > b
*/
int compare_token(const uuid_t a, const uuid_t b)
{
return memcmp(&a, &b, sizeof(uuid_t));
}
/* format_uuid_v1 -- make a UUID from the timestamp, clockseq, and node ID */
static void format_uuid_v1(uuid_t * uuid, unsigned16 clock_seq,
uuid_time_t timestamp, uuid_node_t node)
{
/* Construct a version 1 uuid with the information we've gathered
* plus a few constants. */
uuid->time_low = (unsigned long)(timestamp & 0xFFFFFFFF);
uuid->time_mid = (unsigned short)((timestamp >> 32) & 0xFFFF);
uuid->time_hi_and_version = (unsigned short)((timestamp >> 48) & 0x0FFF);
uuid->time_hi_and_version |= (1 << 12);
uuid->clock_seq_low = clock_seq & 0xFF;
uuid->clock_seq_hi_and_reserved = (clock_seq & 0x3F00) >> 8;
uuid->clock_seq_hi_and_reserved |= 0x80;
memcpy(&uuid->node, &node, sizeof uuid->node);
}
/* get-current_time -- get time as 60 bit 100ns ticks since whenever.
Compensate for the fact that real clock resolution is less than 100ns. */
static void get_current_time(uuid_time_t * timestamp)
{
uuid_time_t time_now;
static uuid_time_t time_last;
static unsigned16 uuids_this_tick;
static int inited = 0;
if (!inited) {
get_system_time(&time_now);
uuids_this_tick = UUIDS_PER_TICK;
inited = 1;
};
while (1) {
get_system_time(&time_now);
/* if clock reading changed since last UUID generated... */
if (time_last != time_now) {
/* reset count of uuids gen'd with this clock reading */
uuids_this_tick = 0;
break;
};
if (uuids_this_tick < UUIDS_PER_TICK) {
uuids_this_tick++;
break;
}; /* going too fast for our clock; spin */
}; /* add the count of uuids to low order bits of the clock reading */
*timestamp = time_now + uuids_this_tick;
}
/* true_random -- generate a crypto-quality random number.
This sample doesn't do that. */
static unsigned16 true_random(void)
{
uuid_time_t time_now;
get_system_time(&time_now);
time_now = time_now/UUIDS_PER_TICK;
srand((unsigned int)(((time_now >> 32) ^ time_now)&0xffffffff));
return rand();
}
/* This sample implementation generates a random node ID *
* in lieu of a system dependent call to get IEEE node ID. */
static void get_pseudo_node_identifier(uuid_node_t *node)
{
unsigned char seed[16];
get_random_info(seed);
seed[0] |= 0x80;
memcpy(node, seed, sizeof(*node));
}
/* system dependent call to get the current system time.
Returned as 100ns ticks since Oct 15, 1582, but resolution may be
less than 100ns. */
#ifdef WIN32
static void get_system_time(uuid_time_t *uuid_time)
{
ULARGE_INTEGER time;
GetSystemTimeAsFileTime((FILETIME *)&time);
/* NT keeps time in FILETIME format which is 100ns ticks since
Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
+ 18 years and 5 leap days. */
time.QuadPart +=
(unsigned __int64) (1000*1000*10) // seconds
* (unsigned __int64) (60 * 60 * 24) // days
* (unsigned __int64) (17+30+31+365*18+5); // # of days
*uuid_time = time.QuadPart;
}
static void get_random_info(unsigned char seed[16])
{
MD5_CTX c;
struct {
MEMORYSTATUS m;
SYSTEM_INFO s;
FILETIME t;
LARGE_INTEGER pc;
DWORD tc;
DWORD l;
char hostname[MAX_COMPUTERNAME_LENGTH + 1];
} r;
MD5Init(&c); /* memory usage stats */
GlobalMemoryStatus(&r.m); /* random system stats */
GetSystemInfo(&r.s); /* 100ns resolution (nominally) time of day */
GetSystemTimeAsFileTime(&r.t); /* high resolution performance counter */
QueryPerformanceCounter(&r.pc); /* milliseconds since last boot */
r.tc = GetTickCount();
r.l = MAX_COMPUTERNAME_LENGTH + 1;
GetComputerName(r.hostname, &r.l );
MD5Update(&c, (const unsigned char *) &r, sizeof(r));
MD5Final(seed, &c);
}
#else /* WIN32 */
static void get_system_time(uuid_time_t *uuid_time)
{
struct timeval tp;
gettimeofday(&tp, (struct timezone *)0);
/* Offset between UUID formatted times and Unix formatted times.
UUID UTC base time is October 15, 1582.
Unix base time is January 1, 1970. */
*uuid_time = (tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
I64(0x01B21DD213814000);
}
static void get_random_info(unsigned char seed[16])
{
MD5_CTX c;
/* Leech & Salz use Linux-specific struct sysinfo;
* replace with pid/tid for portability (in the spirit of mod_unique_id) */
struct {
/* Add thread id here, if applicable, when we get to pthread or apr */
pid_t pid;
struct timeval t;
char hostname[257];
} r;
MD5Init(&c);
r.pid = getpid();
gettimeofday(&r.t, (struct timezone *)0);
gethostname(r.hostname, 256);
MD5Update(&c, (const unsigned char *)&r, sizeof(r));
MD5Final(seed, &c);
}
#endif /* WIN32 */

View File

@@ -1,80 +0,0 @@
/*
** Copyright (C) 1998-1999 Greg Stein. All Rights Reserved.
**
** By using this file, you agree to the terms and conditions set forth in
** the LICENSE.html file which can be found at the top level of the mod_dav
** distribution or at http://www.webdav.org/mod_dav/license-1.html.
**
** Contact information:
** Greg Stein, PO Box 3151, Redmond, WA, 98073
** gstein@lyra.org, http://www.webdav.org/mod_dav/
*/
/*
** DAV opaquelocktoken scheme implementation
**
** Written 5/99 by Keith Wannamaker, wannamak@us.ibm.com
** Adapted from ISO/DCE RPC spec and a former Internet Draft
** by Leach and Salz:
** http://www.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01
**
** Portions of the code are covered by the following license:
**
** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
** Digital Equipment Corporation, Maynard, Mass.
** Copyright (c) 1998 Microsoft.
** To anyone who acknowledges that this file is provided "AS IS"
** without any express or implied warranty: permission to use, copy,
** modify, and distribute this file for any purpose is hereby
** granted without fee, provided that the above copyright notices and
** this notice appears in all source code copies, and that none of
** the names of Open Software Foundation, Inc., Hewlett-Packard
** Company, or Digital Equipment Corporation be used in advertising
** or publicity pertaining to distribution of the software without
** specific, written prior permission. Neither Open Software
** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
** Corporation makes any representations about the suitability of
** this software for any purpose.
*/
#ifndef _TOKEN_H_
#define _TOKEN_H_
typedef unsigned long unsigned32;
typedef unsigned short unsigned16;
typedef unsigned char unsigned8;
typedef struct {
char nodeID[6];
} uuid_node_t;
#undef uuid_t
typedef struct _uuid_t
{
unsigned32 time_low;
unsigned16 time_mid;
unsigned16 time_hi_and_version;
unsigned8 clock_seq_hi_and_reserved;
unsigned8 clock_seq_low;
unsigned8 node[6];
} uuid_t;
/* data type for UUID generator persistent state */
typedef struct {
uuid_node_t node; /* saved node ID */
unsigned16 cs; /* saved clock sequence */
} uuid_state;
extern const uuid_t null_locktoken;
/* in dav_opaquelock.c */
int create_token(uuid_state *st, uuid_t *u);
void create_uuid_state(uuid_state *st);
void format_token(char *target, const uuid_t *u);
int compare_token(const uuid_t a, const uuid_t b);
int parse_token(const char *char_token, uuid_t *bin_token);
#endif /* _TOKEN_H_ */