summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--!NetSurf/ChkSprites,ffbbin1531 -> 0 bytes
-rw-r--r--.clang-format94
-rw-r--r--.gitignore24
-rw-r--r--Docs/BUILDING-Cocoa87
-rw-r--r--Docs/Doxyfile1826
-rw-r--r--Docs/JavaScript16
-rw-r--r--Docs/Options241
-rw-r--r--Docs/QUICK-START108
-rw-r--r--Docs/USING-Monkey318
-rw-r--r--Docs/core-window-interface677
-rw-r--r--Makefile90
-rw-r--r--Makefile.config.example6
-rw-r--r--Makefile.defaults22
-rw-r--r--content/content.c93
-rw-r--r--content/content.h22
-rw-r--r--content/content_factory.c6
-rw-r--r--content/content_protected.h9
-rw-r--r--content/fetch.c89
-rw-r--r--content/fetchers/curl.c118
-rw-r--r--content/fetchers/data.c17
-rw-r--r--content/fetchers/resource.c6
-rw-r--r--content/fs_backing_store.c246
-rw-r--r--content/handlers/Makefile11
-rw-r--r--content/handlers/css/css.c32
-rw-r--r--content/handlers/css/dump.c46
-rw-r--r--content/handlers/css/hints.c7
-rw-r--r--content/handlers/css/select.c69
-rw-r--r--content/handlers/css/select.h1
-rw-r--r--content/handlers/css/utils.c144
-rw-r--r--content/handlers/css/utils.h115
-rw-r--r--content/handlers/html/Makefile7
-rw-r--r--content/handlers/html/box.c (renamed from render/box.c)77
-rw-r--r--content/handlers/html/box.h (renamed from render/box.h)31
-rw-r--r--content/handlers/html/box_construct.c (renamed from render/box_construct.c)85
-rw-r--r--content/handlers/html/box_normalise.c (renamed from render/box_normalise.c)169
-rw-r--r--content/handlers/html/box_textarea.c (renamed from render/box_textarea.c)40
-rw-r--r--content/handlers/html/box_textarea.h (renamed from render/box_textarea.h)19
-rw-r--r--content/handlers/html/font.c (renamed from render/font.c)25
-rw-r--r--content/handlers/html/font.h (renamed from render/font.h)16
-rw-r--r--content/handlers/html/form.c (renamed from render/form.c)399
-rw-r--r--content/handlers/html/form_internal.h (renamed from render/form_internal.h)8
-rw-r--r--content/handlers/html/html.c (renamed from render/html.c)207
-rw-r--r--content/handlers/html/html.h (renamed from render/html.h)96
-rw-r--r--content/handlers/html/html_css.c (renamed from render/html_css.c)57
-rw-r--r--content/handlers/html/html_css_fetcher.c (renamed from render/html_css_fetcher.c)53
-rw-r--r--content/handlers/html/html_forms.c (renamed from render/html_forms.c)12
-rw-r--r--content/handlers/html/html_interaction.c (renamed from render/html_interaction.c)176
-rw-r--r--content/handlers/html/html_internal.h (renamed from render/html_internal.h)74
-rw-r--r--content/handlers/html/html_object.c (renamed from render/html_object.c)119
-rw-r--r--content/handlers/html/html_redraw.c (renamed from render/html_redraw.c)1412
-rw-r--r--content/handlers/html/html_redraw_border.c928
-rw-r--r--content/handlers/html/html_save.h46
-rw-r--r--content/handlers/html/html_script.c (renamed from render/html_script.c)112
-rw-r--r--content/handlers/html/imagemap.c (renamed from render/imagemap.c)37
-rw-r--r--content/handlers/html/imagemap.h (renamed from render/imagemap.h)9
-rw-r--r--content/handlers/html/layout.c (renamed from render/layout.c)3701
-rw-r--r--content/handlers/html/layout.h (renamed from render/layout.h)37
-rw-r--r--content/handlers/html/search.c (renamed from render/search.c)31
-rw-r--r--content/handlers/html/search.h (renamed from render/search.h)9
-rw-r--r--content/handlers/html/table.c (renamed from render/table.c)450
-rw-r--r--content/handlers/html/table.h (renamed from render/table.h)17
-rw-r--r--content/handlers/image/bmp.c21
-rw-r--r--content/handlers/image/gif.c17
-rw-r--r--content/handlers/image/ico.c19
-rw-r--r--content/handlers/image/image.c14
-rw-r--r--content/handlers/image/image_cache.c125
-rw-r--r--content/handlers/image/jpeg.c61
-rw-r--r--content/handlers/image/nssprite.c54
-rw-r--r--content/handlers/image/png.c30
-rw-r--r--content/handlers/image/rsvg.c66
-rw-r--r--content/handlers/image/svg.c57
-rw-r--r--content/handlers/javascript/duktape/Console.bnd6
-rw-r--r--content/handlers/javascript/duktape/Document.bnd21
-rw-r--r--content/handlers/javascript/duktape/Element.bnd2
-rw-r--r--content/handlers/javascript/duktape/EventTarget.bnd3
-rw-r--r--content/handlers/javascript/duktape/Location.bnd8
-rw-r--r--content/handlers/javascript/duktape/Makefile2
-rw-r--r--content/handlers/javascript/duktape/Window.bnd20
-rw-r--r--content/handlers/javascript/duktape/duk_config.h1561
-rw-r--r--content/handlers/javascript/duktape/duk_custom.h1
-rw-r--r--content/handlers/javascript/duktape/dukky.c144
-rw-r--r--content/handlers/javascript/duktape/dukky.h4
-rw-r--r--content/handlers/javascript/duktape/duktape.c69597
-rw-r--r--content/handlers/javascript/duktape/duktape.h1425
-rw-r--r--content/handlers/text/Makefile3
-rw-r--r--content/handlers/text/textplain.c (renamed from render/textplain.c)1172
-rw-r--r--content/handlers/text/textplain.h139
-rw-r--r--content/hlcache.c36
-rw-r--r--content/llcache.c379
-rw-r--r--content/mimesniff.c357
-rw-r--r--content/mimesniff.h18
-rw-r--r--content/urldb.c1443
-rw-r--r--content/urldb.h57
-rw-r--r--desktop/Makefile2
-rw-r--r--desktop/browser.c624
-rw-r--r--desktop/browser_history.c588
-rw-r--r--desktop/browser_history.h162
-rw-r--r--desktop/browser_private.h214
-rw-r--r--desktop/cookie_manager.c19
-rw-r--r--desktop/font_haru.c26
-rw-r--r--desktop/frames.c52
-rw-r--r--desktop/global_history.c22
-rw-r--r--desktop/gui_factory.c17
-rw-r--r--desktop/hotlist.c249
-rw-r--r--desktop/hotlist.h14
-rw-r--r--desktop/knockout.c778
-rw-r--r--desktop/knockout.h14
-rw-r--r--desktop/local_history.c446
-rw-r--r--desktop/local_history.h144
-rw-r--r--desktop/mouse.c2
-rw-r--r--desktop/netsurf.c40
-rw-r--r--desktop/options.h5
-rw-r--r--desktop/plot_style.c14
-rw-r--r--desktop/print.c48
-rw-r--r--desktop/print.h3
-rw-r--r--desktop/save_complete.c37
-rw-r--r--desktop/save_pdf.c59
-rw-r--r--desktop/save_text.c12
-rw-r--r--desktop/scrollbar.c777
-rw-r--r--desktop/scrollbar.h98
-rw-r--r--desktop/searchweb.c20
-rw-r--r--desktop/selection.c75
-rw-r--r--desktop/selection.h7
-rw-r--r--desktop/sslcert_viewer.c214
-rw-r--r--desktop/sslcert_viewer.h15
-rw-r--r--desktop/system_colour.c23
-rw-r--r--desktop/system_colour.h46
-rw-r--r--desktop/textarea.c175
-rw-r--r--desktop/textarea.h171
-rw-r--r--desktop/textinput.c6
-rw-r--r--desktop/textinput.h14
-rw-r--r--desktop/treeview.c2535
-rw-r--r--desktop/treeview.h212
-rw-r--r--desktop/version.c4
-rw-r--r--docs/Doxyfile2389
-rw-r--r--docs/PACKAGING-GTK (renamed from Docs/PACKAGING-GTK)3
-rw-r--r--docs/UnimplementedJavascript.txt (renamed from Docs/UnimplementedJavascript.txt)0
-rw-r--r--docs/building-AmigaCross.md (renamed from Docs/BUILDING-AmigaCross)0
-rw-r--r--docs/building-AmigaOS.md (renamed from Docs/BUILDING-AmigaOS)0
-rw-r--r--docs/building-Framebuffer.md (renamed from Docs/BUILDING-Framebuffer)0
-rw-r--r--docs/building-GTK.md (renamed from Docs/BUILDING-GTK)0
-rw-r--r--docs/building-Haiku.md (renamed from Docs/BUILDING-BeOS)0
-rw-r--r--docs/building-Windows.md (renamed from Docs/BUILDING-Windows)0
-rw-r--r--docs/core-window-interface.md677
-rw-r--r--docs/env.sh (renamed from Docs/env.sh)372
-rwxr-xr-xdocs/gource.sh (renamed from Docs/gource.sh)0
-rw-r--r--docs/ideas/cache.txt (renamed from Docs/ideas/cache.txt)0
-rw-r--r--docs/ideas/css-engine.txt (renamed from Docs/ideas/css-engine.txt)0
-rw-r--r--docs/ideas/render-library.txt (renamed from Docs/ideas/render-library.txt)0
-rw-r--r--docs/logging.md96
-rw-r--r--docs/mainpage.md98
-rw-r--r--docs/netsurf-fb.1 (renamed from Docs/netsurf-fb.1)0
-rw-r--r--docs/netsurf-gtk.1 (renamed from Docs/netsurf-gtk.1)0
-rw-r--r--docs/netsurf-libraries.md (renamed from Docs/LIBRARIES)0
-rw-r--r--docs/netsurf-options.md147
-rw-r--r--docs/quick-start.md120
-rw-r--r--docs/source-object-backing-store.md (renamed from Docs/source-object-backing-store)0
-rw-r--r--docs/unit-testing (renamed from Docs/unit-testing)0
-rw-r--r--docs/updating-duktape.md29
-rw-r--r--docs/using-framebuffer.md (renamed from Docs/USING-Framebuffer)0
-rw-r--r--docs/using-monkey.md373
-rw-r--r--frontends/amiga/Makefile17
-rw-r--r--frontends/amiga/arexx.c6
-rw-r--r--frontends/amiga/bitmap.c58
-rwxr-xr-xfrontends/amiga/bitmap.h6
-rw-r--r--frontends/amiga/cookies.c6
-rw-r--r--frontends/amiga/corewindow.c65
-rw-r--r--frontends/amiga/corewindow.h4
-rw-r--r--frontends/amiga/ctxmenu.c10
-rwxr-xr-xfrontends/amiga/dist/NetSurf.guide3
-rw-r--r--frontends/amiga/download.c87
-rwxr-xr-xfrontends/amiga/download.h2
-rw-r--r--frontends/amiga/drag.c5
-rw-r--r--frontends/amiga/dt_anim.c23
-rw-r--r--frontends/amiga/dt_picture.c8
-rw-r--r--frontends/amiga/dt_sound.c40
-rw-r--r--frontends/amiga/filetype.c8
-rw-r--r--frontends/amiga/font.c14
-rw-r--r--frontends/amiga/font_bullet.c25
-rw-r--r--frontends/amiga/font_cache.c14
-rw-r--r--frontends/amiga/font_diskfont.c28
-rw-r--r--frontends/amiga/font_scan.c24
-rw-r--r--frontends/amiga/gui.c403
-rw-r--r--frontends/amiga/gui.h12
-rw-r--r--frontends/amiga/gui_menu.c11
-rw-r--r--frontends/amiga/gui_menu.h1
-rwxr-xr-xfrontends/amiga/gui_options.c22
-rw-r--r--frontends/amiga/history.c8
-rw-r--r--[-rwxr-xr-x]frontends/amiga/history_local.c523
-rw-r--r--[-rwxr-xr-x]frontends/amiga/history_local.h23
-rw-r--r--frontends/amiga/hotlist.c7
-rw-r--r--frontends/amiga/icon.c30
-rw-r--r--frontends/amiga/libs.c72
-rwxr-xr-xfrontends/amiga/memory.c73
-rw-r--r--frontends/amiga/menu.c6
-rwxr-xr-xfrontends/amiga/misc.c2
-rw-r--r--frontends/amiga/options.h2
-rw-r--r--frontends/amiga/os3support.c25
-rw-r--r--frontends/amiga/os3support.h1
-rwxr-xr-xfrontends/amiga/pkg/makereslinks24
-rw-r--r--frontends/amiga/plotters.c1004
-rw-r--r--frontends/amiga/plotters.h74
-rw-r--r--frontends/amiga/plugin_hack.c45
-rw-r--r--frontends/amiga/print.c18
l---------frontends/amiga/resources/AdBlock.css2
l---------frontends/amiga/resources/ca-bundle2
l---------frontends/amiga/resources/de1
l---------frontends/amiga/resources/en1
l---------frontends/amiga/resources/fr1
l---------frontends/amiga/resources/it1
l---------frontends/amiga/resources/nl1
l---------frontends/amiga/resources/nsdefault.css2
l---------frontends/amiga/resources/quirks.css2
-rw-r--r--frontends/amiga/schedule.c19
-rw-r--r--frontends/amiga/selectmenu.c3
-rw-r--r--frontends/amiga/sslcert.c6
-rwxr-xr-xfrontends/amiga/stringview/stringview.c3
-rwxr-xr-xfrontends/amiga/stringview/stringview.h5
-rw-r--r--frontends/amiga/stringview/urlhistory.c3
-rw-r--r--frontends/amiga/stringview/urlhistory.h5
-rw-r--r--frontends/amiga/theme.c8
-rw-r--r--frontends/amiga/version.c2
-rw-r--r--frontends/atari/Makefile35
-rw-r--r--frontends/atari/bitmap.c32
-rw-r--r--frontends/atari/certview.c16
-rw-r--r--frontends/atari/cookies.c15
-rw-r--r--frontends/atari/ctxmenu.c13
-rw-r--r--frontends/atari/deskmenu.c68
-rw-r--r--frontends/atari/download.c14
-rw-r--r--frontends/atari/filetype.c4
-rw-r--r--frontends/atari/findfile.c18
-rw-r--r--frontends/atari/gui.c171
-rw-r--r--frontends/atari/history.c15
-rw-r--r--frontends/atari/hotlist.c25
-rw-r--r--frontends/atari/misc.h10
-rw-r--r--frontends/atari/osspec.c6
-rw-r--r--frontends/atari/plot/font_freetype.c25
-rw-r--r--frontends/atari/plot/font_internal.c2
-rw-r--r--frontends/atari/plot/font_vdi.c16
-rw-r--r--frontends/atari/plot/plot.c2269
-rw-r--r--frontends/atari/plot/plot.h29
-rw-r--r--frontends/atari/rootwin.c67
-rw-r--r--frontends/atari/schedule.c32
-rw-r--r--frontends/atari/search.c12
-rw-r--r--frontends/atari/settings.c34
-rw-r--r--frontends/atari/statusbar.c4
-rw-r--r--frontends/atari/toolbar.c21
-rw-r--r--frontends/atari/treeview.c926
-rw-r--r--frontends/atari/treeview.h2
-rw-r--r--frontends/atari/verify_ssl.c27
-rw-r--r--frontends/beos/bitmap.cpp7
-rw-r--r--frontends/beos/fetch_rsrc.cpp22
-rw-r--r--frontends/beos/filetype.cpp1
-rw-r--r--frontends/beos/font.cpp9
-rw-r--r--frontends/beos/gui.cpp39
-rw-r--r--frontends/beos/plotters.cpp1128
l---------frontends/beos/res/adblock.css2
l---------frontends/beos/res/ca-bundle.txt2
l---------frontends/beos/res/de/welcome.html2
l---------frontends/beos/res/default.css2
l---------frontends/beos/res/en/credits.html2
l---------frontends/beos/res/en/licence.html2
l---------frontends/beos/res/en/maps.html2
l---------frontends/beos/res/en/welcome.html2
l---------frontends/beos/res/icons2
l---------frontends/beos/res/internal.css2
l---------frontends/beos/res/it/credits.html2
l---------frontends/beos/res/it/licence.html2
l---------frontends/beos/res/it/welcome.html2
l---------frontends/beos/res/ja/welcome.html2
l---------frontends/beos/res/netsurf.png2
l---------frontends/beos/res/quirks.css2
-rw-r--r--frontends/beos/scaffolding.cpp20
-rw-r--r--frontends/beos/schedule.cpp27
-rw-r--r--frontends/beos/throbber.cpp18
-rw-r--r--frontends/beos/window.cpp179
-rw-r--r--frontends/cocoa/ArrowBox.h34
-rw-r--r--frontends/cocoa/ArrowBox.m163
-rw-r--r--frontends/cocoa/ArrowWindow.h32
-rw-r--r--frontends/cocoa/ArrowWindow.m239
-rw-r--r--frontends/cocoa/BlackScroller.h20
-rw-r--r--frontends/cocoa/BlackScroller.m154
-rw-r--r--frontends/cocoa/BookmarksController.h41
-rw-r--r--frontends/cocoa/BookmarksController.m224
-rw-r--r--frontends/cocoa/BrowserView.h53
-rw-r--r--frontends/cocoa/BrowserView.m760
-rw-r--r--frontends/cocoa/BrowserViewController.h75
-rw-r--r--frontends/cocoa/BrowserViewController.m377
-rw-r--r--frontends/cocoa/BrowserWindow.h26
-rw-r--r--frontends/cocoa/BrowserWindow.m29
-rw-r--r--frontends/cocoa/BrowserWindowController.h57
-rw-r--r--frontends/cocoa/BrowserWindowController.m266
-rw-r--r--frontends/cocoa/DownloadWindowController.h53
-rw-r--r--frontends/cocoa/DownloadWindowController.m415
-rw-r--r--frontends/cocoa/FormSelectMenu.h32
-rw-r--r--frontends/cocoa/FormSelectMenu.m114
-rw-r--r--frontends/cocoa/HistoryView.h35
-rw-r--r--frontends/cocoa/HistoryView.m151
-rw-r--r--frontends/cocoa/HistoryWindowController.h31
-rw-r--r--frontends/cocoa/HistoryWindowController.m52
-rw-r--r--frontends/cocoa/LocalHistoryController.h40
-rw-r--r--frontends/cocoa/LocalHistoryController.m119
-rw-r--r--frontends/cocoa/Makefile250
-rw-r--r--frontends/cocoa/Makefile.defaults30
-rw-r--r--frontends/cocoa/NetSurf.xcodeproj/project.pbxproj1023
-rw-r--r--frontends/cocoa/NetSurfAppDelegate.h42
-rw-r--r--frontends/cocoa/NetSurfAppDelegate.m200
-rw-r--r--frontends/cocoa/NetsurfApp.h31
-rw-r--r--frontends/cocoa/NetsurfApp.m303
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front.pngbin292 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Pressed.pngbin292 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Rollover.pngbin297 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front.pngbin307 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Pressed.pngbin310 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Rollover.pngbin317 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNew.pngbin371 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNewPressed.pngbin380 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNewRollover.pngbin380 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/overflowImage.pngbin256 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/overflowImagePressed.pngbin250 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/pi.pngbin564 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.h23
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.m119
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSString_AITruncation.h12
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m32
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.h28
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m152
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.h15
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m40
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMRolloverButton.h28
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m170
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarCell.h116
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m489
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl.h241
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m1995
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarController.h38
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarController.m643
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.h101
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m834
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragView.h21
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragView.m62
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.h20
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m48
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.h33
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m111
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabStyle.h57
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.h29
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m573
-rw-r--r--frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/TXT.rtf186
-rw-r--r--frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/startpage.gifbin11246 -> 0 bytes
-rw-r--r--frontends/cocoa/PreferencesWindowController.h29
-rw-r--r--frontends/cocoa/PreferencesWindowController.m56
-rw-r--r--frontends/cocoa/Prefix.pch11
-rw-r--r--frontends/cocoa/ScrollableView.h31
-rw-r--r--frontends/cocoa/ScrollableView.m71
-rw-r--r--frontends/cocoa/SearchWindowController.h54
-rw-r--r--frontends/cocoa/SearchWindowController.m119
-rw-r--r--frontends/cocoa/Tree.h56
-rw-r--r--frontends/cocoa/Tree.m147
-rw-r--r--frontends/cocoa/TreeView.h34
-rw-r--r--frontends/cocoa/TreeView.m249
-rw-r--r--frontends/cocoa/URLFieldCell.h31
-rw-r--r--frontends/cocoa/URLFieldCell.m209
-rw-r--r--frontends/cocoa/apple_image.m257
-rw-r--r--frontends/cocoa/bitmap.m281
-rwxr-xr-xfrontends/cocoa/compile-xib.sh20
-rw-r--r--frontends/cocoa/coordinates.h105
-rw-r--r--frontends/cocoa/desktop-tree.h88
-rw-r--r--frontends/cocoa/desktop-tree.m353
-rwxr-xr-xfrontends/cocoa/extract-strings.sh11
-rw-r--r--frontends/cocoa/fetch.h19
-rw-r--r--frontends/cocoa/fetch.m113
-rw-r--r--frontends/cocoa/font.h28
-rw-r--r--frontends/cocoa/font.m243
-rw-r--r--frontends/cocoa/gui.h35
-rw-r--r--frontends/cocoa/gui.m333
-rw-r--r--frontends/cocoa/plotter.h33
-rw-r--r--frontends/cocoa/plotter.m335
-rw-r--r--frontends/cocoa/res/BookmarksWindow.xib610
-rw-r--r--frontends/cocoa/res/Browser.xib399
-rw-r--r--frontends/cocoa/res/BrowserWindow.xib1395
-rw-r--r--frontends/cocoa/res/DownloadWindow.xib493
-rw-r--r--frontends/cocoa/res/HistoryWindow.xib338
-rw-r--r--frontends/cocoa/res/HomeTemplate.pdf106
l---------frontends/cocoa/res/Icons1
-rw-r--r--frontends/cocoa/res/LocalHistoryPanel.xib357
-rw-r--r--frontends/cocoa/res/MainMenu.xib2369
-rw-r--r--frontends/cocoa/res/NetSurf-Info.plist111
-rw-r--r--frontends/cocoa/res/NetSurf.icnsbin203268 -> 0 bytes
-rw-r--r--frontends/cocoa/res/PreferencesWindow.xib512
-rw-r--r--frontends/cocoa/res/SearchWindow.xib614
l---------frontends/cocoa/res/adblock.css1
l---------frontends/cocoa/res/ca-bundle1
-rw-r--r--frontends/cocoa/res/de.lproj/BookmarksWindow.xib.stringsbin366 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/BrowserWindow.xib.stringsbin1892 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/DownloadWindow.xib.stringsbin536 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/HistoryWindow.xib.stringsbin172 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/Localizable.strings78
-rw-r--r--frontends/cocoa/res/de.lproj/MainMenu.xib.stringsbin11982 -> 0 bytes
l---------frontends/cocoa/res/de.lproj/Messages1
-rw-r--r--frontends/cocoa/res/de.lproj/PreferencesWindow.xib.stringsbin1206 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/SearchWindow.xib.stringsbin1148 -> 0 bytes
l---------frontends/cocoa/res/default.css1
-rw-r--r--frontends/cocoa/res/en.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/en.lproj/Messages1
-rw-r--r--frontends/cocoa/res/fr.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/fr.lproj/Messages1
l---------frontends/cocoa/res/internal.css1
-rw-r--r--frontends/cocoa/res/it.lproj/Localizable.stringsbin3496 -> 0 bytes
l---------frontends/cocoa/res/it.lproj/Messages1
l---------frontends/cocoa/res/netsurf.png1
-rw-r--r--frontends/cocoa/res/nl.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/nl.lproj/Messages1
l---------frontends/cocoa/res/quirks.css1
-rw-r--r--frontends/cocoa/schedule.h19
-rw-r--r--frontends/cocoa/schedule.m90
-rw-r--r--frontends/cocoa/selection.h19
-rw-r--r--frontends/cocoa/selection.m104
-rw-r--r--frontends/framebuffer/Makefile11
-rw-r--r--frontends/framebuffer/bitmap.c21
-rw-r--r--frontends/framebuffer/clipboard.c4
-rw-r--r--frontends/framebuffer/corewindow.c262
-rw-r--r--frontends/framebuffer/corewindow.h107
-rw-r--r--frontends/framebuffer/fbtk.h6
-rw-r--r--frontends/framebuffer/fbtk/event.c4
-rw-r--r--frontends/framebuffer/fbtk/fbtk.c46
-rw-r--r--frontends/framebuffer/fbtk/scroll.c4
-rw-r--r--frontends/framebuffer/fbtk/text.c46
-rw-r--r--frontends/framebuffer/fetch.c2
-rw-r--r--frontends/framebuffer/font_freetype.c21
-rw-r--r--frontends/framebuffer/font_internal.c6
-rw-r--r--frontends/framebuffer/framebuffer.c612
-rw-r--r--frontends/framebuffer/gui.c143
-rw-r--r--frontends/framebuffer/gui.h18
-rw-r--r--frontends/framebuffer/local_history.c248
-rw-r--r--frontends/framebuffer/local_history.h49
-rw-r--r--frontends/framebuffer/localhistory.c144
l---------frontends/framebuffer/res/Messages1
l---------frontends/framebuffer/res/adblock.css2
l---------frontends/framebuffer/res/credits.html2
l---------frontends/framebuffer/res/default.css2
l---------frontends/framebuffer/res/internal.css2
l---------frontends/framebuffer/res/licence.html2
l---------frontends/framebuffer/res/maps.html2
l---------frontends/framebuffer/res/netsurf.png2
l---------frontends/framebuffer/res/quirks.css2
l---------frontends/framebuffer/res/welcome.html2
-rw-r--r--frontends/framebuffer/schedule.c23
-rw-r--r--frontends/gtk/Makefile10
-rw-r--r--frontends/gtk/accelerator.c79
-rw-r--r--frontends/gtk/accelerator.h2
-rw-r--r--frontends/gtk/bitmap.c4
-rw-r--r--frontends/gtk/cookies.c9
-rw-r--r--frontends/gtk/corewindow.c53
-rw-r--r--frontends/gtk/corewindow.h2
-rw-r--r--frontends/gtk/download.c4
-rw-r--r--frontends/gtk/fetch.c6
-rw-r--r--frontends/gtk/gdk.c2
-rw-r--r--frontends/gtk/global_history.c17
-rw-r--r--frontends/gtk/gui.c160
-rw-r--r--frontends/gtk/hotlist.c9
-rw-r--r--frontends/gtk/layout_pango.c33
-rw-r--r--frontends/gtk/layout_pango.h2
-rw-r--r--frontends/gtk/local_history.c269
-rw-r--r--frontends/gtk/local_history.h49
-rw-r--r--frontends/gtk/login.c2
-rw-r--r--frontends/gtk/menu.c44
-rw-r--r--frontends/gtk/plotters.c601
-rw-r--r--frontends/gtk/plotters.h6
-rw-r--r--frontends/gtk/preferences.c13
-rw-r--r--frontends/gtk/print.c265
-rw-r--r--frontends/gtk/res/accelerators40
l---------frontends/gtk/res/adblock.css2
l---------frontends/gtk/res/ca-bundle.txt2
l---------frontends/gtk/res/de/welcome.html2
l---------frontends/gtk/res/default.css2
l---------frontends/gtk/res/en/credits.html2
l---------frontends/gtk/res/en/licence.html2
l---------frontends/gtk/res/en/maps.html2
l---------frontends/gtk/res/en/welcome.html2
-rw-r--r--frontends/gtk/res/globalhistory.gtk2.ui (renamed from frontends/gtk/res/history.gtk2.ui)0
-rw-r--r--frontends/gtk/res/globalhistory.gtk3.ui (renamed from frontends/gtk/res/history.gtk3.ui)0
l---------frontends/gtk/res/icons2
l---------frontends/gtk/res/internal.css2
l---------frontends/gtk/res/it/credits.html2
l---------frontends/gtk/res/it/licence.html2
l---------frontends/gtk/res/it/welcome.html2
l---------frontends/gtk/res/ja/welcome.html2
-rw-r--r--frontends/gtk/res/localhistory.gtk2.ui45
-rw-r--r--frontends/gtk/res/localhistory.gtk3.ui45
-rw-r--r--frontends/gtk/res/netsurf.gresource.xml43
l---------frontends/gtk/res/netsurf.png2
l---------frontends/gtk/res/nl/credits.html2
l---------frontends/gtk/res/nl/licence.html2
l---------frontends/gtk/res/nl/welcome.html2
-rw-r--r--frontends/gtk/res/options.gtk2.ui589
l---------frontends/gtk/res/quirks.css2
-rw-r--r--frontends/gtk/res/toolbar.gtk2.ui183
-rw-r--r--frontends/gtk/res/toolbar.gtk3.ui242
-rw-r--r--frontends/gtk/resources.c82
-rw-r--r--frontends/gtk/scaffolding.c445
-rw-r--r--frontends/gtk/schedule.c16
-rw-r--r--frontends/gtk/ssl_cert.c2
-rw-r--r--frontends/gtk/tabs.c8
-rw-r--r--frontends/gtk/throbber.c6
-rw-r--r--frontends/gtk/toolbar.c131
-rw-r--r--frontends/gtk/viewdata.c23
-rw-r--r--frontends/gtk/viewsource.c6
-rw-r--r--frontends/gtk/window.c152
-rw-r--r--frontends/monkey/401login.c32
-rw-r--r--frontends/monkey/bitmap.c112
-rw-r--r--frontends/monkey/browser.c596
-rw-r--r--frontends/monkey/browser.h14
-rw-r--r--frontends/monkey/cert.c32
-rw-r--r--frontends/monkey/dispatch.c110
-rw-r--r--frontends/monkey/download.c46
-rw-r--r--frontends/monkey/farmer.py363
-rw-r--r--frontends/monkey/fetch.c12
-rw-r--r--frontends/monkey/filetype.c4
-rw-r--r--frontends/monkey/layout.c62
-rw-r--r--frontends/monkey/main.c486
-rw-r--r--frontends/monkey/plot.c258
-rw-r--r--frontends/monkey/schedule.c288
-rw-r--r--frontends/riscos/401login.c5
-rw-r--r--frontends/riscos/Makefile31
-rw-r--r--frontends/riscos/appdir/!Boot,feb (renamed from !NetSurf/!Boot,feb)0
-rw-r--r--frontends/riscos/appdir/!Sprites,ff9 (renamed from !NetSurf/!Sprites,ff9)bin1580 -> 1580 bytes
-rw-r--r--frontends/riscos/appdir/!Sprites22,ff9 (renamed from !NetSurf/!Sprites22,ff9)bin11528 -> 11528 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites,ff9 (renamed from !NetSurf/5Sprites,ff9)bin30964 -> 30964 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites11,ff9 (renamed from !NetSurf/5Sprites11,ff9)bin64228 -> 64228 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites22,ff9 (renamed from !NetSurf/5Sprites22,ff9)bin40800 -> 40800 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites,ff9 (renamed from !NetSurf/ASprites,ff9)bin3664 -> 3664 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites11,ff9 (renamed from !NetSurf/ASprites11,ff9)bin15892 -> 15892 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites22,ff9 (renamed from !NetSurf/ASprites22,ff9)bin12668 -> 12668 bytes
-rw-r--r--frontends/riscos/appdir/ChkSprites,ffbbin0 -> 2029 bytes
-rwxr-xr-xfrontends/riscos/appdir/Docs/online,b60 (renamed from !NetSurf/Docs/online,b60)bin165 -> 165 bytes
-rw-r--r--frontends/riscos/appdir/FixFonts,ffb (renamed from !NetSurf/FixFonts,ffb)0
-rw-r--r--frontends/riscos/appdir/KickNS,ffb (renamed from !NetSurf/KickNS,ffb)bin1511 -> 1511 bytes
-rwxr-xr-xfrontends/riscos/appdir/OpenChoices,feb (renamed from !NetSurf/OpenChoices,feb)0
-rw-r--r--frontends/riscos/appdir/OpenHelp,ffb (renamed from !NetSurf/OpenHelp,ffb)bin925 -> 925 bytes
-rwxr-xr-xfrontends/riscos/appdir/OpenScrap,feb (renamed from !NetSurf/OpenScrap,feb)0
l---------frontends/riscos/appdir/Resources/AdBlock,f791
-rw-r--r--frontends/riscos/appdir/Resources/Aletheia,ffd (renamed from !NetSurf/Resources/Aletheia,ffd)bin15237 -> 15237 bytes
l---------frontends/riscos/appdir/Resources/CSS,f791
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/Encoding (renamed from !NetSurf/Resources/Fonts/NSSymbol/Encoding)0
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/IntMetrics,ff6 (renamed from !NetSurf/Resources/Fonts/NSSymbol/IntMetrics,ff6)bin344 -> 344 bytes
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/Outlines,ff6 (renamed from !NetSurf/Resources/Fonts/NSSymbol/Outlines,ff6)bin904 -> 904 bytes
l---------frontends/riscos/appdir/Resources/Icons1
-rwxr-xr-xfrontends/riscos/appdir/Resources/Image,ff9 (renamed from !NetSurf/Resources/Image,ff9)bin111972 -> 111972 bytes
-rw-r--r--frontends/riscos/appdir/Resources/LangNames (renamed from !NetSurf/Resources/LangNames)0
l---------frontends/riscos/appdir/Resources/Quirks,f791
-rw-r--r--frontends/riscos/appdir/Resources/SearchEngines (renamed from !NetSurf/Resources/SearchEngines)0
-rwxr-xr-xfrontends/riscos/appdir/Resources/Sprites,ff9 (renamed from !NetSurf/Resources/Sprites,ff9)bin77336 -> 77336 bytes
l---------frontends/riscos/appdir/Resources/ca-bundle1
l---------frontends/riscos/appdir/Resources/de/Messages1
l---------frontends/riscos/appdir/Resources/de/welcome.html,faf1
-rw-r--r--frontends/riscos/appdir/Resources/en/!Help (renamed from !NetSurf/Resources/en/!Help)0
l---------frontends/riscos/appdir/Resources/en/Messages1
l---------frontends/riscos/appdir/Resources/en/credits.html,faf1
l---------frontends/riscos/appdir/Resources/en/licence.html,faf1
l---------frontends/riscos/appdir/Resources/en/maps.html,faf1
l---------frontends/riscos/appdir/Resources/en/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/fr/Messages1
l---------frontends/riscos/appdir/Resources/internal.css,f791
l---------frontends/riscos/appdir/Resources/it/Messages1
l---------frontends/riscos/appdir/Resources/it/credits.html,faf1
l---------frontends/riscos/appdir/Resources/it/licence.html,faf1
l---------frontends/riscos/appdir/Resources/it/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/ja/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/netsurf.png,b601
-rw-r--r--frontends/riscos/appdir/Resources/nl/!Help (renamed from !NetSurf/Resources/nl/!Help)0
l---------frontends/riscos/appdir/Resources/nl/Messages1
l---------frontends/riscos/appdir/Resources/nl/credits.html,faf1
l---------frontends/riscos/appdir/Resources/nl/licence.html,faf1
l---------frontends/riscos/appdir/Resources/nl/welcome.html,faf1
-rw-r--r--frontends/riscos/bitmap.c32
-rw-r--r--frontends/riscos/buffer.c36
-rw-r--r--frontends/riscos/configure.c32
-rw-r--r--frontends/riscos/configure/con_image.c5
-rw-r--r--frontends/riscos/configure/con_language.c6
-rw-r--r--frontends/riscos/configure/con_theme.c23
-rw-r--r--frontends/riscos/content-handlers/artworks.c48
-rw-r--r--frontends/riscos/content-handlers/draw.c10
-rw-r--r--frontends/riscos/content-handlers/sprite.c11
-rw-r--r--frontends/riscos/cookies.c6
-rw-r--r--frontends/riscos/corewindow.c190
-rw-r--r--frontends/riscos/corewindow.h4
-rw-r--r--frontends/riscos/dialog.c70
-rw-r--r--frontends/riscos/dialog.h1
-rw-r--r--frontends/riscos/download.c152
-rw-r--r--frontends/riscos/filetype.c37
-rw-r--r--frontends/riscos/font.c77
-rw-r--r--frontends/riscos/global_history.c6
-rw-r--r--frontends/riscos/gui.c154
-rw-r--r--frontends/riscos/gui.h34
-rw-r--r--frontends/riscos/gui/button_bar.c30
-rw-r--r--frontends/riscos/gui/progress_bar.c33
-rw-r--r--frontends/riscos/gui/status_bar.c83
-rw-r--r--frontends/riscos/gui/throbber.c11
-rw-r--r--frontends/riscos/gui/url_bar.c48
-rw-r--r--frontends/riscos/help.c22
-rw-r--r--frontends/riscos/history.c336
-rw-r--r--frontends/riscos/hotlist.c11
-rw-r--r--frontends/riscos/iconbar.c6
-rw-r--r--frontends/riscos/image.c20
-rw-r--r--frontends/riscos/local_history.c442
-rw-r--r--frontends/riscos/local_history.h46
-rw-r--r--frontends/riscos/menus.c31
-rw-r--r--frontends/riscos/message.c8
-rw-r--r--frontends/riscos/mouse.c5
-rw-r--r--frontends/riscos/plotters.c824
-rw-r--r--frontends/riscos/print.c316
-rw-r--r--frontends/riscos/query.c21
-rw-r--r--frontends/riscos/save.c117
-rw-r--r--frontends/riscos/save_draw.c638
-rw-r--r--frontends/riscos/save_draw.h7
-rw-r--r--frontends/riscos/schedule.c2
-rw-r--r--frontends/riscos/sslcert.c36
-rw-r--r--frontends/riscos/textarea.c127
-rw-r--r--frontends/riscos/textselection.c41
-rw-r--r--frontends/riscos/theme.c55
-rw-r--r--frontends/riscos/theme_install.c5
-rw-r--r--frontends/riscos/toolbar.c48
-rw-r--r--frontends/riscos/ucstables.c7
-rw-r--r--frontends/riscos/uri.c6
-rw-r--r--frontends/riscos/url_complete.c67
-rw-r--r--frontends/riscos/url_protocol.c19
-rw-r--r--frontends/riscos/wimp.c135
-rw-r--r--frontends/riscos/wimp_event.c76
-rw-r--r--frontends/riscos/window.c5961
-rw-r--r--frontends/riscos/window.h207
-rw-r--r--frontends/windows/Makefile5
-rw-r--r--frontends/windows/about.c8
-rw-r--r--frontends/windows/bitmap.c34
-rw-r--r--frontends/windows/cookies.c19
-rw-r--r--frontends/windows/corewindow.c154
-rw-r--r--frontends/windows/corewindow.h2
-rw-r--r--frontends/windows/download.c8
-rw-r--r--frontends/windows/drawable.c71
-rw-r--r--frontends/windows/filetype.c13
-rw-r--r--frontends/windows/findfile.c4
-rw-r--r--frontends/windows/font.c113
-rw-r--r--frontends/windows/font.h13
-rw-r--r--frontends/windows/global_history.c6
-rw-r--r--frontends/windows/gui.c20
-rw-r--r--frontends/windows/hotlist.c6
-rw-r--r--frontends/windows/local_history.c255
-rw-r--r--frontends/windows/local_history.h (renamed from frontends/cocoa/apple_image.h)34
-rw-r--r--frontends/windows/localhistory.c413
-rw-r--r--frontends/windows/localhistory.h32
-rw-r--r--frontends/windows/main.c22
-rw-r--r--frontends/windows/plot.c1246
-rw-r--r--frontends/windows/prefs.c126
l---------frontends/windows/res/adblock.css2
l---------frontends/windows/res/ca-bundle.crt2
l---------frontends/windows/res/credits.html2
l---------frontends/windows/res/default.css2
l---------frontends/windows/res/internal.css2
l---------frontends/windows/res/licence.html2
l---------frontends/windows/res/netsurf.png2
l---------frontends/windows/res/quirks.css2
l---------frontends/windows/res/welcome.html2
-rw-r--r--frontends/windows/schedule.c38
-rw-r--r--frontends/windows/ssl_cert.c110
-rw-r--r--frontends/windows/windbg.h14
-rw-r--r--frontends/windows/window.c372
-rw-r--r--frontends/windows/window.h15
-rw-r--r--include/netsurf/bitmap.h2
-rw-r--r--include/netsurf/browser_window.h78
-rw-r--r--include/netsurf/content_type.h4
-rw-r--r--include/netsurf/core_window.h28
-rw-r--r--include/netsurf/mouse.h5
-rw-r--r--include/netsurf/plot_style.h34
-rw-r--r--include/netsurf/plotters.h344
-rw-r--r--include/netsurf/url_db.h9
-rw-r--r--include/netsurf/window.h180
-rw-r--r--render/Makefile9
-rw-r--r--render/textplain.h51
-rw-r--r--resources/FatMessages604
-rw-r--r--resources/adblock.css (renamed from !NetSurf/Resources/AdBlock,f79)0
-rw-r--r--resources/ca-bundle (renamed from !NetSurf/Resources/ca-bundle)1093
-rw-r--r--resources/de/welcome.html (renamed from !NetSurf/Resources/de/welcome.html,faf)10
-rw-r--r--resources/default.css (renamed from !NetSurf/Resources/CSS,f79)8
-rw-r--r--resources/en/credits.html (renamed from !NetSurf/Resources/en/credits.html,faf)2
-rw-r--r--resources/en/licence.html (renamed from !NetSurf/Resources/en/licence.html,faf)18
-rw-r--r--resources/en/maps.html (renamed from !NetSurf/Resources/en/maps.html,faf)0
-rw-r--r--resources/en/welcome.html (renamed from !NetSurf/Resources/en/welcome.html,faf)10
-rw-r--r--resources/icons/arrow-l.png (renamed from !NetSurf/Resources/Icons/arrow-l.png)bin284 -> 284 bytes
-rw-r--r--resources/icons/content.png (renamed from !NetSurf/Resources/Icons/content.png)bin598 -> 598 bytes
-rw-r--r--resources/icons/directory.png (renamed from !NetSurf/Resources/Icons/directory.png)bin259 -> 259 bytes
-rw-r--r--resources/icons/directory2.png (renamed from !NetSurf/Resources/Icons/directory2.png)bin336 -> 336 bytes
-rw-r--r--resources/icons/hotlist-add.png (renamed from !NetSurf/Resources/Icons/hotlist-add.png)bin356 -> 356 bytes
-rw-r--r--resources/icons/hotlist-rmv.png (renamed from !NetSurf/Resources/Icons/hotlist-rmv.png)bin610 -> 610 bytes
-rw-r--r--resources/icons/search.png (renamed from !NetSurf/Resources/Icons/search.png)bin536 -> 536 bytes
-rw-r--r--resources/internal.css (renamed from !NetSurf/Resources/internal.css,f79)0
-rw-r--r--resources/it/credits.html (renamed from !NetSurf/Resources/it/credits.html,faf)2
-rw-r--r--resources/it/licence.html (renamed from !NetSurf/Resources/it/licence.html,faf)14
-rw-r--r--resources/it/welcome.html (renamed from !NetSurf/Resources/it/welcome.html,faf)10
-rw-r--r--resources/ja/welcome.html (renamed from !NetSurf/Resources/ja/welcome.html,faf)10
-rw-r--r--resources/netsurf.png (renamed from !NetSurf/Resources/netsurf.png,b60)bin16486 -> 16486 bytes
-rw-r--r--resources/nl/credits.html (renamed from !NetSurf/Resources/nl/credits.html,faf)2
-rw-r--r--resources/nl/licence.html (renamed from !NetSurf/Resources/nl/licence.html,faf)14
-rw-r--r--resources/nl/welcome.html (renamed from !NetSurf/Resources/nl/welcome.html,faf)10
-rw-r--r--resources/quirks.css (renamed from !NetSurf/Resources/Quirks,f79)0
-rw-r--r--test/Makefile125
-rw-r--r--test/assert.c43
-rw-r--r--test/corestrings.c100
-rw-r--r--test/data/Choices-all2
-rw-r--r--test/data/cookies47
-rw-r--r--test/data/cookies-out31
-rw-r--r--test/data/urldb10
-rw-r--r--test/data/urldb-out39
-rw-r--r--test/hashtable.c2
-rw-r--r--test/log.c12
-rw-r--r--test/malloc_fig.c58
-rw-r--r--test/malloc_fig.h (renamed from frontends/cocoa/bitmap.h)18
-rw-r--r--test/messages.c33
-rw-r--r--test/mimesniff.c896
-rw-r--r--test/nsoption.c20
-rw-r--r--test/nsurl.c304
-rw-r--r--test/urldbtest.c610
-rw-r--r--test/utils.c210
-rw-r--r--utils/Makefile1
-rw-r--r--utils/ascii.h65
-rw-r--r--utils/corestringlist.h357
-rw-r--r--utils/corestrings.c943
-rw-r--r--utils/corestrings.h298
-rw-r--r--utils/errors.h75
-rw-r--r--utils/filename.c51
-rw-r--r--utils/hashtable.c237
-rw-r--r--utils/hashtable.h53
-rw-r--r--utils/http.h1
-rw-r--r--utils/http/Makefile5
-rw-r--r--utils/http/challenge.c2
-rw-r--r--utils/http/content-disposition.c2
-rw-r--r--utils/http/content-type.c2
-rw-r--r--utils/http/generics.h2
-rw-r--r--utils/http/strict-transport-security.c341
-rw-r--r--utils/http/strict-transport-security.h64
-rw-r--r--utils/idna.c38
-rwxr-xr-xutils/jenkins-build.sh28
-rw-r--r--utils/log.c284
-rw-r--r--utils/log.h68
-rwxr-xr-xutils/merge-messages.lua83
-rw-r--r--utils/messages.c233
-rw-r--r--utils/nsoption.c17
-rw-r--r--utils/nsoption.h4
-rw-r--r--utils/nsurl.h19
-rw-r--r--utils/nsurl/Makefile7
-rw-r--r--utils/nsurl/nsurl.c939
-rw-r--r--utils/nsurl/parse.c (renamed from utils/nsurl.c)1166
-rw-r--r--utils/nsurl/private.h232
-rw-r--r--utils/split-messages.pl17
-rw-r--r--utils/useragent.c3
-rw-r--r--utils/utf8.c5
755 files changed, 81680 insertions, 84141 deletions
diff --git a/!NetSurf/ChkSprites,ffb b/!NetSurf/ChkSprites,ffb
deleted file mode 100644
index 4e7d325fb..000000000
--- a/!NetSurf/ChkSprites,ffb
+++ /dev/null
Binary files differ
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..3cee69bd9
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,94 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: All
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: true
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Linux
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 8
+ContinuationIndentWidth: 8
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeCategories:
+ - Regex: '^(<.*/)'
+ Priority: 3
+ - Regex: '^(<(nsutils)/)'
+ Priority: 2
+ - Regex: '"utils/'
+ Priority: 4
+ - Regex: '"netsurf/'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
+IndentCaseLabels: false
+IndentWidth: 8
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: false
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 8
+UseTab: Always
+...
+
diff --git a/.gitignore b/.gitignore
index 35de191c2..bb10ba503 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,16 @@
*~
-\!NetSurf/!Run,feb
-\!NetSurf/!RunImage,ff8
-\!NetSurf/!Help,feb
-\!NetSurf/Resources/en/Templates,fec
-\!NetSurf/Resources/en/Messages
-\!NetSurf/Resources/fr/Templates,fec
-\!NetSurf/Resources/fr/Messages
-\!NetSurf/Resources/de/Templates,fec
-\!NetSurf/Resources/de/Messages
-\!NetSurf/Resources/nl/Templates,fec
-\!NetSurf/Resources/nl/Messages
-\!NetSurf/Resources/it/Messages
+frontends/riscos/appdir/!Run,feb
+frontends/riscos/appdir/!RunImage,ff8
+frontends/riscos/appdir/!Help,feb
+frontends/riscos/appdir/Resources/en/Templates,fec
+frontends/riscos/appdir/Resources/fr/Templates,fec
+frontends/riscos/appdir/Resources/de/Templates,fec
+frontends/riscos/appdir/Resources/nl/Templates,fec
+resources/en/Messages
+resources/fr/Messages
+resources/de/Messages
+resources/nl/Messages
+resources/it/Messages
frontends/gtk/res/en/Messages
frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
diff --git a/Docs/BUILDING-Cocoa b/Docs/BUILDING-Cocoa
deleted file mode 100644
index d83800d79..000000000
--- a/Docs/BUILDING-Cocoa
+++ /dev/null
@@ -1,87 +0,0 @@
---------------------------------------------------------------------------------
- Build Instructions for Cocoa NetSurf 13 January 2011
---------------------------------------------------------------------------------
-
- This document provides instructions for building the Cocoa version of NetSurf
- and provides guidance on obtaining NetSurf's build dependencies.
-
- Cocoa NetSurf has been tested on Mac OS X 10.6 on Intel and on Mac OS X 10.5
- on ppc.
-
-
- Building NetSurf
-==================
-
- After installing the dependencies NetSurf can be built either using the Xcode
- project file 'cocoa/NetSurf.xcodeproj' or on the command line using the
- Makefile:
-
- $ make TARGET=cocoa
-
- In both cases the actual build process is controlled by the Makefile.
-
- Obtaining NetSurf's build dependencies
-========================================
-
- Many of NetSurf's dependencies are packaged on various operating systems.
- The remainder must be installed manually. Currently, some of the libraries
- developed as part of the NetSurf project have not had official releases.
- Hopefully they will soon be released with downloadable tarballs and packaged
- in common distros. For now, you'll have to make do with Git checkouts.
-
- Package installation
-----------------------
-
- For building the other NetSurf libraries and for configuring NetSurf the
- "pkg-config" tool is required. It can be installed either via fink, macports
- or homebrew or from source.
-
- OpenSSL, LibPNG, curl, iconv and zlib are provided by Mac OS X.
-
- The curl library provided by Mac OS X 10.6 causes a crash while fetching
- https resources, so you should install version 7.21.4 (or newer) of libcurl
- if you are running on 10.6.
-
- LibJPEG and LibMNG can be installed from source or using one of the mentioned
- package managers.
-
-
- The NetSurf project's libraries
----------------------------------
-
- The NetSurf project has developed several libraries which are required by
- the browser. These are:
-
- LibParserUtils -- Parser building utility functions
- LibWapcaplet -- String internment
- Hubbub -- HTML5 compliant HTML parser
- LibCSS -- CSS parser and selection engine
- LibNSGIF -- GIF format image decoder
- LibNSBMP -- BMP and ICO format image decoder
- LibROSprite -- RISC OS Sprite format image decoder
-
- To fetch each of these libraries, run the appropriate commands from the
- Docs/LIBRARIES file.
-
- $ make
- $ sudo make install
-
- This command builds the libraries only for the active architecture. To build
- universal binaries use those commands:
-
- $ make UNIVERSAL="i386 x86_64 ppc ppc64"
- $ sudo make install
-
- If you are building NetSurf for using it on only one computer this is not
- necessary, but if you want to distribute your binary you should build
- universal binaries. You can also leave some of the platform names out, if
- you don't require them.
-
- | Note: We advise enabling iconv() support in libparserutils, which vastly
- | increases the number of supported character sets. To do this,
- | create a file called Makefile.config.override in the libparserutils
- | directory, containing the following line:
- |
- | CFLAGS += -DWITH_ICONV_FILTER
- |
- | For more information, consult the libparserutils README file.
diff --git a/Docs/Doxyfile b/Docs/Doxyfile
deleted file mode 100644
index e2cb5639c..000000000
--- a/Docs/Doxyfile
+++ /dev/null
@@ -1,1826 +0,0 @@
-# Doxyfile 1.8.1.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or sequence of words) that should
-# identify the project. Note that if you do not use Doxywizard you need
-# to put quotes around the project name if it contains spaces.
-
-PROJECT_NAME = NetSurf
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer
-# a quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF =
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is
-# included in the documentation. The maximum height of the logo should not
-# exceed 55 pixels and the maximum width should not exceed 200 pixels.
-# Doxygen will copy the logo to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful if your file system
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = YES
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding
-# "class=itcl::class" will allow you to use the command class in the
-# itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this
-# tag. The format is ext=language, where ext is a file extension, and language
-# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
-# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
-# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
-# comments according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you
-# can mix doxygen, HTML, and XML commands with Markdown formatting.
-# Disable only in case of backward compatibilities issues.
-
-MARKDOWN_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also makes the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
-# unions are shown inside the group in which they are included (e.g. using
-# @ingroup) instead of on a separate page (for HTML and Man pages) or
-# section (for LaTeX and RTF).
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
-# unions with only public data fields will be shown inline in the documentation
-# of the scope in which they are defined (i.e. file, namespace, or group
-# documentation), provided this scope is documented. If set to NO (the default),
-# structs, classes, and unions are shown on a separate page (for HTML and Man
-# pages) or section (for LaTeX and RTF).
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-SYMBOL_CACHE_SIZE = 0
-
-# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
-# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
-# their name and scope. Since this can be an expensive process and often the
-# same symbol appear multiple times in the code, doxygen keeps a cache of
-# pre-resolved symbols. If the cache is too small doxygen will become slower.
-# If the cache is too large, memory is wasted. The cache size is given by this
-# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespaces are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
-# do proper type resolution of all parameters of a function it will reject a
-# match between the prototype and the implementation of a member function even
-# if there is only one candidate or it is obvious which candidate to choose
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
-# will still accept a match between prototype and implementation in such cases.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or macro consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and macros in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files
-# containing the references data. This must be a list of .bib files. The
-# .bib extension is automatically appended if omitted. Using this command
-# requires the bibtex tool to be installed. See also
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# The WARN_NO_PARAMDOC option can be enabled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = frontends/amiga \
- frontends/amiga/stringview \
- frontends/atari \
- frontends/atari/plot \
- frontends/beos \
- frontends/cocoa \
- frontends/framebuffer \
- frontends/framebuffer/fbtk \
- frontends/gtk \
- frontends/monkey \
- frontends/riscos \
- frontends/riscos/configure \
- frontends/riscos/gui \
- frontends/riscos/content-handlers \
- frontends/riscos/templates \
- frontends/riscos/scripts \
- frontends/windows \
- include/netsurf \
- render \
- desktop \
- content \
- content/fetchers \
- content/handlers/image \
- content/handlers/css \
- content/handlers/javascript \
- content/handlers/javascript/duktape \
- utils \
- utils/http \
- Docs/UnimplementedJavascript.txt
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
-# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
-# *.f90 *.f *.for *.vhd *.vhdl
-
-FILE_PATTERNS = *.c \
- *.h \
- *.y \
- *.l \
- *.cpp \
- *.m
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty or if
-# non of the patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
-# and it is also possible to disable source filtering for a specific pattern
-# using *.ext= (so without naming a filter). This option only has effect when
-# FILTER_SOURCE_FILES is enabled.
-
-FILTER_SOURCE_PATTERNS =
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C, C++ and Fortran comments will always remain visible.
-
-STRIP_CODE_COMMENTS = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = codedocs
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header. Note that when using a custom header you are responsible
-# for the proper inclusion of any scripts and style sheets that doxygen
-# needs, which is dependent on the configuration options used.
-# It is advised to generate a default header using "doxygen -w html
-# header.html footer.html stylesheet.css YourConfigFile" and then modify
-# that header. Note that the header is subject to change so you typically
-# have to redo this when upgrading to a newer version of doxygen or when
-# changing the value of configuration settings such as GENERATE_TREEVIEW!
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# style sheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that
-# the files will be copied as-is; there are no commands or markers available.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the style sheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
-# entries shown in the various tree structured indices initially; the user
-# can expand and collapse entries dynamically later on. Doxygen will expand
-# the tree to such a level that at most the specified number of entries are
-# visible (unless a fully collapsed tree already exceeds this amount).
-# So setting the number of entries 1 will produce a full collapsed tree by
-# default. 0 is a special value representing an infinite number of entries
-# and will result in a full expanded tree by default.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
-# the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
-# at top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it. Since the tabs have the same information as the
-# navigation tree you can set this option to NO if you already set
-# GENERATE_TREEVIEW to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-# Since the tree basically has the same information as the tab index you
-# could consider to set DISABLE_INDEX to NO when enabling this option.
-
-GENERATE_TREEVIEW = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML
-# documentation. Note that a value of 0 will completely suppress the enum
-# values from appearing in the overview section.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
-# (see http://www.mathjax.org) which uses client side Javascript for the
-# rendering instead of using prerendered bitmaps. Use this if you do not
-# have LaTeX installed or if you want to formulas look prettier in the HTML
-# output. When enabled you may also need to install MathJax separately and
-# configure the path to it using the MATHJAX_RELPATH option.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you need to specify the location relative to the
-# HTML output directory using the MATHJAX_RELPATH option. The destination
-# directory should contain the MathJax.js script. For instance, if the mathjax
-# directory is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to
-# the MathJax Content Delivery Network so you can quickly see the result without
-# installing MathJax.
-# However, it is strongly recommended to install a local
-# copy of MathJax from http://www.mathjax.org before deployment.
-
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
-# names that should be enabled during MathJax rendering.
-
-MATHJAX_EXTENSIONS =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a PHP enabled web server instead of at the web client
-# using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server
-# based approach is that it scales better to large projects and allows
-# full text search. The disadvantages are that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
-# the generated latex document. The footer should contain everything after
-# the last chapter. If it is left blank doxygen will generate a
-# standard footer. Notice: only use this tag if you know what you are doing!
-
-LATEX_FOOTER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
-# http://en.wikipedia.org/wiki/BibTeX for more info.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load style sheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# pointed to by INCLUDE_PATH will be searched when a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = gtk \
- WITH_THEME_INSTALL
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition that
-# overrules the definition found in the source code.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all references to function-like macros
-# that are alone on a line, have an all uppercase name, and do not end with a
-# semicolon, because these will confuse the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. For each
-# tag file the location of the external documentation should be added. The
-# format of a tag file without this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths
-# or URLs. Note that each tag file must have a unique name (where the name does
-# NOT include the path). If a tag file is not located in the directory in which
-# doxygen is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option also works with HAVE_DOT disabled, but it is recommended to
-# install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS = 0
-
-# By default doxygen will use the Helvetica font for all dot files that
-# doxygen generates. When you want a differently looking font you can specify
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find
-# the font, which can be done by putting it in a standard location or by setting
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
-# directory containing the font.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the Helvetica font.
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
-# set the path where dot can find it.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside
-# the class node. If there are many fields or methods and many nodes the
-# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
-# threshold limits the number of items for each type to make the size more
-# managable. Set this to 0 for no limit. Note that the threshold may be
-# exceeded by 50% before the limit is enforced.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = YES
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will generate a graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are svg, png, jpg, or gif.
-# If left blank png will be used. If you choose svg you need to set
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible in IE 9+ (other browsers do not have this requirement).
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-# Note that this requires a modern browser other than Internet Explorer.
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible. Older versions of IE do not have SVG support.
-
-INTERACTIVE_SVG = NO
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the
-# \mscfile command).
-
-MSCFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 200
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = YES
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
diff --git a/Docs/JavaScript b/Docs/JavaScript
deleted file mode 100644
index ced2fbe7c..000000000
--- a/Docs/JavaScript
+++ /dev/null
@@ -1,16 +0,0 @@
---------------------------------------------------------------------------------
- NetSurf: JavaScript 8 April 2013
---------------------------------------------------------------------------------
-
- NetSurf may be built with primitive support for JavaScript.
-
- | Note: NetSurf's JavaScript handling is currently:
- |
- | * incomplete,
- | * unsupported,
- | * disabled by default.
-
- To test it, you may build NetSurf with JavaScript and ensure NetSurf's
- "enable_javascript" run-time configuration option is set to "1". To do this
- you may set the option in the frontend's settings GUI, create/edit a Choices
- file, or pass --enable_javascript=1 to the executable.
diff --git a/Docs/Options b/Docs/Options
deleted file mode 100644
index 89b881414..000000000
--- a/Docs/Options
+++ /dev/null
@@ -1,241 +0,0 @@
---------------------------------------------------------------------------------
- Common NetSurf user options 4nd December 2014
---------------------------------------------------------------------------------
-
- This document outlines the common configuration options supported by the
- NetSurf core.
-
-Overview
-========
-
- The users configurations are generally stored in a "Choices" file
- and are loaded at browser startup. Most user interfaces provide a
- way to configure these parameters in a manner consistant with the
- toolkit in use.
-
- The user choices are stored as a simple key:value list.
-
- Each entry has a type, one of: boolean, integer, unsigned integer,
- hexadecimal colour value or string.
-
-General Options
-===============
-
-+----------------------+--------+-----------+----------------------------------+
-| Option Key | Type | Default | Description |
-+----------------------+--------+-----------+----------------------------------+
-| http_proxy | bool | false | An HTTP proxy should be used. |
-| | | | |
-| http_proxy | bool | false | An HTTP proxy should be used. |
-| | | | |
-| http_proxy_host | string | NULL | Hostname of proxy. |
-| | | | |
-| http_proxy_port | int | 8080 | Proxy port. |
-| | | | |
-| http_proxy_auth | int | 0 | Proxy authentication method. |
-| | | | |
-| http_proxy_auth_user | string | NULL | Proxy authentication user name |
-| | | | |
-| http_proxy_auth_pass | string | NULL | Proxy authentication password |
-| | | | |
-| http_proxy_noproxy | string | localhost | Proxy omission list |
-| | | | |
-| font_size | int | 128 | Default font size / 0.1pt. |
-| | | | |
-| font_min_size | int | 85 | Minimum font size. |
-| | | | |
-| font_sans | string | NULL | Default sans serif font |
-| | | | |
-| font_serif | string | NULL | Default serif font |
-| | | | |
-| font_mono | string | NULL | Default monospace font
-| | | | |
-| font_cursive | string | NULL | Default cursive font
-| | | | |
-| font_fantasy | string | NULL | Default fantasy font
-| | | | |
-| accept_language | string | NULL | Accept-Language header.
-| | | | |
-| accept_charset | string | NULL | Accept-Charset header.
-| | | | |
-| memory_cache_size | int | 12MiB | Preferred maximum size of memory |
-| | | | cache in bytes. |
-| | | | |
-| disc_cache_size | uint | 1GiB | Preferred expiry size of disc |
-| | | | cache in bytes. |
-| | | | |
-| disc_cache_age | int | 28 | Preferred expiry age of disc |
-| | | | cache in days. |
-| | | | |
-| block_advertisements | bool | false | Whether to block advertisements
-| | | | |
-| do_not_track | bool | false | Disable website tracking [1]
-| | | | |
-| minimum_gif_delay | int | 10 | Minimum GIF animation delay
-| | | | |
-| send_referer | bool | true | Whether to send the referer HTTP |
-| | | | header. |
-| | | | |
-| foreground_images | bool | true | Whether to fetch foreground images
-| | | | |
-| background_images | bool | true | Whether to fetch background images
-| | | | |
-| animate_images | bool | true | Whether to animate images
-| | | | |
-| enable_javascript | bool | false | Whether to execute javascript
-| | | | |
-| script_timeout | int | 10 | Maximum time to wait for a script|
-| | | | to run in seconds |
-| | | | |
-| expire_url | int | 28 | How many days to retain URL data |
-| | | | for. |
-| | | | |
-| font_default | int | 0 | Default font family
-| | | | |
-| ca_bundle | string | NULL | ca-bundle location
-| | | | |
-| ca_path | string | NULL | ca-path location
-| | | | |
-| cookie_file | string | NULL | Cookie file location
-| | | | |
-| cookie_jar | string | NULL | Cookie jar location
-| | | | |
-| homepage_url | string | NULL | Home page location
-| | | | |
-| search_url_bar | bool | false | search web from url bar
-| | | | |
-| search_provider | int | 0 | default web search provider
-| | | | |
-| url_suggestion | bool | true | URL completion in url bar
-| | | | |
-| window_x | int | 0 | default x position of new windows
-| | | | |
-| window_y | int | 0 | default y position of new windows
-| | | | |
-| window_width | int | 0 | default width of new windows
-| | | | |
-| window_height | int | 0 | default height of new windows
-| | | | |
-| window_screen_width | int | 0 | width of screen when above |
-| | | | options were saved |
-| | | | |
-| window_screen_height | int | 0 | height of screen when above |
-| | | | options were saved |
-| | | | |
-| toolbar_status_size | int | 6667 | default size of status bar vs. |
-| | | | h scroll bar |
-| | | | |
-| scale | int | 100 | default window scale
-| | | | |
-| incremental_reflow | bool | true | Whether to reflow web pages while|
-| | | | objects are fetching |
-| | | | |
-| min_reflow_period | uint | 25 | Minimum time (in cs) between HTML|
-| | | | reflows while objects are fetching
-| | | | |
-| core_select_menu | bool | false | Use core selection menu |
-| | | | |
-+----------------------+--------+-----------+----------------------------------+
-
-[1] http://www.w3.org/Submission/2011/SUBM-web-tracking-protection-20110224/#dnt-uas
-
-Fetcher options
-===============
-
-+--------------------------+------+------+-------------------------------------+
-| Option Key | Type | Dflt | Description |
-+--------------------------+------+------+-------------------------------------+
-| max_fetchers | int | 24 | Maximum simultaneous active fetchers|
-| | | | |
-| max_fetchers_per_host | int | 5 | Maximum simultaneous active fetchers|
-| | | | per host. (<=option_max_fetchers |
-| | | | else it makes no sense) [2] |
-| | | | |
-| max_cached_fetch_handles | int | 6 | Maximum number of inactive fetchers |
-| | | | cached. The total number of handles|
-| | | | netsurf will therefore have open is|
-| | | | this plus option_max_fetchers. |
-| | | | |
-| suppress_curl_debug | bool | true | Suppress debug output from cURL. |
-| | | | |
-| target_blank | bool | true | Whether to allow target="_blank" |
-| | | | |
-| button_2_tab | bool | true | Whether second mouse button opens in|
-| | | | new tab. |
-| | | | |
-+--------------------------+------+------+-------------------------------------+
-
-[2] Note that rfc2616 section 8.1.4 says that there should be no more
- than two keepalive connections per host. None of the main browsers
- follow this as it slows page fetches down considerably.
- See https://bugzilla.mozilla.org/show_bug.cgi?id=423377#c4
-
-
-PDF / Print options
-===================
-
-+------------------------+------+-------+--------------------------------------+
-| Option Key | Type | Deflt | Description |
-+------------------------+------+-------+--------------------------------------+
-| margin_top | int | 10 | top margin of exported page |
-| | | | |
-| margin_bottom | int | 10 | bottom margin of exported page |
-| | | | |
-| margin_left | int | 10 | left margin of exported page |
-| | | | |
-| margin_right | int | 10 | right margin of exported page |
-| | | | |
-| export_scale | int | 70 | scale of exported content |
-| | | | |
-| suppress_images | bool | false | suppressing images in printed content|
-| | | | |
-| remove_backgrounds | bool | false | turning off all backgrounds for |
-| | | | printed content |
-| | | | |
-| enable_loosening | bool | true | turning on content loosening for |
-| | | | printed content |
-| | | | |
-| enable_PDF_compression | bool | true | compression of PDF documents |
-| | | | |
-| enable_PDF_password | bool | false | setting a password and encoding PDF |
-| | | | documents |
-+------------------------+------+-------+--------------------------------------+
-
-System colours
-==============
-
-These are the css system colours which the browser also uses to style
-generated output.
-
-+--------------------------------+--------+------------+
-| Option Key | Type | Default |
-+--------------------------------+--------+------------+
-| sys_colour_ActiveBorder | colour | 0x00d3d3d3 |
-| sys_colour_ActiveCaption | colour | 0x00f1f1f1 |
-| sys_colour_AppWorkspace | colour | 0x00f1f1f1 |
-| sys_colour_Background | colour | 0x006e6e6e |
-| sys_colour_ButtonFace | colour | 0x00f9f9f9 |
-| sys_colour_ButtonHighlight | colour | 0x00ffffff |
-| sys_colour_ButtonShadow | colour | 0x00aeaeae |
-| sys_colour_ButtonText | colour | 0x004c4c4c |
-| sys_colour_CaptionText | colour | 0x004c4c4c |
-| sys_colour_GrayText | colour | 0x00505050 |
-| sys_colour_Highlight | colour | 0x00c00800 |
-| sys_colour_HighlightText | colour | 0x00ffffff |
-| sys_colour_InactiveBorder | colour | 0x00f1f1f1 |
-| sys_colour_InactiveCaption | colour | 0x00e6e6e6 |
-| sys_colour_InactiveCaptionText | colour | 0x00a6a6a6 |
-| sys_colour_InfoBackground | colour | 0x008fdfef |
-| sys_colour_InfoText | colour | 0x00000000 |
-| sys_colour_Menu | colour | 0x00f1f1f1 |
-| sys_colour_MenuText | colour | 0x004e4e4e |
-| sys_colour_Scrollbar | colour | 0x00cccccc |
-| sys_colour_ThreeDDarkShadow | colour | 0x00aeaeae |
-| sys_colour_ThreeDFace | colour | 0x00f9f9f9 |
-| sys_colour_ThreeDHighlight | colour | 0x00ffffff |
-| sys_colour_ThreeDLightShadow | colour | 0x00ffffff |
-| sys_colour_ThreeDShadow | colour | 0x00d5d5d5 |
-| sys_colour_Window | colour | 0x00f1f1f1 |
-| sys_colour_WindowFrame | colour | 0x004e4e4e |
-| sys_colour_WindowText | colour | 0x00000000 |
-+--------------------------------+--------+------------+
diff --git a/Docs/QUICK-START b/Docs/QUICK-START
deleted file mode 100644
index 9ff3fb5e9..000000000
--- a/Docs/QUICK-START
+++ /dev/null
@@ -1,108 +0,0 @@
---------------------------------------------------------------------------------
- Quick Build Steps for NetSurf 24 February 2015
---------------------------------------------------------------------------------
-
- This document provides steps for building NetSurf.
-
-
- Grab a temporary env.sh
---------------------------
-
- $ wget http://git.netsurf-browser.org/netsurf.git/plain/Docs/env.sh
- $ source env.sh
-
-
- Install any packages you need
--------------------------------
-
- Installs all packages required to build NetSurf and the NetSurf project
- libraries.
-
- $ ns-package-install
-
- If your package manager is not supported, you will have to install third
- party packages manually.
-
-
- Get the NetSurf project source code from Git
-----------------------------------------------
-
- $ ns-clone
-
-
- Build and install our project libraries
------------------------------------------
-
- Updates NetSurf project library sources to latest, builds and installs them.
-
- $ ns-pull-install
-
-
- Switch to new NetSurf workspace
----------------------------------
-
- $ rm env.sh
- $ cd ~/dev-netsurf/workspace
- $ source env.sh
-
-
- Build and run NetSurf
------------------------
-
- $ cd netsurf
-
- To build the native front end (the GTK front end on Linux, BSDs, etc) you
- could do:
-
- $ make
- $ ./nsgtk
-
- To build the framebuffer front end, you could do:
-
- $ make TARGET=framebuffer
- $ ./nsfb
-
-
- Cross Compiling
-=================
-
- If you are cross compiling, you can follow the above steps, but when sourcing
- env.sh, you should set TARGET_ABI to the appropriate triplet for your cross
- compiler. For example, to cross compile for RISC OS:
-
- $ TARGET_ABI=arm-unknown-riscos source env.sh
-
- After that, the commands such as `ns-package-install` and `ns-pull-install`
- will do what is appropriate for the platform you are building for.
-
- To do the final build of NetSurf, pass the appropriate TARGET to make. For
- example, to cross compile for RISC OS:
-
- $ make TARGET=riscos
-
- Finally, you can package up your build to transfer to the system you are
- developing for. For example, to produce a package for RISC OS:
-
- $ make TARGET=riscos package
-
- Getting a cross compiler set up
----------------------------------
-
- We maintain cross compilation environments and an SDK for a number of
- platforms. These may be found in our toolchains repository.
-
- $ git clone git://git.netsurf-browser.org/toolchains
-
- Pre-built versions of the toolchains for Debian systems are often available
- via our automated build and test infrastructure:
-
- http://ci.netsurf-browser.org/builds/toolchains/
-
-
- Not working?
-==============
-
- If the above steps are inapplicable, or don't work, you can build manually.
- Follow the instructions in the BUILDING-* documents in the Docs/ directory
- the NetSurf browser source tree.
-
diff --git a/Docs/USING-Monkey b/Docs/USING-Monkey
deleted file mode 100644
index 33e504239..000000000
--- a/Docs/USING-Monkey
+++ /dev/null
@@ -1,318 +0,0 @@
---------------------------------------------------------------------------------
- Usage Instructions for Monkey NetSurf 13 March 2011
---------------------------------------------------------------------------------
-
- This document provides usage instructions for the Monkey version of
- NetSurf.
-
- Monkey NetSurf has been tested on Ubuntu.
-
-Overview
-========
-
- What it is
- ----------
-
- The NetSurf Monkey front end is a developer debug tool used to
- test how the core interacts with the user interface. It allows
- the developers to profile NetSurf and to interact with the core
- directly as though the developer were a front end.
-
- What it is not
- --------------
-
- Monkey is not a tool for building web-crawling robots or indeed
- anything other than a debug tool for the NetSurf developers.
-
- How to interact with nsmonkey
- -----------------------------
-
- In brief, monkey will produce tagged output on stdout and expect
- commands on stdin. Windows are numbered and for the most part
- tokens are space separated. In some cases (e.g. title or status)
- the final element on the output line is a string which might have
- spaces embedded within it. As such, output from nsmonkey should be
- parsed a token at a time, so that when such a string is encountered,
- the parser can stop splitting and return the rest.
-
- Commands to Monkey are namespaced. For example commands related to
- browser windows are prefixed by WINDOW.
-
- Top level tags for nsmonkey
- ---------------------------
-
- QUIT
-
- WINDOW
-
- Top level response tags for nsmonkey
- ------------------------------------
-
- GENERIC
-
- WARN, ERROR, DIE
-
- WINDOW
-
- DOWNLOAD_WINDOW
-
- SSLCERT
-
- 401LOGIN
-
- PLOT
-
- In the below, %something% indicates a substitution made by Monkey.
-
- %url% will be a URL
- %id% will be an opaque ID
- %n% will be a number
- %bool% will be TRUE or FALSE
- %str% is a string and will only ever be at the end of an output line.
-
- Warnings, errors etc
- --------------------
-
- Warnings (tagged WARN) come from the NetSurf core.
- Errors (tagged ERROR) tend to come from Monkey's parsers
- Death (tagged DIE) comes from the core and kills Monkey dead.
-
-Commands
-========
-
- Generic commands
- ----------------
-
- QUIT
- Cause monkey to quit cleanly.
- This will cleanly destroy open windows etc.
-
- Window commands
- ---------------
-
- WINDOW NEW [%url%]
- Create a new browser window, optionally giving the core
- a URL to immediately navigate to.
- Minimally you will receive a WINDOW NEW WIN %id% response.
-
- WINDOW DESTROY %id%
- Destroy the given browser window.
- Minimally you will recieve a WINDOW DESTROY WIN %id% response.
-
- WINDOW GO %id% %url% [%url%]
- Cause the given browser window to visit the given URL.
- Optionally you can give a referrer URL to also use (simulating
- a click in the browser on a link).
- Minimally you can expect throbber, url etc responses.
-
- WINDOW REDRAW %id% [%num% %num% %num% %num%]
- Cause a browser window to redraw. Optionally you can give a
- set of coordinates to simulate a partial expose of the window.
- Said coordinates are in traditional X0 Y0 X1 Y1 order.
- The coordinates are in canvas, not window, coordinates. So you
- should take into account the scroll offsets when issuing this
- command.
- Minimally you can expect redraw start/stop messages and you
- can likely expect some number of PLOT results.
-
- WINDOW RELOAD %id%
- Cause a browser window to reload its current content.
- Expect responses similar to a GO command.
-
-
-Responses
-=========
-
- Generic messages
- ----------------
-
- GENERIC STARTED
- Monkey has started and is ready for commands
-
- GENERIC CLOSING_DOWN
- Monkey has been told to shut down and is doing so
-
- GENERIC FINISHED
- Monkey has finished and will now exit
-
- GENERIC LAUNCH URL %url%
- The core asked monkey to launch the given URL
-
- GENERIC THUMBNAIL URL %url%
- The core asked monkey to thumbnail a content without
- a window.
-
- GENERIC POLL BLOCKING
- Monkey reached a point where it could sleep waiting for
- commands or scheduled timeouts. No fetches nor redraws
- were pending.
-
- Window messages
- ---------------
-
- WINDOW NEW WIN %id% FOR %id% CLONE %id% NEWTAB %bool%
- The core asked Monkey to open a new window. The IDs for 'FOR' and
- 'CLONE' are core window IDs, the WIN id is a Monkey window ID.
-
- WINDOW SIZE WIN %id% WIDTH %n% HEIGHT %n%
- The window specified has been set to the shown width and height.
-
- WINDOW DESTROY WIN %id%
- The core has instructed Monkey to destroy the named window.
-
- WINDOW TITLE WIN %id% STR %str%
- The core supplied a titlebar title for the given window.
-
- WINDOW REDRAW WIN %id%
- The core asked that Monkey redraw the given window.
-
- WINDOW GET_DIMENSIONS WIN %id% WIDTH %n% HEIGHT %n%
- The core asked Monkey what the dimensions of the window are.
- Monkey has to respond immediately and returned the supplied width
- and height values to the core.
-
- WINDOW NEW_CONTENT WIN %id%
- The core has informed Monkey that the named window has a new
- content object.
-
- WINDOW NEW_ICON WIN %id%
- The core has informed Monkey that the named window hsa a new
- icon (favicon) available.
-
- WINDOW START_THROBBER WIN %id%
- The core asked Monkey to start the throbber for the named
- window. This indicates to the user that the window is busy.
-
- WINDOW STOP_THROBBER WIN %id%
- The core asked Monkey to stop the throbber for the named
- window. This indicates to the user that the window is finished.
-
- WINDOW SET_SCROLL WIN %id% X %n% Y %n%
- The core asked Monkey to set the named window's scroll offsets
- to the given X and Y position.
-
- WINDOW UPDATE_BOX WIN %id% X %n% Y %n% WIDTH %n% HEIGHT %n%
- The core asked Monkey to redraw the given portion of the content
- display. Note these coordinates refer to the content, not the
- viewport which Monkey is simulating.
-
- WINDOW UPDATE_EXTENT WIN %id% WIDTH %n% HEIGHT %n%
- The core has told us that the content in the given window has a
- total width and height as shown. This allows us (along with the
- window's width and height) to know the scroll limits.
-
- WINDOW SET_STATUS WIN %id% STR %str%
- The core has told us that the given window needs its status bar
- updating with the given message.
-
- WINDOW SET_POINTER WIN %id% POINTER %id%
- The core has told us to update the mouse pointer for the given
- window to the given pointer ID.
-
- WINDOW SET_SCALE WIN %id% SCALE %n%
- The core has asked us to scale the given window by the given scale
- factor.
-
- WINDOW SET_URL WIN %id% URL %url%
- The core has informed us that the given window's URL bar needs
- updating to the given url.
-
- WINDOW GET_SCROLL WIN %id% X %n% Y %n%
- The core asked Monkey for the scroll offsets. Monkey returned the
- numbers shown for the window named.
-
- WINDOW SCROLL_START WIN %id%
- The core asked Monkey to scroll the named window to the top/left.
-
- WINDOW POSITION_FRAME WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to position the named window as a frame at
- the given coordinates of its parent.
-
- WINDOW SCROLL_VISIBLE WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to scroll the named window until the
- indicated box is visible.
-
- WINDOW PLACE_CARET WIN %id% X %n% Y %n% HEIGHT %n%
- The core asked Monkey to render a caret in the named window at the
- indicated position with the indicated height.
-
- WINDOW REMOVE_CARET WIN %id%
- The core asked Monkey to remove any caret in the named window.
-
- WINDOW SCROLL_START WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to scroll the named window to the start of
- the given box.
-
- WINDOW SELECT_MENU WIN %id%
- The core asked Monkey to produce a selection menu for the named
- window.
-
- WINDOW SAVE_LINK WIN %id% URL %url% TITLE %str%
- The core asked Monkey to save a link from the given window with
- the given URL and anchor title.
-
- WINDOW THUMBNAIL WIN %id% URL %url%
- The core asked Monkey to render a thumbnail for the given window
- which is currently at the given URL.
-
- WINDOW REDRAW WIN %id% START
- WINDOW REDRAW WIN %id% STOP
- The core wraps redraws in these messages. Thus PLOT responses can
- be allocated to the appropriate window.
-
- Download window messages
- ------------------------
-
- DOWNLOAD_WINDOW CREATE DWIN %id% WIN %id%
- The core asked Monkey to create a download window owned by the
- given browser window.
-
- DOWNLOAD_WINDOW DATA DWIN %id% SIZE %n% DATA %str%
- The core asked Monkey to update the named download window with
- the given byte size and data string.
-
- DOWNLOAD_WINDOW ERROR DWIN %id% ERROR %str%
- The core asked Monkey to update the named download window with
- the given error message.
-
- DOWNLOAD_WINDOW DONE DWIN %id%
- The core asked Monkey to destroy the named download window.
-
- SSL Certificate messages
- ------------------------
-
- SSLCERT VERIFY CERT %id% URL %url%
- The core asked Monkey to say whether or not a given SSL
- certificate is OK.
-
- 401 Login messages
- ------------------
-
- 401LOGIN OPEN M4 %id% URL %url% REALM %str%
- The core asked Monkey to ask for identification for the named
- realm at the given URL.
-
- Plotter messages
- ----------------
-
- Note, Monkey won't clip coordinates, but sometimes the core does.
-
- PLOT CLIP X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to clip plotting to the given clipping
- rectangle (X0,Y0) (X1,Y1)
-
- PLOT TEXT X %n% Y %n% STR %str%
- The core asked Monkey to plot the given string at the
- given coordinates.
-
- PLOT LINE X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to plot a line with the given start
- and end coordinates.
-
- PLOT RECT X0 %n% Y0 %n% X1 %n% Y1 %n%
- The core asked Monkey to plot a rectangle with the given
- coordinates as the corners.
-
- PLOT BITMAP X %n% Y %n% WIDTH %n% HEIGHT %n%
- The core asked Monkey to plot a bitmap at the given
- coordinates, scaled to the given width/height.
diff --git a/Docs/core-window-interface b/Docs/core-window-interface
deleted file mode 100644
index 3dfbcaf47..000000000
--- a/Docs/core-window-interface
+++ /dev/null
@@ -1,677 +0,0 @@
-Core Window Interface
-=====================
-
-The NetSurf core provides an optional API to frontend implementations
-which allows a number of "standard" window content interfaces to be
-provided.
-
-The currently available user interfaces are:
-
- - Cookies
- - Global history
- - Hotlist
- - SSL certificate view
-
-Although not currently included in future additional user interfaces
-will be available for:
-
- - local history
- - browser render
-
-To be clear these are generic implementations of this functionality
-that any frontend may use. Frontends are free to implement these
-interfaces in any manner as they see fit, the corewindow interface
-simply provides a default.
-
-core window API
----------------
-
-The API is fairly simple and simply involves passing a callback table
-and context pointer to the interface element being constructed.
-
-The header that defines the callback interface is netsurf/core_window.h
-
-The callback table contains five function pointer interfaces which the
-frontend must implement for the core.
-
- - redraw_request
- request a redraw an area of a window
-
- - update_size
- Update the limits of the window
-
- - scroll_visible
- Scroll the window to make area visible
-
- - get_window_dimensions
- Get window viewport dimensions
-
- - drag_status
- Inform corewindow owner of drag status
-
-Each callback will be passed the context pointer for the corewindow
-instance and the relevant additional information necessary to perform
-the operation.
-
-Each exported user interface element wraps this generic interface with
-a concrete implementation. For example the SSL certificate viewer is
-initialised with:
-
-nserror sslcert_viewer_init(struct core_window_callback_table *cw_t,
- void *core_window_handle,
- struct sslcert_session_data *ssl_d);
-
-This call creates a context which will display and navigate the ssl
-session data passed. The frontend must service the callbacks from the
-core to provide the necessary interactions with the frontend windowing
-system.
-
-These actions should ideally use the standard frontend window
-processing. So for the GTK frontend when the core calls the redraw
-operation it simply marks the area passed as damaged (using
-gtk_widget_queue_draw_area()) and lets the standard expose event cause
-the redraw to occour.
-
-If the frontend needs to redraw an area of a window (perhaps an expose
-event occoured) it must call the corewindoe API wrappers
-implementation e.g in the case of ssl certificate viewer
-
-void sslcert_viewer_redraw(struct sslcert_session_data *ssl_d,
- int x, int y, struct rect *clip,
- const struct redraw_context *ctx);
-
-which will perform the plot operations required to update an area of
-the window for that SSL data.
-
-Usage
------
-
-The usage pattern that is expected is for a frontend to create a core
-window impementation that implements the necessary five API in a
-generic way and allows the frontend to provide the specific
-specialisation for each of the user interface elements it wishes to
-use (cookies, SSL viewer etc).
-
-The GTK frontend for example:
-
-has source corewindow.[ch] which implement the five core callbacks
-using generic GTK operations (redraw_request calls
-gtk_widget_queue_draw_area() etc.) and then provides additional
-operations on a GTK drawing area object to attach expose event
-processing, keypress processing etc.
-
-The GTK corewindow (not to be confused with the core window API
-itself, this is purely the gtk wrapper) is used by ssl_cert.c which
-creates a nsgtk_crtvrfy_window structure containing the
-nsgtk_corewindow structure. It attaches actual GTK window handles to
-this structure and populates elements of nsgtk_corewindow and then
-calls sslcert_viewer_init() directly.
-
-frontend skeleton
------------------
-
-An example core window implementation for a frontend ssl certficiate
-viewer is presented here. This implements the suggested usage above
-and provides generic corewindow helpers.
-
-
-frontends/example/corewindow.h
-------------------------------
-
-/*
- * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef EXAMPLE_COREWINDOW_H
-#define EXAMPLE_COREWINDOW_H
-
-#include "netsurf/core_window.h"
-
-/**
- * example core window state
- */
-struct example_corewindow {
-
-
- /*
- * Any variables common to any frontend window would go here.
- * e.g. drawing area handles, toolkit pointers or other state
- */
- example_toolkit_widget *tk_widget;
-
-
-
- /** drag status set by core */
- core_window_drag_status drag_staus;
-
- /** table of callbacks for core window operations */
- struct core_window_callback_table *cb_table;
-
- /**
- * callback to draw on drawable area of example core window
- *
- * \param example_cw The example core window structure.
- * \param r The rectangle of the window that needs updating.
- * \return NSERROR_OK on success otherwise apropriate error code
- */
- nserror (*draw)(struct example_corewindow *example_cw, struct rect *r);
-
- /**
- * callback for keypress on example core window
- *
- * \param example_cw The example core window structure.
- * \param nskey The netsurf key code.
- * \return NSERROR_OK if key processed,
- * NSERROR_NOT_IMPLEMENTED if key not processed
- * otherwise apropriate error code
- */
- nserror (*key)(struct example_corewindow *example_cw, uint32_t nskey);
-
- /**
- * callback for mouse event on example core window
- *
- * \param example_cw The example core window structure.
- * \param mouse_state mouse state
- * \param x location of event
- * \param y location of event
- * \return NSERROR_OK on sucess otherwise apropriate error code.
- */
- nserror (*mouse)(struct example_corewindow *example_cw, browser_mouse_state mouse_state, int x, int y);
-};
-
-/**
- * initialise elements of example core window.
- *
- * As a pre-requisite the draw, key and mouse callbacks must be defined
- *
- * \param example_cw A example core window structure to initialise
- * \return NSERROR_OK on successful initialisation otherwise error code.
- */
-nserror example_corewindow_init(struct example_corewindow *example_cw);
-
-/**
- * finalise elements of example core window.
- *
- * \param example_cw A example core window structure to initialise
- * \return NSERROR_OK on successful finalisation otherwise error code.
- */
-nserror example_corewindow_fini(struct example_corewindow *example_cw);
-
-#endif
-
-frontends/example/corewindow.c
-------------------------------
-
-/*
- * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * \file
- * EXAMPLE generic core window interface.
- *
- * Provides interface for core renderers to the example toolkit drawable area.
- *
- * This module is an object that must be encapsulated. Client users
- * should embed a struct example_corewindow at the beginning of their
- * context for this display surface, fill in relevant data and then
- * call example_corewindow_init()
- *
- * The example core window structure requires the callback for draw, key and
- * mouse operations.
- */
-
-#include <assert.h>
-#include <string.h>
-#include <math.h>
-
-#include "utils/log.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
-#include "utils/utf8.h"
-#include "netsurf/keypress.h"
-#include "netsurf/mouse.h"
-#include "netsurf/plot_style.h"
-
-/* extremely likely there will be additional headers required in a real frontend */
-#include "example/corewindow.h"
-
-
-/* toolkit event handlers that do generic things and call internal callbacks */
-
-
-static bool
-example_cw_mouse_press_event(toolkit_widget *widget, toolkit_button bt, int x, int y, void *ctx)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)ctx;
-
- example_cw->mouse(example_cw, state, x, y);
-
- return true;
-}
-
-static bool
-example_cw_keyrelease_event(toolkit_widget *widget, void *ctx)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)ctx;
-
- example_cw->key(example_cw, keycode);
-
- return true;
-}
-
-
-
-/* signal handler for toolkit window redraw */
-static bool
-example_cw_draw_event(toolkit_widget *widget,
- toolkit_area *tk_area,
- void *ctx)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)ctx;
- struct rect clip;
-
- clip.x0 = tk_area.x;
- clip.y0 = tk_area.y;
- clip.x1 = tk_area.width;
- clip.y1 = tk_area.height;
-
- example_cw->draw(example_cw, &clip);
-
- return true;
-}
-
-
-/**
- * callback from core to request a redraw
- */
-static void
-example_cw_redraw_request(struct core_window *cw, const struct rect *r)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)cw;
-
- toolkit_widget_queue_draw_area(example_cw->widget,
- r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0);
-}
-
-
-static void
-example_cw_update_size(struct core_window *cw, int width, int height)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)cw;
-
- toolkit_widget_set_size_request(EXAMPLE_WIDGET(example_cw->drawing_area),
- width, height);
-}
-
-
-static void
-example_cw_scroll_visible(struct core_window *cw, const struct rect *r)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)cw;
-
- toolkit_scroll_widget(example_cw->widget, r);
-}
-
-
-static void
-example_cw_get_window_dimensions(struct core_window *cw, int *width, int *height)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)cw;
-
- *width = toolkit_get_widget_width(example_cw->widget);
- *height = toolkit_get_widget_height(example_cw->widget);
-}
-
-
-static void
-example_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
-{
- struct example_corewindow *example_cw = (struct example_corewindow *)cw;
- example_cw->drag_staus = ds;
-}
-
-
-struct core_window_callback_table example_cw_cb_table = {
- .redraw_request = example_cw_redraw_request,
- .update_size = example_cw_update_size,
- .scroll_visible = example_cw_scroll_visible,
- .get_window_dimensions = example_cw_get_window_dimensions,
- .drag_status = example_cw_drag_status
-};
-
-/* exported function documented example/corewindow.h */
-nserror example_corewindow_init(struct example_corewindow *example_cw)
-{
- /* setup the core window callback table */
- example_cw->cb_table = &example_cw_cb_table;
-
- /* frontend toolkit specific method of causing example_cw_draw_event to be called when a drawing operation is required */
- toolkit_connect_draw_event(example_cw->tk_widget,
- example_cw_draw_event,
- example_cw);
-
- /* frontend toolkit specific method of causing example_cw_button_press_event to be called when a button press occours */
- toolkit_connect_button_press_event(example_cw->tk_widget,
- example_cw_button_press_event,
- example_cw);
-
- /* frontend toolkit specific method of causing example_cw_button_release_event to be called when a button release occours */
- toolkit_connect_button_release_event(example_cw->tk_widget,
- example_cw_button_release_event,
- example_cw);
-
- /* frontend toolkit specific method of causing example_cw_motion_notify_event to be called when there is motion over the widget */
- toolkit_connect_motion_event(example_cw->tk_widget,
- example_cw_motion_notify_event,
- example_cw);
-
- /* frontend toolkit specific method of causing example_cw_key_press_event to be called when a key press occours */
- toolkit_connect_button_press_event(example_cw->tk_widget,
- example_cw_key_press_event,
- example_cw);
-
- /* frontend toolkit specific method of causing example_cw_key_release_event to be called when a key release occours */
- toolkit_connect_button_release_event(example_cw->tk_widget,
- example_cw_key_release_event,
- example_cw);
-
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in example/corewindow.h */
-nserror example_corewindow_fini(struct example_corewindow *example_cw)
-{
- return NSERROR_OK;
-}
-
-
-frontends/example/ssl_cert.h
-----------------------------
-
-/*
- * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NETSURF_EXAMPLE_SSL_CERT_H
-#define NETSURF_EXAMPLE_SSL_CERT_H 1
-
-struct nsurl;
-struct ssl_cert_info;
-
-/**
- * Prompt the user to verify a certificate with issuse.
- *
- * \param url The URL being verified.
- * \param certs The certificate to be verified
- * \param num The number of certificates to be verified.
- * \param cb Callback upon user decision.
- * \param cbpw Context pointer passed to cb
- * \return NSERROR_OK or error code if prompt creation failed.
- */
-nserror example_cert_verify(struct nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
-
-#endif
-
-frontends/example/ssl_cert.c
-----------------------------
-
-/*
- * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * \file
- * Implementation of example certificate viewing using example core windows.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "utils/log.h"
-#include "netsurf/keypress.h"
-#include "netsurf/plotters.h"
-#include "desktop/sslcert_viewer.h"
-
-#include "example/corewindow.h"
-
-
-/**
- * EXAMPLE certificate viewing window context
- */
-struct example_crtvrfy_window {
- /** example core window context */
- struct example_corewindow core;
-
- /** SSL certificate viewer context data */
- struct sslcert_session_data *ssl_data;
-};
-
-/**
- * destroy a previously created certificate view
- */
-static nserror example_crtvrfy_destroy(struct example_crtvrfy_window *crtvrfy_win)
-{
- nserror res;
-
- res = sslcert_viewer_fini(crtvrfy_win->ssl_data);
- if (res == NSERROR_OK) {
- res = example_corewindow_fini(&crtvrfy_win->core);
- toolkit_windown_destroy(crtvrfy_win->window);
- free(crtvrfy_win);
- }
- return res;
-}
-
-static void
-example_crtvrfy_accept(ExampleButton *w, gpointer data)
-{
- struct example_crtvrfy_window *crtvrfy_win;
- crtvrfy_win = (struct example_crtvrfy_window *)data;
-
- sslcert_viewer_accept(crtvrfy_win->ssl_data);
-
- example_crtvrfy_destroy(crtvrfy_win);
-}
-
-static void
-example_crtvrfy_reject(ExampleWidget *w, gpointer data)
-{
- struct example_crtvrfy_window *crtvrfy_win;
- crtvrfy_win = (struct example_crtvrfy_window *)data;
-
- sslcert_viewer_reject(crtvrfy_win->ssl_data);
-
- example_crtvrfy_destroy(crtvrfy_win);
-}
-
-
-/**
- * callback for mouse action for certificate verify on core window
- *
- * \param example_cw The example core window structure.
- * \param mouse_state netsurf mouse state on event
- * \param x location of event
- * \param y location of event
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-example_crtvrfy_mouse(struct example_corewindow *example_cw,
- browser_mouse_state mouse_state,
- int x, int y)
-{
- struct example_crtvrfy_window *crtvrfy_win;
- /* technically degenerate container of */
- crtvrfy_win = (struct example_crtvrfy_window *)example_cw;
-
- sslcert_viewer_mouse_action(crtvrfy_win->ssl_data, mouse_state, x, y);
-
- return NSERROR_OK;
-}
-
-/**
- * callback for keypress for certificate verify on core window
- *
- * \param example_cw The example core window structure.
- * \param nskey The netsurf key code
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-example_crtvrfy_key(struct example_corewindow *example_cw, uint32_t nskey)
-{
- struct example_crtvrfy_window *crtvrfy_win;
-
- /* technically degenerate container of */
- crtvrfy_win = (struct example_crtvrfy_window *)example_cw;
-
- if (sslcert_viewer_keypress(crtvrfy_win->ssl_data, nskey)) {
- return NSERROR_OK;
- }
- return NSERROR_NOT_IMPLEMENTED;
-}
-
-/**
- * callback on draw event for certificate verify on core window
- *
- * \param example_cw The example core window structure.
- * \param r The rectangle of the window that needs updating.
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-example_crtvrfy_draw(struct example_corewindow *example_cw, struct rect *r)
-{
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &example_plotters
- };
- struct example_crtvrfy_window *crtvrfy_win;
-
- /* technically degenerate container of */
- crtvrfy_win = (struct example_crtvrfy_window *)example_cw;
-
- sslcert_viewer_redraw(crtvrfy_win->ssl_data, 0, 0, r, &ctx);
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in example/ssl_cert.h */
-nserror example_cert_verify(struct nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
-{
- struct example_crtvrfy_window *ncwin;
- nserror res;
-
- ncwin = malloc(sizeof(struct example_crtvrfy_window));
- if (ncwin == NULL) {
- return NSERROR_NOMEM;
- }
-
- res = toolkit_create_window(&ncwin->window);
- if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
- free(ncwin);
- return res;
- }
-
- /* store the widget that the toolkit is drawing into */
- ncwin->core.widget = toolkit_get_widget(ncwin->window, "SSLDrawingArea"));
-
- /* would typicaly setup toolkit accept/reject buttons etc. here */
- toolkit_connect_button_press(ncwin->tk_accept_button,
- example_crtvrfy_accept,
- ncwin);
-
-
- /* initialise example core window */
- ncwin->core.draw = example_crtvrfy_draw;
- ncwin->core.key = example_crtvrfy_key;
- ncwin->core.mouse = example_crtvrfy_mouse;
-
- res = example_corewindow_init(&ncwin->core);
- if (res != NSERROR_OK) {
- free(ncwin);
- return res;
- }
-
- /* initialise certificate viewing interface */
- res = sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
- &ncwin->ssl_data);
- if (res != NSERROR_OK) {
- free(ncwin);
- return res;
- }
-
- res = sslcert_viewer_init(ncwin->core.cb_table,
- (struct core_window *)ncwin,
- ncwin->ssl_data);
- if (res != NSERROR_OK) {
- free(ncwin);
- return res;
- }
-
- toolkit_widget_show(ncwin->window);
-
- return NSERROR_OK;
-}
diff --git a/Makefile b/Makefile
index 5f2697fdc..3e63fb242 100644
--- a/Makefile
+++ b/Makefile
@@ -84,13 +84,6 @@ ifeq ($(HOST),AmigaOS)
endif
endif
-ifeq ($(HOST),Darwin)
- HOST := macosx
- ifeq ($(TARGET),)
- TARGET := cocoa
- endif
-endif
-
ifeq ($(HOST),FreeMiNT)
HOST := mint
endif
@@ -116,7 +109,7 @@ ifeq ($(TARGET),)
endif
# valid values for the TARGET
-VLDTARGET := riscos gtk gtk3 beos amiga amigaos3 framebuffer windows atari cocoa monkey
+VLDTARGET := riscos gtk gtk3 beos amiga amigaos3 framebuffer windows atari monkey
# Check for valid TARGET
ifeq ($(filter $(VLDTARGET),$(TARGET)),)
@@ -137,7 +130,7 @@ MESSAGES_FILTER=any
# The languages in the fat messages to convert
MESSAGES_LANGUAGES=de en fr it nl
# The target directory for the split messages
-MESSAGES_TARGET=!NetSurf/Resources
+MESSAGES_TARGET=resources
# Defaults for tools
PERL=perl
@@ -255,9 +248,6 @@ else
PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
endif
else
- ifeq ($(TARGET),cocoa)
- PKG_CONFIG := PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):/usr/local/lib/pkgconfig" pkg-config
- else
ifeq ($(TARGET),atari)
ifeq ($(HOST),atari)
PKG_CONFIG := pkg-config
@@ -323,7 +313,6 @@ else
endif
endif
endif
- endif
endif
endif
endif
@@ -516,9 +505,12 @@ CXXWARNFLAGS :=
# C default warning flags
CWARNFLAGS := -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-# Pull in the configuration
+# Pull in the default configuration
include Makefile.defaults
+# Pull in the user configuration
+-include Makefile.config
+
# libraries enabled by feature switch without pkgconfig file
$(eval $(call feature_switch,JPEG,JPEG (libjpeg),-DWITH_JPEG,-ljpeg,-UWITH_JPEG,))
$(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf -lpng,-UWITH_PDF_EXPORT,))
@@ -545,6 +537,7 @@ NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
NETSURF_FEATURE_OPENSSL_CFLAGS := -DWITH_OPENSSL
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_NSPSL_CFLAGS := -DWITH_NSPSL
+NETSURF_FEATURE_NSLOG_CFLAGS := -DWITH_NSLOG
# libcurl and openssl ordering matters as if libcurl requires ssl it
# needs to come first in link order to ensure its symbols can be
@@ -565,6 +558,7 @@ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG))
$(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite))
$(eval $(call pkg_config_find_and_add_enabled,NSPSL,libnspsl,PSL))
+$(eval $(call pkg_config_find_and_add_enabled,NSLOG,libnslog,LOG))
# List of directories in which headers are searched for
INCLUDE_DIRS :=. include $(OBJROOT)
@@ -577,6 +571,36 @@ CXXFLAGS += -DNETSURF_UA_FORMAT_STRING=\"$(NETSURF_UA_FORMAT_STRING)\"
CFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
CXXFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
+# set the logging level
+CFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
+CXXFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
+
+# If we're building the sanitize goal, override things
+ifneq ($(filter-out sanitize,$(MAKECMDGOALS)),$(MAKECMDGOALS))
+override NETSURF_USE_SANITIZER := YES
+override NETSURF_RECOVER_SANITIZERS := NO
+endif
+
+# If we're going to use the sanitizer set it up
+ifeq ($(NETSURF_USE_SANITIZER),YES)
+SAN_FLAGS := -fsanitize=address -fsanitize=undefined
+ifeq ($(NETSURF_RECOVER_SANITIZERS),NO)
+SAN_FLAGS += -fno-sanitize-recover
+endif
+else
+SAN_FLAGS :=
+endif
+CFLAGS += $(SAN_FLAGS)
+CXXFLAGS += $(SAN_FLAGS)
+LDFLAGS += $(SAN_FLAGS)
+
+# and the logging filter
+CFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
+CXXFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
+# and the verbose logging filter
+CFLAGS += -DNETSURF_BUILTIN_VERBOSE_FILTER=\"$(NETSURF_BUILTIN_VERBOSE_FILTER)\"
+CXXFLAGS += -DNETSURF_BUILTIN_VERBOSE_FILTER=\"$(NETSURF_BUILTIN_VERBOSE_FILTER)\"
+
# ----------------------------------------------------------------------------
# General make rules
# ----------------------------------------------------------------------------
@@ -612,21 +636,27 @@ include frontends/Makefile
# Content sources
include content/Makefile
-# render sources
-include render/Makefile
-
# utility sources
include utils/Makefile
# http utility sources
include utils/http/Makefile
+# nsurl utility sources
+include utils/nsurl/Makefile
+
# Desktop sources
include desktop/Makefile
# S_COMMON are sources common to all builds
-S_COMMON := $(S_CONTENT) $(S_FETCHERS) $(S_RENDER) $(S_UTILS) $(S_HTTP) \
- $(S_DESKTOP) $(S_JAVASCRIPT_BINDING)
+S_COMMON := \
+ $(S_CONTENT) \
+ $(S_FETCHERS) \
+ $(S_UTILS) \
+ $(S_HTTP) \
+ $(S_NSURL) \
+ $(S_DESKTOP) \
+ $(S_JAVASCRIPT_BINDING)
# ----------------------------------------------------------------------------
@@ -636,16 +666,12 @@ S_COMMON := $(S_CONTENT) $(S_FETCHERS) $(S_RENDER) $(S_UTILS) $(S_HTTP) \
# Message splitting rule generation macro
# 1 = Language
define split_messages
-.INTERMEDIATE:$$(MESSAGES_TARGET)/$(1)/Messages.tmp
-$$(MESSAGES_TARGET)/$(1)/Messages.tmp: resources/FatMessages
+$$(MESSAGES_TARGET)/$(1)/Messages: resources/FatMessages
$$(VQ)echo "MSGSPLIT: Language: $(1) Filter: $$(MESSAGES_FILTER)"
$$(Q)$$(MKDIR) -p $$(MESSAGES_TARGET)/$(1)
- $$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ $$<
-
-$$(MESSAGES_TARGET)/$(1)/Messages: $$(MESSAGES_TARGET)/$(1)/Messages.tmp
- $$(VQ)echo "COMPRESS: $$@"
- $$(Q)gzip -9n < $$< > $$@
+ $$(Q)$$(RM) $$@
+ $$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ -z $$<
CLEAN_MESSAGES += $$(MESSAGES_TARGET)/$(1)/Messages
MESSAGES += $$(MESSAGES_TARGET)/$(1)/Messages
@@ -737,7 +763,6 @@ DEPFILES :=
# 3 = obj filename, no prefix
define dependency_generate_c
DEPFILES += $(2)
-$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1) Makefile.config
endef
@@ -746,7 +771,6 @@ endef
# 3 = obj filename, no prefix
define dependency_generate_s
DEPFILES += $(2)
-$$(DEPROOT)/$(2): $$(DEPROOT)/created $(1)
endef
@@ -756,7 +780,7 @@ endef
ifeq ($(CC_MAJOR),2)
# simpler deps tracking for gcc2...
define compile_target_c
-$$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
+$$(OBJROOT)/$(2): $(1) $$(OBJROOT)/created $$(DEPROOT)/created
$$(VQ)echo " DEP: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(3)
$$(Q)$$(CC) $$(IFLAGS) $$(CFLAGS) -MM \
@@ -769,7 +793,7 @@ $$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
endef
else
define compile_target_c
-$$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
+$$(OBJROOT)/$(2): $(1) $$(OBJROOT)/created $$(DEPROOT)/created
$$(VQ)echo " COMPILE: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(3)
$$(Q)$$(RM) $$(OBJROOT)/$(2)
@@ -781,7 +805,7 @@ endef
endif
define compile_target_cpp
-$$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
+$$(OBJROOT)/$(2): $(1) $$(OBJROOT)/created $$(DEPROOT)/created
$$(VQ)echo " DEP: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(3)
$$(Q)$$(CC) $$(IFLAGS) $$(CXXFLAGS) $$(COMMON_WARNFLAGS) $$(CXXWARNFLAGS) -MM \
@@ -797,7 +821,7 @@ endef
# 2 = obj filename, no prefix
# 3 = dep filename, no prefix
define compile_target_s
-$$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
+$$(OBJROOT)/$(2): $(1) $$(OBJROOT)/created $$(DEPROOT)/created
$$(VQ)echo "ASSEMBLE: $(1)"
$$(Q)$$(RM) $$(DEPROOT)/$(3)
$$(Q)$$(RM) $$(OBJROOT)/$(2)
@@ -880,7 +904,7 @@ install: all-program install-$(TARGET)
.PHONY: docs
-docs: Docs/Doxyfile
+docs: docs/Doxyfile
doxygen $<
diff --git a/Makefile.config.example b/Makefile.config.example
index aeddc1071..7fa7f41cc 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -33,3 +33,9 @@
### To change flags to javascript binding generator
# GBFLAGS:=-g
+
+### To enable ASAN and UBSAN support in builds regardless of target
+# override NETSURF_USE_SANITIZER := YES
+
+### If you're using the sanitizers and you want it to stop on failure...
+# override NETSURF_RECOVER_SANITIZERS := NO
diff --git a/Makefile.defaults b/Makefile.defaults
index 619b8db08..51090109e 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -70,8 +70,21 @@ NETSURF_USE_DUKTAPE := YES
NETSURF_USE_HARU_PDF := NO
# Enable the use of the Public suffix library to detect supercookies
+# Valid options: YES, NO, AUTO (highly recommended)
NETSURF_USE_NSPSL := AUTO
+# Enable use of filtered logging library
+# Valid options: YES, NO, AUTO (highly recommended)
+NETSURF_USE_NSLOG := AUTO
+# The minimum logging level *compiled* into netsurf
+# Valid options are: DEEPDEBUG, DEBUG, VERBOSE, INFO, WARNING, ERROR, CRITICAL
+NETSURF_LOG_LEVEL := INFO
+# The log filter set during log initialisation before options are available
+NETSURF_BUILTIN_LOG_FILTER := level:WARNING
+# The log filter set during log initialisation before options are available
+# if the logging level is set to verbose
+NETSURF_BUILTIN_VERBOSE_FILTER := level:VERBOSE
+
# Enable stripping the NetSurf binary
# Valid options: YES, NO
NETSURF_STRIP_BINARY := NO
@@ -96,6 +109,11 @@ NETSURF_USE_LIBICONV_PLUG := YES
# Valid options: YES, NO
NETSURF_FS_BACKING_STORE := NO
+# Enable the ASAN and UBSAN flags regardless of targets
+NETSURF_USE_SANITIZERS := NO
+# But recover after sanitizer failure
+NETSURF_RECOVER_SANITIZERS := YES
+
# Initial CFLAGS. Optimisation level etc. tend to be target specific.
CFLAGS :=
@@ -136,11 +154,9 @@ endif
# ----------------------------------------------------------------------------
-# Include any local configuration
+# Detect double inclusion
# ----------------------------------------------------------------------------
ifneq ($(MAKEFILE_DEFAULTS_FINISHED),)
$(error Makefile.defaults has been double-included. If you did something utterly brain-dead such as copying Makefile.defaults to Makefile.config then you deserve all the pain you can imagine. Do NOT do that. Why not read the comments at the top of Makefile.defaults. They are there to help you, you numpty)
endif
MAKEFILE_DEFAULTS_FINISHED=yes
--include Makefile.config
-
diff --git a/content/content.c b/content/content.c
index 2eb035cdf..9a240417d 100644
--- a/content/content.c
+++ b/content/content.c
@@ -73,7 +73,8 @@ nserror content__init(struct content *c, const content_handler *handler,
struct content_user *user_sentinel;
nserror error;
- LOG("url "URL_FMT_SPC" -> %p", nsurl_access(llcache_handle_get_url(llcache)), c);
+ NSLOG(netsurf, INFO, "url "URL_FMT_SPC" -> %p",
+ nsurl_access(llcache_handle_get_url(llcache)), c);
user_sentinel = calloc(1, sizeof(struct content_user));
if (user_sentinel == NULL) {
@@ -163,7 +164,7 @@ nserror content_llcache_callback(llcache_handle *llcache,
content_set_status(c, messages_get("Processing"));
msg_data.explicit_status_text = NULL;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
content_convert(c);
}
@@ -172,17 +173,17 @@ nserror content_llcache_callback(llcache_handle *llcache,
/** \todo Error page? */
c->status = CONTENT_STATUS_ERROR;
msg_data.error = event->data.msg;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
break;
case LLCACHE_EVENT_PROGRESS:
content_set_status(c, event->data.msg);
msg_data.explicit_status_text = NULL;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
break;
case LLCACHE_EVENT_REDIRECT:
msg_data.redirect.from = event->data.redirect.from;
msg_data.redirect.to = event->data.redirect.to;
- content_broadcast(c, CONTENT_MSG_REDIRECT, msg_data);
+ content_broadcast(c, CONTENT_MSG_REDIRECT, &msg_data);
break;
}
@@ -272,7 +273,8 @@ void content_convert(struct content *c)
if (c->locked == true)
return;
- LOG("content "URL_FMT_SPC" (%p)", nsurl_access(llcache_handle_get_url(c->llcache)), c);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p)",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c);
if (c->handler->data_complete != NULL) {
c->locked = true;
@@ -292,8 +294,6 @@ void content_convert(struct content *c)
void content_set_ready(struct content *c)
{
- union content_msg_data msg_data;
-
/* The content must be locked at this point, as it can only
* become READY after conversion. */
assert(c->locked);
@@ -301,7 +301,7 @@ void content_set_ready(struct content *c)
c->status = CONTENT_STATUS_READY;
content_update_status(c);
- content_broadcast(c, CONTENT_MSG_READY, msg_data);
+ content_broadcast(c, CONTENT_MSG_READY, NULL);
}
/**
@@ -310,7 +310,6 @@ void content_set_ready(struct content *c)
void content_set_done(struct content *c)
{
- union content_msg_data msg_data;
uint64_t now_ms;
nsu_getmonotonic_ms(&now_ms);
@@ -318,7 +317,7 @@ void content_set_done(struct content *c)
c->status = CONTENT_STATUS_DONE;
c->time = now_ms - c->time;
content_update_status(c);
- content_broadcast(c, CONTENT_MSG_DONE, msg_data);
+ content_broadcast(c, CONTENT_MSG_DONE, NULL);
}
/**
@@ -363,7 +362,7 @@ void content__reformat(struct content *c, bool background,
c->locked = false;
data.background = background;
- content_broadcast(c, CONTENT_MSG_REFORMAT, data);
+ content_broadcast(c, CONTENT_MSG_REFORMAT, &data);
}
}
@@ -379,7 +378,8 @@ void content_destroy(struct content *c)
struct content_rfc5988_link *link;
assert(c);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
assert(c->locked == false);
if (c->handler->destroy != NULL)
@@ -436,7 +436,7 @@ void content_mouse_track(hlcache_handle *h, struct browser_window *bw,
} else {
union content_msg_data msg_data;
msg_data.pointer = BROWSER_POINTER_AUTO;
- content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
}
@@ -540,7 +540,7 @@ void content__request_redraw(struct content *c,
data.redraw.object_width = c->width;
data.redraw.object_height = c->height;
- content_broadcast(c, CONTENT_MSG_REDRAW, data);
+ content_broadcast(c, CONTENT_MSG_REDRAW, &data);
}
@@ -588,7 +588,7 @@ bool content_scaled_redraw(struct hlcache_handle *h,
return true;
}
- LOG("Content %p %dx%d ctx:%p", c, width, height, ctx);
+ NSLOG(netsurf, INFO, "Content %p %dx%d ctx:%p", c, width, height, ctx);
if (ctx->plot->option_knockout) {
knockout_plot_start(ctx, &new_ctx);
@@ -600,12 +600,12 @@ bool content_scaled_redraw(struct hlcache_handle *h,
clip.x1 = width;
clip.y1 = height;
- new_ctx.plot->clip(&clip);
+ new_ctx.plot->clip(&new_ctx, &clip);
/* Plot white background */
- plot_ok &= new_ctx.plot->rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
- plot_style_fill_white);
-
+ plot_ok &= (new_ctx.plot->rectangle(&new_ctx,
+ plot_style_fill_white,
+ &clip) == NSERROR_OK);
/* Set up content redraw data */
data.x = 0;
@@ -628,7 +628,7 @@ bool content_scaled_redraw(struct hlcache_handle *h,
plot_ok &= c->handler->redraw(c, &data, &clip, &new_ctx);
if (ctx->plot->option_knockout) {
- knockout_plot_end();
+ knockout_plot_end(ctx);
}
return plot_ok;
@@ -646,14 +646,20 @@ bool content_scaled_redraw(struct hlcache_handle *h,
* called with the content.
*/
-bool content_add_user(struct content *c,
- void (*callback)(struct content *c, content_msg msg,
- union content_msg_data data, void *pw),
+bool content_add_user(
+ struct content *c,
+ void (*callback)(
+ struct content *c,
+ content_msg msg,
+ const union content_msg_data *data,
+ void *pw),
void *pw)
{
struct content_user *user;
- LOG("content "URL_FMT_SPC" (%p), user %p %p", nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, pw);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c, callback,
+ pw);
user = malloc(sizeof(struct content_user));
if (!user)
return false;
@@ -676,13 +682,19 @@ bool content_add_user(struct content *c,
* content_add_user().
*/
-void content_remove_user(struct content *c,
- void (*callback)(struct content *c, content_msg msg,
- union content_msg_data data, void *pw),
+void content_remove_user(
+ struct content *c,
+ void (*callback)(
+ struct content *c,
+ content_msg msg,
+ const union content_msg_data *data,
+ void *pw),
void *pw)
{
struct content_user *user, *next;
- LOG("content "URL_FMT_SPC" (%p), user %p %p", nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, pw);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c, callback,
+ pw);
/* user_list starts with a sentinel */
for (user = c->user_list; user->next != 0 &&
@@ -690,7 +702,7 @@ void content_remove_user(struct content *c,
user->next->pw == pw); user = user->next)
;
if (user->next == 0) {
- LOG("user not found in list");
+ NSLOG(netsurf, INFO, "user not found in list");
assert(0);
return;
}
@@ -753,11 +765,12 @@ bool content_is_shareable(struct content *c)
*/
void content_broadcast(struct content *c, content_msg msg,
- union content_msg_data data)
+ const union content_msg_data *data)
{
struct content_user *user, *next;
assert(c);
-// LOG("%p %s -> %d", c, c->url, msg);
+
+ NSLOG(netsurf, DEEPDEBUG, "%p -> msg:%d", c, msg);
for (user = c->user_list->next; user != 0; user = next) {
next = user->next; /* user may be destroyed during callback */
if (user->callback != 0)
@@ -777,8 +790,10 @@ void content_broadcast_errorcode(struct content *c, nserror errorcode)
for (user = c->user_list->next; user != 0; user = next) {
next = user->next; /* user may be destroyed during callback */
- if (user->callback != 0)
- user->callback(c, CONTENT_MSG_ERRORCODE, data, user->pw);
+ if (user->callback != 0) {
+ user->callback(c, CONTENT_MSG_ERRORCODE,
+ &data, user->pw);
+ }
}
}
@@ -800,7 +815,8 @@ void content_open(hlcache_handle *h, struct browser_window *bw,
{
struct content *c = hlcache_handle_get_content(h);
assert(c != 0);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
if (c->handler->open != NULL)
c->handler->open(c, bw, page, params);
}
@@ -816,7 +832,8 @@ void content_close(hlcache_handle *h)
{
struct content *c = hlcache_handle_get_content(h);
assert(c != 0);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
if (c->handler->close != NULL)
c->handler->close(c);
}
@@ -1040,7 +1057,7 @@ bool content__add_rfc5988_link(struct content *c,
/* broadcast the data */
msg_data.rfc5988_link = newlink;
- content_broadcast(c, CONTENT_MSG_LINK, msg_data);
+ content_broadcast(c, CONTENT_MSG_LINK, &msg_data);
return true;
}
@@ -1464,7 +1481,7 @@ nserror content__clone(const struct content *c, struct content *nc)
*/
nserror content_abort(struct content *c)
{
- LOG("Aborting %p", c);
+ NSLOG(netsurf, INFO, "Aborting %p", c);
if (c->handler->stop != NULL)
c->handler->stop(c);
diff --git a/content/content.h b/content/content.h
index 308b2113b..e555df269 100644
--- a/content/content.h
+++ b/content/content.h
@@ -200,10 +200,24 @@ union content_msg_data {
void content_destroy(struct content *c);
-bool content_add_user(struct content *h, void (*callback)(struct content *c, content_msg msg, union content_msg_data data, void *pw), void *pw);
-
-
-void content_remove_user(struct content *c, void (*callback)(struct content *c, content_msg msg, union content_msg_data data, void *pw), void *pw);
+bool content_add_user(
+ struct content *h,
+ void (*callback)(
+ struct content *c,
+ content_msg msg,
+ const union content_msg_data *data,
+ void *pw),
+ void *pw);
+
+
+void content_remove_user(
+ struct content *c,
+ void (*callback)(
+ struct content *c,
+ content_msg msg,
+ const union content_msg_data *data,
+ void *pw),
+ void *pw);
uint32_t content_count_users(struct content *c);
diff --git a/content/content_factory.c b/content/content_factory.c
index 224220796..935354a5d 100644
--- a/content/content_factory.c
+++ b/content/content_factory.c
@@ -125,12 +125,14 @@ static const content_handler *content_lookup(lwc_string *mime_type)
for (entry = content_handlers; entry != NULL; entry = entry->next) {
if (lwc_string_caseless_isequal(mime_type, entry->mime_type,
- &match) == lwc_error_ok && match)
+ &match) == lwc_error_ok && match) {
break;
+ }
}
- if (entry != NULL)
+ if (entry != NULL) {
return entry->handler;
+ }
return NULL;
}
diff --git a/content/content_protected.h b/content/content_protected.h
index ef38cb12d..21b73a662 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -92,8 +92,11 @@ struct content_handler {
/** Linked list of users of a content. */
struct content_user
{
- void (*callback)(struct content *c, content_msg msg,
- union content_msg_data data, void *pw);
+ void (*callback)(
+ struct content *c,
+ content_msg msg,
+ const union content_msg_data *data,
+ void *pw);
void *pw;
struct content_user *next;
@@ -166,7 +169,7 @@ void content_set_error(struct content *c);
void content_set_status(struct content *c, const char *status_message);
void content_broadcast(struct content *c, content_msg msg,
- union content_msg_data data);
+ const union content_msg_data *data);
/**
* Send an errorcode message to all users.
*/
diff --git a/content/fetch.c b/content/fetch.c
index a1542eb01..766502941 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -26,8 +26,8 @@
* around the fetcher specific methods.
*
* Active fetches are held in the circular linked list ::fetch_ring. There may
- * be at most ::option_max_fetchers_per_host active requests per Host: header.
- * There may be at most ::option_max_fetchers active requests overall. Inactive
+ * be at most nsoption max_fetchers_per_host active requests per Host: header.
+ * There may be at most nsoption max_fetchers active requests overall. Inactive
* fetches are stored in the ::queue_ring waiting for use.
*/
@@ -60,16 +60,6 @@
#include "javascript/fetcher.h"
#include "content/urldb.h"
-/* Define this to turn on verbose fetch logging */
-#undef DEBUG_FETCH_VERBOSE
-
-/** Verbose fetcher logging */
-#ifdef DEBUG_FETCH_VERBOSE
-#define FETCH_LOG(x...) LOG(x...)
-#else
-#define FETCH_LOG(x...)
-#endif
-
/** The maximum number of fetchers that can be added */
#define MAX_FETCHERS 10
@@ -158,8 +148,10 @@ static int get_fetcher_for_scheme(lwc_string *scheme)
static bool fetch_dispatch_job(struct fetch *fetch)
{
RING_REMOVE(queue_ring, fetch);
- FETCH_LOG("Attempting to start fetch %p, fetcher %p, url %s", fetch,
- fetch->fetcher_handle, nsurl_access(fetch->url));
+ NSLOG(fetch, DEBUG,
+ "Attempting to start fetch %p, fetcher %p, url %s", fetch,
+ fetch->fetcher_handle,
+ nsurl_access(fetch->url));
if (!fetchers[fetch->fetcherd].ops.start(fetch->fetcher_handle)) {
RING_INSERT(queue_ring, fetch); /* Put it back on the end of the queue */
@@ -210,25 +202,25 @@ static bool fetch_choose_and_dispatch(void)
static void dump_rings(void)
{
-#ifdef DEBUG_FETCH_VERBOSE
struct fetch *q;
struct fetch *f;
q = queue_ring;
if (q) {
do {
- LOG("queue_ring: %s", nsurl_access(q->url));
+ NSLOG(fetch, DEBUG, "queue_ring: %s",
+ nsurl_access(q->url));
q = q->r_next;
} while (q != queue_ring);
}
f = fetch_ring;
if (f) {
do {
- LOG("fetch_ring: %s", nsurl_access(f->url));
+ NSLOG(fetch, DEBUG, "fetch_ring: %s",
+ nsurl_access(f->url));
f = f->r_next;
} while (f != fetch_ring);
}
-#endif
}
/**
@@ -244,7 +236,10 @@ static bool fetch_dispatch_jobs(void)
RING_GETSIZE(struct fetch, queue_ring, all_queued);
RING_GETSIZE(struct fetch, fetch_ring, all_active);
- FETCH_LOG("queue_ring %i, fetch_ring %i", all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "queue_ring %i, fetch_ring %i",
+ all_queued,
+ all_active);
dump_rings();
while ((all_queued != 0) &&
@@ -252,12 +247,14 @@ static bool fetch_dispatch_jobs(void)
fetch_choose_and_dispatch()) {
all_queued--;
all_active++;
- FETCH_LOG("%d queued, %d fetching",
- all_queued, all_active);
+ NSLOG(fetch, DEBUG,
+ "%d queued, %d fetching",
+ all_queued,
+ all_active);
}
- FETCH_LOG("Fetch ring is now %d elements.", all_active);
- FETCH_LOG("Queue ring is now %d elements.", all_queued);
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
return (all_active > 0);
}
@@ -267,7 +264,7 @@ static void fetcher_poll(void *unused)
int fetcherd;
if (fetch_dispatch_jobs()) {
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
/* fetcher present */
@@ -341,7 +338,10 @@ void fetcher_quit(void)
* the reference count to allow the fetcher to
* be stopped.
*/
- LOG("Fetcher for scheme %s still has %d active users at quit.", lwc_string_data(fetchers[fetcherd].scheme), fetchers[fetcherd].refcount);
+ NSLOG(fetch, INFO,
+ "Fetcher for scheme %s still has %d active users at quit.",
+ lwc_string_data(fetchers[fetcherd].scheme),
+ fetchers[fetcherd].refcount);
fetchers[fetcherd].refcount = 1;
}
@@ -391,12 +391,12 @@ fetch_fdset(fd_set *read_fd_set,
int fetcherd; /* fetcher index */
if (!fetch_dispatch_jobs()) {
- FETCH_LOG("No jobs");
+ NSLOG(fetch, DEBUG, "No jobs");
*maxfd_out = -1;
return NSERROR_OK;
}
- FETCH_LOG("Polling fetchers");
+ NSLOG(fetch, DEBUG, "Polling fetchers");
for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) {
if (fetchers[fetcherd].refcount > 0) {
@@ -479,7 +479,7 @@ fetch_start(nsurl *url,
return NSERROR_NO_FETCH_HANDLER;
}
- FETCH_LOG("fetch %p, url '%s'", fetch, nsurl_access(url));
+ NSLOG(fetch, DEBUG, "fetch %p, url '%s'", fetch, nsurl_access(url));
/* construct a new fetch structure */
fetch->callback = callback;
@@ -571,7 +571,7 @@ fetch_start(nsurl *url,
/* Ask the queue to run. */
if (fetch_dispatch_jobs()) {
- FETCH_LOG("scheduling poll");
+ NSLOG(fetch, DEBUG, "scheduling poll");
/* schedule active fetchers to run again in 10ms */
guit->misc->schedule(10, fetcher_poll, NULL);
}
@@ -584,7 +584,8 @@ fetch_start(nsurl *url,
void fetch_abort(struct fetch *f)
{
assert(f);
- FETCH_LOG("fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
+ NSLOG(fetch, DEBUG,
+ "fetch %p, fetcher %p, url '%s'", f, f->fetcher_handle,
nsurl_access(f->url));
fetchers[f->fetcherd].ops.abort(f->fetcher_handle);
}
@@ -592,7 +593,10 @@ void fetch_abort(struct fetch *f)
/* exported interface documented in content/fetch.h */
void fetch_free(struct fetch *f)
{
- FETCH_LOG("Freeing fetch %p, fetcher %p", f, f->fetcher_handle);
+ NSLOG(fetch, DEBUG,
+ "Freeing fetch %p, fetcher %p",
+ f,
+ f->fetcher_handle);
fetchers[f->fetcherd].ops.free(f->fetcher_handle);
@@ -718,7 +722,8 @@ void fetch_multipart_data_destroy(struct fetch_multipart_data *list)
free(list->name);
free(list->value);
if (list->file) {
- FETCH_LOG("Freeing rawfile: %s", list->rawfile);
+ NSLOG(fetch, DEBUG,
+ "Freeing rawfile: %s", list->rawfile);
free(list->rawfile);
}
free(list);
@@ -736,8 +741,13 @@ fetch_send_callback(const fetch_msg *msg, struct fetch *fetch)
/* exported interface documented in content/fetch.h */
void fetch_remove_from_queues(struct fetch *fetch)
{
- FETCH_LOG("Fetch %p, fetcher %p can be freed",
- fetch, fetch->fetcher_handle);
+ int all_active;
+ int all_queued;
+
+ NSLOG(fetch, DEBUG,
+ "Fetch %p, fetcher %p can be freed",
+ fetch,
+ fetch->fetcher_handle);
/* Go ahead and free the fetch properly now */
if (fetch->fetch_is_active) {
@@ -746,24 +756,19 @@ void fetch_remove_from_queues(struct fetch *fetch)
RING_REMOVE(queue_ring, fetch);
}
-#ifdef DEBUG_FETCH_VERBOSE
- int all_active;
- int all_queued;
RING_GETSIZE(struct fetch, fetch_ring, all_active);
RING_GETSIZE(struct fetch, queue_ring, all_queued);
- LOG("Fetch ring is now %d elements.", all_active);
-
- LOG("Queue ring is now %d elements.", all_queued);
-#endif
+ NSLOG(fetch, DEBUG, "Fetch ring is now %d elements.", all_active);
+ NSLOG(fetch, DEBUG, "Queue ring is now %d elements.", all_queued);
}
/* exported interface documented in content/fetch.h */
void fetch_set_http_code(struct fetch *fetch, long http_code)
{
- FETCH_LOG("Setting HTTP code to %ld", http_code);
+ NSLOG(fetch, DEBUG, "Setting HTTP code to %ld", http_code);
fetch->http_code = http_code;
}
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 7d0e40c24..a358492ab 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -67,6 +67,21 @@
/** maximum number of X509 certificates in chain for TLS connection */
#define MAX_CERTS 10
+/* the ciphersuites we are willing to use */
+#define CIPHER_LIST \
+ /* disable everything */ \
+ "-ALL:" \
+ /* enable TLSv1.2 PFS suites */ \
+ "EECDH+AES+TLSv1.2:EDH+AES+TLSv1.2:" \
+ /* enable PFS AES GCM suites */ \
+ "EECDH+AESGCM:EDH+AESGCM:" \
+ /* Enable PFS AES CBC suites */ \
+ "EECDH+AES:EDH+AES:" \
+ /* Enable non-PFS fallback suite */ \
+ "AES128-SHA:" \
+ /* Remove any PFS suites using weak DSA key exchange */ \
+ "-DSS"
+
/** SSL certificate info */
struct cert_info {
X509 *cert; /**< Pointer to certificate */
@@ -155,7 +170,8 @@ static void ns_X509_free(X509 *cert)
*/
static bool fetch_curl_initialise(lwc_string *scheme)
{
- LOG("Initialise cURL fetcher for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "Initialise cURL fetcher for %s",
+ lwc_string_data(scheme));
curl_fetchers_registered++;
return true; /* Always succeeds */
}
@@ -171,17 +187,20 @@ static void fetch_curl_finalise(lwc_string *scheme)
struct cache_handle *h;
curl_fetchers_registered--;
- LOG("Finalise cURL fetcher %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "Finalise cURL fetcher %s",
+ lwc_string_data(scheme));
if (curl_fetchers_registered == 0) {
CURLMcode codem;
/* All the fetchers have been finalised. */
- LOG("All cURL fetchers finalised, closing down cURL");
+ NSLOG(netsurf, INFO,
+ "All cURL fetchers finalised, closing down cURL");
curl_easy_cleanup(fetch_blank_curl);
codem = curl_multi_cleanup(fetch_curl_multi);
if (codem != CURLM_OK)
- LOG("curl_multi_cleanup failed: ignoring");
+ NSLOG(netsurf, INFO,
+ "curl_multi_cleanup failed: ignoring");
curl_global_cleanup();
}
@@ -251,7 +270,9 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
"application/octet-stream",
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s)", code, control->name);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s)", code,
+ control->name);
} else {
char *mimetype = guit->fetch->mimetype(control->value);
code = curl_formadd(&post, &last,
@@ -262,7 +283,11 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
(mimetype != 0 ? mimetype : "text/plain"),
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s=%s)", code, control->name, control->value);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s=%s)",
+ code,
+ control->name,
+ control->value);
free(mimetype);
}
free(leafname);
@@ -273,7 +298,9 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
CURLFORM_COPYCONTENTS, control->value,
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s=%s)", code, control->name, control->value);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s=%s)", code,
+ control->name, control->value);
}
}
@@ -321,7 +348,7 @@ fetch_curl_setup(struct fetch *parent_fetch,
fetch->fetch_handle = parent_fetch;
- LOG("fetch %p, url '%s'", fetch, nsurl_access(url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", fetch, nsurl_access(url));
/* construct a new fetch structure */
fetch->curl_handle = NULL;
@@ -543,10 +570,16 @@ fetch_curl_sslctxfun(CURL *curl_handle, void *_sslctx, void *parm)
/* Ensure server rejects the connection if downgraded too far */
SSL_CTX_set_mode(sslctx, SSL_MODE_SEND_FALLBACK_SCSV);
#endif
+ /* Disable TLS1.2 ciphersuites */
+ SSL_CTX_set_cipher_list(sslctx, CIPHER_LIST ":-TLSv1.2");
}
SSL_CTX_set_options(sslctx, options);
+#ifdef SSL_OP_NO_TICKET
+ SSL_CTX_clear_options(sslctx, SSL_OP_NO_TICKET);
+#endif
+
return CURLE_OK;
}
@@ -569,6 +602,11 @@ static CURLcode fetch_curl_set_options(struct curl_fetch_info *f)
return code; \
}
+#if LIBCURL_VERSION_NUM >= 0x072f00
+ /* Added in 7.47 */
+ /* Prefer HTTP/2 on encrypted connections */
+ SETOPT(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
+#endif
SETOPT(CURLOPT_URL, nsurl_access(f->url));
SETOPT(CURLOPT_PRIVATE, f);
SETOPT(CURLOPT_WRITEDATA, f);
@@ -634,8 +672,8 @@ static CURLcode fetch_curl_set_options(struct curl_fetch_info *f)
SETOPT(CURLOPT_PROXY, NULL);
}
- /* Disable SSL session ID caching, as some servers can't cope. */
- SETOPT(CURLOPT_SSL_SESSIONID_CACHE, 0);
+ /* Force-enable SSL session ID caching, as some distros are odd. */
+ SETOPT(CURLOPT_SSL_SESSIONID_CACHE, 1);
if (urldb_get_cert_permissions(f->url)) {
/* Disable certificate verification */
@@ -776,7 +814,7 @@ static void fetch_curl_abort(void *vf)
{
struct curl_fetch_info *f = (struct curl_fetch_info *)vf;
assert(f);
- LOG("fetch %p, url '%s'", f, nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", f, nsurl_access(f->url));
if (f->curl_handle) {
f->abort = true;
} else {
@@ -796,7 +834,7 @@ static void fetch_curl_stop(struct curl_fetch_info *f)
CURLMcode codem;
assert(f);
- LOG("fetch %p, url '%s'", f, nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", f, nsurl_access(f->url));
if (f->curl_handle) {
/* remove from curl multi handle */
@@ -864,7 +902,7 @@ static bool fetch_curl_process_headers(struct curl_fetch_info *f)
assert(code == CURLE_OK);
}
http_code = f->http_code;
- LOG("HTTP status code %li", http_code);
+ NSLOG(netsurf, INFO, "HTTP status code %li", http_code);
if (http_code == 304 && !f->post_urlenc && !f->post_multipart) {
/* Not Modified && GET request */
@@ -875,7 +913,7 @@ static bool fetch_curl_process_headers(struct curl_fetch_info *f)
/* handle HTTP redirects (3xx response codes) */
if (300 <= http_code && http_code < 400 && f->location != 0) {
- LOG("FETCH_REDIRECT, '%s'", f->location);
+ NSLOG(netsurf, INFO, "FETCH_REDIRECT, '%s'", f->location);
msg.type = FETCH_REDIRECT;
msg.data.redirect = f->location;
fetch_send_callback(&msg, f->fetch_handle);
@@ -1037,7 +1075,7 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result)
assert(code == CURLE_OK);
abort_fetch = f->abort;
- LOG("done %s", nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "done %s", nsurl_access(f->url));
if ((abort_fetch == false) &&
(result == CURLE_OK ||
@@ -1082,7 +1120,7 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result)
memset(f->cert_data, 0, sizeof(f->cert_data));
cert = true;
} else {
- LOG("Unknown cURL response code %d", result);
+ NSLOG(netsurf, INFO, "Unknown cURL response code %d", result);
error = true;
}
@@ -1146,7 +1184,8 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
&exc_fd_set, &max_fd);
assert(codem == CURLM_OK);
- LOG("Curl file descriptor states (maxfd=%i):", max_fd);
+ NSLOG(netsurf, INFO,
+ "Curl file descriptor states (maxfd=%i):", max_fd);
for (i = 0; i <= max_fd; i++) {
bool read = false;
bool write = false;
@@ -1162,10 +1201,10 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
error = true;
}
if (read || write || error) {
- LOG(" fd %i: %s %s %s", i,
- read ? "read" : " ",
- write ? "write" : " ",
- error ? "error" : " ");
+ NSLOG(netsurf, INFO, " fd %i: %s %s %s", i,
+ read ? "read" : " ",
+ write ? "write" : " ",
+ error ? "error" : " ");
}
}
}
@@ -1174,7 +1213,8 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
do {
codem = curl_multi_perform(fetch_curl_multi, &running);
if (codem != CURLM_OK && codem != CURLM_CALL_MULTI_PERFORM) {
- LOG("curl_multi_perform: %i %s", codem, curl_multi_strerror(codem));
+ NSLOG(netsurf, INFO, "curl_multi_perform: %i %s",
+ codem, curl_multi_strerror(codem));
guit->misc->warning("MiscError", curl_multi_strerror(codem));
return;
}
@@ -1336,7 +1376,7 @@ fetch_curl_header(char *data, size_t size, size_t nmemb, void *_f)
free(f->location);
f->location = malloc(size);
if (!f->location) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
return size;
}
SKIP_ST(9);
@@ -1427,17 +1467,17 @@ nserror fetch_curl_register(void)
.finalise = fetch_curl_finalise
};
- LOG("curl_version %s", curl_version());
+ NSLOG(netsurf, INFO, "curl_version %s", curl_version());
code = curl_global_init(CURL_GLOBAL_ALL);
if (code != CURLE_OK) {
- LOG("curl_global_init failed.");
+ NSLOG(netsurf, INFO, "curl_global_init failed.");
return NSERROR_INIT_FAILED;
}
fetch_curl_multi = curl_multi_init();
if (!fetch_curl_multi) {
- LOG("curl_multi_init failed.");
+ NSLOG(netsurf, INFO, "curl_multi_init failed.");
return NSERROR_INIT_FAILED;
}
@@ -1457,6 +1497,13 @@ nserror fetch_curl_register(void)
SETOPT(CURLMOPT_MAXCONNECTS, maxconnects);
SETOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, maxconnects);
SETOPT(CURLMOPT_MAX_HOST_CONNECTIONS, nsoption_int(max_fetchers_per_host));
+
+#if LIBCURL_VERSION_NUM >= 0x072b00
+ /* Added in 7.43.0 */
+ /* Use HTTP/2 multiplexing */
+ SETOPT(CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
+#endif
+
}
#endif
@@ -1465,7 +1512,7 @@ nserror fetch_curl_register(void)
*/
fetch_blank_curl = curl_easy_init();
if (!fetch_blank_curl) {
- LOG("curl_easy_init failed");
+ NSLOG(netsurf, INFO, "curl_easy_init failed");
return NSERROR_INIT_FAILED;
}
@@ -1494,14 +1541,16 @@ nserror fetch_curl_register(void)
SETOPT(CURLOPT_LOW_SPEED_TIME, 180L);
SETOPT(CURLOPT_NOSIGNAL, 1L);
SETOPT(CURLOPT_CONNECTTIMEOUT, nsoption_uint(curl_fetch_timeout));
+ SETOPT(CURLOPT_SSL_CIPHER_LIST, CIPHER_LIST);
if (nsoption_charp(ca_bundle) &&
strcmp(nsoption_charp(ca_bundle), "")) {
- LOG("ca_bundle: '%s'", nsoption_charp(ca_bundle));
+ NSLOG(netsurf, INFO, "ca_bundle: '%s'",
+ nsoption_charp(ca_bundle));
SETOPT(CURLOPT_CAINFO, nsoption_charp(ca_bundle));
}
if (nsoption_charp(ca_path) && strcmp(nsoption_charp(ca_path), "")) {
- LOG("ca_path: '%s'", nsoption_charp(ca_path));
+ NSLOG(netsurf, INFO, "ca_path: '%s'", nsoption_charp(ca_path));
SETOPT(CURLOPT_CAPATH, nsoption_charp(ca_path));
}
@@ -1513,7 +1562,8 @@ nserror fetch_curl_register(void)
curl_with_openssl = false;
}
- LOG("cURL %slinked against openssl", curl_with_openssl ? "" : "not ");
+ NSLOG(netsurf, INFO, "cURL %slinked against openssl",
+ curl_with_openssl ? "" : "not ");
/* cURL initialised okay, register the fetchers */
@@ -1532,19 +1582,21 @@ nserror fetch_curl_register(void)
}
if (fetcher_add(scheme, &fetcher_ops) != NSERROR_OK) {
- LOG("Unable to register cURL fetcher for %s", data->protocols[i]);
+ NSLOG(netsurf, INFO,
+ "Unable to register cURL fetcher for %s",
+ data->protocols[i]);
}
}
return NSERROR_OK;
curl_easy_setopt_failed:
- LOG("curl_easy_setopt failed.");
+ NSLOG(netsurf, INFO, "curl_easy_setopt failed.");
return NSERROR_INIT_FAILED;
#if LIBCURL_VERSION_NUM >= 0x071e00
curl_multi_setopt_failed:
- LOG("curl_multi_setopt failed.");
+ NSLOG(netsurf, INFO, "curl_multi_setopt failed.");
return NSERROR_INIT_FAILED;
#endif
}
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index cb99e6ff2..5ba021fd3 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -57,14 +57,16 @@ static struct fetch_data_context *ring = NULL;
static bool fetch_data_initialise(lwc_string *scheme)
{
- LOG("fetch_data_initialise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_data_initialise called for %s",
+ lwc_string_data(scheme));
return true;
}
static void fetch_data_finalise(lwc_string *scheme)
{
- LOG("fetch_data_finalise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_data_finalise called for %s",
+ lwc_string_data(scheme));
}
static bool fetch_data_can_fetch(const nsurl *url)
@@ -147,7 +149,7 @@ static bool fetch_data_process(struct fetch_data_context *c)
* data must still be there.
*/
- LOG("url: %.140s", c->url);
+ NSLOG(netsurf, INFO, "url: %.140s", c->url);
if (strlen(c->url) < 6) {
/* 6 is the minimum possible length (data:,) */
@@ -259,8 +261,10 @@ static void fetch_data_poll(lwc_string *scheme)
char header[64];
fetch_set_http_code(c->parent_fetch, 200);
- LOG("setting data: MIME type to %s, length to %" PRIsizet,
- c->mimetype, c->datalen);
+ NSLOG(netsurf, INFO,
+ "setting data: MIME type to %s, length to %"PRIsizet,
+ c->mimetype,
+ c->datalen);
/* Any callback can result in the fetch being aborted.
* Therefore, we _must_ check for this after _every_
* call to fetch_data_send_callback().
@@ -296,7 +300,8 @@ static void fetch_data_poll(lwc_string *scheme)
fetch_data_send_callback(&msg, c);
}
} else {
- LOG("Processing of %s failed!", c->url);
+ NSLOG(netsurf, INFO, "Processing of %s failed!",
+ c->url);
/* Ensure that we're unlocked here. If we aren't,
* then fetch_data_process() is broken.
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index b8b4b191f..78757733e 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -276,14 +276,16 @@ static bool fetch_resource_initialise(lwc_string *scheme)
&e->data,
&e->data_len);
if (res == NSERROR_OK) {
- LOG("direct data for %s", fetch_resource_paths[i]);
+ NSLOG(netsurf, INFO, "direct data for %s",
+ fetch_resource_paths[i]);
fetch_resource_path_count++;
} else {
e->redirect_url = guit->fetch->get_resource_url(fetch_resource_paths[i]);
if (e->redirect_url == NULL) {
lwc_string_unref(e->path);
} else {
- LOG("redirect url for %s", fetch_resource_paths[i]);
+ NSLOG(netsurf, INFO, "redirect url for %s",
+ fetch_resource_paths[i]);
fetch_resource_path_count++;
}
}
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index bcb97d2b6..19eb1ca7b 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -519,11 +519,12 @@ invalidate_entry(struct store_state *state, struct store_entry *bse)
* This entry cannot be immediately removed as it has
* associated allocation so wait for allocation release.
*/
- LOG("invalidating entry with referenced allocation");
+ NSLOG(netsurf, INFO,
+ "invalidating entry with referenced allocation");
return NSERROR_OK;
}
- LOG("Removing entry for %p", bse);
+ NSLOG(netsurf, INFO, "Removing entry for %p", bse);
/* remove the entry from the index */
ret = remove_store_entry(state, &bse);
@@ -533,12 +534,12 @@ invalidate_entry(struct store_state *state, struct store_entry *bse)
ret = invalidate_element(state, bse, ENTRY_ELEM_META);
if (ret != NSERROR_OK) {
- LOG("Error invalidating metadata element");
+ NSLOG(netsurf, INFO, "Error invalidating metadata element");
}
ret = invalidate_element(state, bse, ENTRY_ELEM_DATA);
if (ret != NSERROR_OK) {
- LOG("Error invalidating data element");
+ NSLOG(netsurf, INFO, "Error invalidating data element");
}
return NSERROR_OK;
@@ -620,8 +621,10 @@ static nserror store_evict(struct store_state *state)
return NSERROR_OK;
}
- LOG("Evicting entries to reduce %"PRIu64" by %"PRIsizet,
- state->total_alloc, state->hysteresis);
+ NSLOG(netsurf, INFO,
+ "Evicting entries to reduce %"PRIu64" by %"PRIsizet,
+ state->total_alloc,
+ state->hysteresis);
/* allocate storage for the list */
elist = malloc(sizeof(entry_ident_t) * state->last_entry);
@@ -658,7 +661,8 @@ static nserror store_evict(struct store_state *state)
free(elist);
- LOG("removed %"PRIsizet" in %d entries", removed, ent);
+ NSLOG(netsurf, INFO, "removed %"PRIsizet" in %d entries", removed,
+ ent);
return ret;
}
@@ -773,7 +777,10 @@ static nserror write_blocks(struct store_state *state)
&state->blocks[elem_idx][bfidx].use_map[0],
BLOCK_USE_MAP_SIZE);
if (wr != BLOCK_USE_MAP_SIZE) {
- LOG("writing block file %d use index on file number %d failed", elem_idx, bfidx);
+ NSLOG(netsurf, INFO,
+ "writing block file %d use index on file number %d failed",
+ elem_idx,
+ bfidx);
goto wr_err;
}
written += wr;
@@ -829,19 +836,21 @@ static nserror set_block_extents(struct store_state *state)
return NSERROR_OK;
}
- LOG("Starting");
+ NSLOG(netsurf, INFO, "Starting");
for (elem_idx = 0; elem_idx < ENTRY_ELEM_COUNT; elem_idx++) {
for (bfidx = 0; bfidx < BLOCK_FILE_COUNT; bfidx++) {
if (state->blocks[elem_idx][bfidx].fd != -1) {
/* ensure block file is correct extent */
ftr = ftruncate(state->blocks[elem_idx][bfidx].fd, 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
if (ftr == -1) {
- LOG("Truncate failed errno:%d", errno);
+ NSLOG(netsurf, INFO,
+ "Truncate failed errno:%d",
+ errno);
}
}
}
}
- LOG("Complete");
+ NSLOG(netsurf, INFO, "Complete");
state->blocks_opened = false;
@@ -886,7 +895,7 @@ get_store_entry(struct store_state *state, nsurl *url, struct store_entry **bse)
entry_ident_t ident;
unsigned int sei; /* store entry index */
- LOG("url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "url:%s", nsurl_access(url));
/* use the url hash as the entry identifier */
ident = nsurl_hash(url);
@@ -894,13 +903,14 @@ get_store_entry(struct store_state *state, nsurl *url, struct store_entry **bse)
sei = BS_ENTRY_INDEX(ident, state);
if (sei == 0) {
- LOG("Failed to find ident 0x%x in index", ident);
+ NSLOG(netsurf, INFO, "Failed to find ident 0x%x in index",
+ ident);
return NSERROR_NOT_FOUND;
}
if (state->entries[sei].ident != ident) {
/* entry ident did not match */
- LOG("ident did not match entry");
+ NSLOG(netsurf, INFO, "ident did not match entry");
return NSERROR_NOT_FOUND;
}
@@ -975,7 +985,7 @@ set_store_entry(struct store_state *state,
nserror ret;
struct store_entry_element *elem;
- LOG("url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "url:%s", nsurl_access(url));
/* evict entries as required and ensure there is at least one
* new entry available.
@@ -1013,7 +1023,10 @@ set_store_entry(struct store_state *state,
* to see if the old entry is in use and if
* not prefer the newly stored entry instead?
*/
- LOG("Entry index collision trying to replace %x with %x", se->ident, ident);
+ NSLOG(netsurf, INFO,
+ "Entry index collision trying to replace %x with %x",
+ se->ident,
+ ident);
return NSERROR_PERMISSION;
}
}
@@ -1026,7 +1039,8 @@ set_store_entry(struct store_state *state,
/* this entry cannot be removed as it has associated
* allocation.
*/
- LOG("attempt to overwrite entry with in use data");
+ NSLOG(netsurf, INFO,
+ "attempt to overwrite entry with in use data");
return NSERROR_PERMISSION;
}
@@ -1085,7 +1099,7 @@ store_open(struct store_state *state,
fname = store_fname(state, ident, elem_idx);
if (fname == NULL) {
- LOG("filename error");
+ NSLOG(netsurf, INFO, "filename error");
return -1;
}
@@ -1093,13 +1107,14 @@ store_open(struct store_state *state,
if (openflags & O_CREAT) {
ret = netsurf_mkdir_all(fname);
if (ret != NSERROR_OK) {
- LOG("file path \"%s\" could not be created", fname);
+ NSLOG(netsurf, INFO,
+ "file path \"%s\" could not be created", fname);
free(fname);
return -1;
}
}
- LOG("opening %s", fname);
+ NSLOG(netsurf, INFO, "opening %s", fname);
fd = open(fname, openflags, S_IRUSR | S_IWUSR);
free(fname);
@@ -1126,9 +1141,9 @@ build_entrymap(struct store_state *state)
{
unsigned int eloop;
- LOG("Allocating %ld bytes for max of %d buckets",
- (1 << state->ident_bits) * sizeof(entry_index_t),
- 1 << state->ident_bits);
+ NSLOG(netsurf, INFO, "Allocating %"PRIsizet" bytes for max of %d buckets",
+ (1 << state->ident_bits) * sizeof(entry_index_t),
+ 1 << state->ident_bits);
state->addrmap = calloc(1 << state->ident_bits, sizeof(entry_index_t));
if (state->addrmap == NULL) {
@@ -1138,12 +1153,12 @@ build_entrymap(struct store_state *state)
state->total_alloc = 0;
for (eloop = 1; eloop < state->last_entry; eloop++) {
- /*
- LOG("entry:%d ident:0x%08x used:%d",
- eloop,
- BS_ADDRESS(state->entries[eloop].ident, state),
- state->entries[eloop].use_count);
- */
+
+ NSLOG(llcache, DEEPDEBUG,
+ "entry:%d ident:0x%08x used:%d",
+ eloop,
+ BS_ADDRESS(state->entries[eloop].ident, state),
+ state->entries[eloop].use_count);
/* update the address map to point at the entry */
BS_ENTRY_INDEX(state->entries[eloop].ident, state) = eloop;
@@ -1204,10 +1219,12 @@ read_entries(struct store_state *state)
entries_size = (1 << state->entry_bits) * sizeof(struct store_entry);
- LOG("Allocating %"PRIsizet" bytes for max of %d entries of %ld length elements %ld length",
- entries_size, 1 << state->entry_bits,
- sizeof(struct store_entry),
- sizeof(struct store_entry_element));
+ NSLOG(netsurf, INFO,
+ "Allocating %"PRIsizet" bytes for max of %d entries of %"PRIsizet" length elements %"PRIsizet" length",
+ entries_size,
+ 1 << state->entry_bits,
+ sizeof(struct store_entry),
+ sizeof(struct store_entry_element));
state->entries = calloc(1, entries_size);
if (state->entries == NULL) {
@@ -1222,7 +1239,8 @@ read_entries(struct store_state *state)
close(fd);
if (rd > 0) {
state->last_entry = rd / sizeof(struct store_entry);
- LOG("Read %d entries", state->last_entry);
+ NSLOG(netsurf, INFO, "Read %d entries",
+ state->last_entry);
}
} else {
/* could rebuild entries from fs */
@@ -1253,7 +1271,7 @@ read_blocks(struct store_state *state)
return ret;
}
- LOG("Initialising block use map from %s", fname);
+ NSLOG(netsurf, INFO, "Initialising block use map from %s", fname);
fd = open(fname, O_RDWR);
free(fname);
@@ -1265,7 +1283,10 @@ read_blocks(struct store_state *state)
&state->blocks[elem_idx][bfidx].use_map[0],
BLOCK_USE_MAP_SIZE);
if (rd <= 0) {
- LOG("reading block file %d use index on file number %d failed", elem_idx, bfidx);
+ NSLOG(netsurf, INFO,
+ "reading block file %d use index on file number %d failed",
+ elem_idx,
+ bfidx);
goto rd_err;
}
}
@@ -1274,7 +1295,7 @@ read_blocks(struct store_state *state)
close(fd);
} else {
- LOG("Initialising block use map to defaults");
+ NSLOG(netsurf, INFO, "Initialising block use map to defaults");
/* ensure block 0 (invalid sentinel) is skipped */
state->blocks[ENTRY_ELEM_DATA][0].use_map[0] = 1;
state->blocks[ENTRY_ELEM_META][0].use_map[0] = 1;
@@ -1344,7 +1365,7 @@ write_control(struct store_state *state)
return ret;
}
- LOG("writing control file \"%s\"", fname);
+ NSLOG(netsurf, INFO, "writing control file \"%s\"", fname);
ret = netsurf_mkdir_all(fname);
if (ret != NSERROR_OK) {
@@ -1392,7 +1413,7 @@ read_control(struct store_state *state)
return ret;
}
- LOG("opening control file \"%s\"", fname);
+ NSLOG(netsurf, INFO, "opening control file \"%s\"", fname);
fcontrol = fopen(fname, "rb");
@@ -1509,7 +1530,8 @@ initialise(const struct llcache_store_parameters *parameters)
/* read store control and create new if required */
ret = read_control(newstate);
if (ret != NSERROR_OK) {
- LOG("read control failed %s", messages_get_errorcode(ret));
+ NSLOG(netsurf, INFO, "read control failed %s",
+ messages_get_errorcode(ret));
ret = write_control(newstate);
if (ret == NSERROR_OK) {
unlink_entries(newstate);
@@ -1543,6 +1565,7 @@ initialise(const struct llcache_store_parameters *parameters)
ret = build_entrymap(newstate);
if (ret != NSERROR_OK) {
/* that obviously went well */
+ free(newstate->entries);
free(newstate->path);
free(newstate);
return ret;
@@ -1551,6 +1574,8 @@ initialise(const struct llcache_store_parameters *parameters)
ret = read_blocks(newstate);
if (ret != NSERROR_OK) {
/* oh dear */
+ free(newstate->addrmap);
+ free(newstate->entries);
free(newstate->path);
free(newstate);
return ret;
@@ -1558,15 +1583,17 @@ initialise(const struct llcache_store_parameters *parameters)
storestate = newstate;
- LOG("FS backing store init successful");
+ NSLOG(netsurf, INFO, "FS backing store init successful");
- LOG("path:%s limit:%"PRIsizet" hyst:%"PRIsizet" addr:%d entries:%d",
- newstate->path,
- newstate->limit,
- newstate->hysteresis,
- newstate->ident_bits,
- newstate->entry_bits);
- LOG("Using %"PRIu64"/%"PRIsizet, newstate->total_alloc, newstate->limit);
+ NSLOG(netsurf, INFO,
+ "path:%s limit:%"PRIsizet" hyst:%"PRIsizet" addr:%d entries:%d",
+ newstate->path,
+ newstate->limit,
+ newstate->hysteresis,
+ newstate->ident_bits,
+ newstate->entry_bits);
+ NSLOG(netsurf, INFO, "Using %"PRIu64"/%"PRIsizet,
+ newstate->total_alloc, newstate->limit);
return NSERROR_OK;
}
@@ -1605,16 +1632,19 @@ finalise(void)
/* avoid division by zero */
if (op_count > 0) {
- LOG("Cache total/hit/miss/fail (counts) %d/%"PRIsizet"/%"PRIsizet"/%d (100%%/%"PRIsizet"%%/%"PRIsizet"%%/%d%%)",
- op_count,
- storestate->hit_count,
- storestate->miss_count,
- 0,
- (storestate->hit_count * 100) / op_count,
- (storestate->miss_count * 100) / op_count,
- 0);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (counts) %d/%"PRIsizet"/%"PRIsizet"/%d (100%%/%"PRIsizet"%%/%"PRIsizet"%%/%d%%)",
+ op_count,
+ storestate->hit_count,
+ storestate->miss_count,
+ 0,
+ (storestate->hit_count * 100) / op_count,
+ (storestate->miss_count * 100) / op_count,
+ 0);
}
+ free(storestate->addrmap);
+ free(storestate->entries);
free(storestate->path);
free(storestate);
storestate = NULL;
@@ -1646,7 +1676,7 @@ static nserror store_write_block(struct store_state *state,
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
if (state->blocks[elem_idx][bf].fd == -1) {
- LOG("Open failed errno %d", errno);
+ NSLOG(netsurf, INFO, "Open failed errno %d", errno);
return NSERROR_SAVE_FAILED;
}
@@ -1654,28 +1684,28 @@ static nserror store_write_block(struct store_state *state,
state->blocks_opened = true;
}
- offst = bi << log2_block_size[elem_idx];
+ offst = (unsigned int)bi << log2_block_size[elem_idx];
wr = nsu_pwrite(state->blocks[elem_idx][bf].fd,
bse->elem[elem_idx].data,
bse->elem[elem_idx].size,
offst);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Write failed %"PRIssizet" of %d bytes from %p at 0x%jx block %d errno %d",
- wr,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block,
- errno);
+ NSLOG(netsurf, INFO,
+ "Write failed %"PRIssizet" of %d bytes from %p at 0x%jx block %d errno %d",
+ wr,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ (uintmax_t)offst,
+ bse->elem[elem_idx].block,
+ errno);
return NSERROR_SAVE_FAILED;
}
- LOG("Wrote %"PRIssizet" bytes from %p at 0x%jx block %d",
- wr,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block);
+ NSLOG(netsurf, INFO,
+ "Wrote %"PRIssizet" bytes from %p at 0x%jx block %d", wr,
+ bse->elem[elem_idx].data, (uintmax_t)offst,
+ bse->elem[elem_idx].block);
return NSERROR_OK;
}
@@ -1699,7 +1729,7 @@ static nserror store_write_file(struct store_state *state,
fd = store_open(state, bse->ident, elem_idx, O_CREAT | O_WRONLY);
if (fd < 0) {
perror("");
- LOG("Open failed %d errno %d", fd, errno);
+ NSLOG(netsurf, INFO, "Open failed %d errno %d", fd, errno);
return NSERROR_SAVE_FAILED;
}
@@ -1708,17 +1738,19 @@ static nserror store_write_file(struct store_state *state,
close(fd);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Write failed %"PRIssizet" of %d bytes from %p errno %d",
- wr,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- err);
+ NSLOG(netsurf, INFO,
+ "Write failed %"PRIssizet" of %d bytes from %p errno %d",
+ wr,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ err);
/** @todo Delete the file? */
return NSERROR_SAVE_FAILED;
}
- LOG("Wrote %"PRIssizet" bytes from %p", wr, bse->elem[elem_idx].data);
+ NSLOG(netsurf, INFO, "Wrote %"PRIssizet" bytes from %p", wr,
+ bse->elem[elem_idx].data);
return NSERROR_OK;
}
@@ -1759,7 +1791,7 @@ store(nsurl *url,
/* set the store entry up */
ret = set_store_entry(storestate, url, elem_idx, data, datalen, &bse);
if (ret != NSERROR_OK) {
- LOG("store entry setting failed");
+ NSLOG(netsurf, INFO, "store entry setting failed");
return ret;
}
@@ -1782,7 +1814,7 @@ static nserror entry_release_alloc(struct store_entry_element *elem)
if ((elem->flags & ENTRY_ELEM_FLAG_HEAP) != 0) {
elem->ref--;
if (elem->ref == 0) {
- LOG("freeing %p", elem->data);
+ NSLOG(netsurf, INFO, "freeing %p", elem->data);
free(elem->data);
elem->flags &= ~ENTRY_ELEM_FLAG_HEAP;
}
@@ -1814,7 +1846,7 @@ static nserror store_read_block(struct store_state *state,
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
if (state->blocks[elem_idx][bf].fd == -1) {
- LOG("Open failed errno %d", errno);
+ NSLOG(netsurf, INFO, "Open failed errno %d", errno);
return NSERROR_SAVE_FAILED;
}
@@ -1822,28 +1854,28 @@ static nserror store_read_block(struct store_state *state,
state->blocks_opened = true;
}
- offst = bi << log2_block_size[elem_idx];
+ offst = (unsigned int)bi << log2_block_size[elem_idx];
rd = nsu_pread(state->blocks[elem_idx][bf].fd,
bse->elem[elem_idx].data,
bse->elem[elem_idx].size,
offst);
if (rd != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Failed reading %"PRIssizet" of %d bytes into %p from 0x%jx block %d errno %d",
- rd,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block,
- errno);
+ NSLOG(netsurf, INFO,
+ "Failed reading %"PRIssizet" of %d bytes into %p from 0x%jx block %d errno %d",
+ rd,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ (uintmax_t)offst,
+ bse->elem[elem_idx].block,
+ errno);
return NSERROR_SAVE_FAILED;
}
- LOG("Read %"PRIssizet" bytes into %p from 0x%jx block %d",
- rd,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block);
+ NSLOG(netsurf, INFO,
+ "Read %"PRIssizet" bytes into %p from 0x%jx block %d", rd,
+ bse->elem[elem_idx].data, (uintmax_t)offst,
+ bse->elem[elem_idx].block);
return NSERROR_OK;
}
@@ -1868,7 +1900,7 @@ static nserror store_read_file(struct store_state *state,
/* separate file in backing store */
fd = store_open(storestate, bse->ident, elem_idx, O_RDONLY);
if (fd < 0) {
- LOG("Open failed %d errno %d", fd, errno);
+ NSLOG(netsurf, INFO, "Open failed %d errno %d", fd, errno);
/** @todo should this invalidate the entry? */
return NSERROR_NOT_FOUND;
}
@@ -1878,8 +1910,10 @@ static nserror store_read_file(struct store_state *state,
bse->elem[elem_idx].data + tot,
bse->elem[elem_idx].size - tot);
if (rd <= 0) {
- LOG("read error returned %"PRIssizet" errno %d",
- rd, errno);
+ NSLOG(netsurf, INFO,
+ "read error returned %"PRIssizet" errno %d",
+ rd,
+ errno);
ret = NSERROR_NOT_FOUND;
break;
}
@@ -1888,7 +1922,8 @@ static nserror store_read_file(struct store_state *state,
close(fd);
- LOG("Read %"PRIsizet" bytes into %p", tot, bse->elem[elem_idx].data);
+ NSLOG(netsurf, INFO, "Read %"PRIsizet" bytes into %p", tot,
+ bse->elem[elem_idx].data);
return ret;
}
@@ -1921,13 +1956,14 @@ fetch(nsurl *url,
/* fetch store entry */
ret = get_store_entry(storestate, url, &bse);
if (ret != NSERROR_OK) {
- LOG("entry not found");
+ NSLOG(netsurf, INFO, "entry not found");
storestate->miss_count++;
return ret;
}
storestate->hit_count++;
- LOG("retrieving cache data for url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "retrieving cache data for url:%s",
+ nsurl_access(url));
/* calculate the entry element index */
if ((bsflags & BACKING_STORE_META) != 0) {
@@ -1942,16 +1978,20 @@ fetch(nsurl *url,
/* use the existing allocation and bump the ref count. */
elem->ref++;
- LOG("Using existing entry (%p) allocation %p refs:%d", bse, elem->data, elem->ref);
+ NSLOG(netsurf, INFO,
+ "Using existing entry (%p) allocation %p refs:%d", bse,
+ elem->data, elem->ref);
} else {
/* allocate from the heap */
elem->data = malloc(elem->size);
if (elem->data == NULL) {
- LOG("Failed to create new heap allocation");
+ NSLOG(netsurf, INFO,
+ "Failed to create new heap allocation");
return NSERROR_NOMEM;
}
- LOG("Created new heap allocation %p", elem->data);
+ NSLOG(netsurf, INFO, "Created new heap allocation %p",
+ elem->data);
/* mark the entry as having a valid heap allocation */
elem->flags |= ENTRY_ELEM_FLAG_HEAP;
@@ -2000,7 +2040,7 @@ static nserror release(nsurl *url, enum backing_store_flags bsflags)
ret = get_store_entry(storestate, url, &bse);
if (ret != NSERROR_OK) {
- LOG("entry not found");
+ NSLOG(netsurf, INFO, "entry not found");
return ret;
}
diff --git a/content/handlers/Makefile b/content/handlers/Makefile
index 2f2da3aed..ea9d0c84d 100644
--- a/content/handlers/Makefile
+++ b/content/handlers/Makefile
@@ -13,4 +13,15 @@ include content/handlers/javascript/Makefile
S_CONTENT += $(addprefix handlers/javascript/,$(S_JAVASCRIPT))
+# HTML content handler sources
+include content/handlers/html/Makefile
+
+S_CONTENT += $(addprefix handlers/html/,$(S_HTML))
+
+# Text content handler sources
+include content/handlers/text/Makefile
+
+S_CONTENT += $(addprefix handlers/text/,$(S_TEXT))
+
+# extend the include search path
INCLUDE_DIRS += content/handlers
diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c
index 997eb5115..93efd6a1b 100644
--- a/content/handlers/css/css.c
+++ b/content/handlers/css/css.c
@@ -136,7 +136,6 @@ nscss_create(const content_handler *handler,
const char *charset = NULL;
const char *xnsbase = NULL;
lwc_string *charset_value = NULL;
- union content_msg_data msg_data;
nserror error;
result = calloc(1, sizeof(nscss_content));
@@ -171,8 +170,7 @@ nscss_create(const content_handler *handler,
xnsbase, charset, result->base.quirks,
nscss_content_done, result);
if (error != NSERROR_OK) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&result->base, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(&result->base, NSERROR_NOMEM);
if (charset_value != NULL)
lwc_string_unref(charset_value);
free(result);
@@ -250,13 +248,11 @@ static nserror nscss_create_css_data(struct content_css_data *c,
bool nscss_process_data(struct content *c, const char *data, unsigned int size)
{
nscss_content *css = (nscss_content *) c;
- union content_msg_data msg_data;
css_error error;
error = nscss_process_css_data(&css->data, data, size);
if (error != CSS_OK && error != CSS_NEEDDATA) {
- msg_data.error = "?";
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(c, NSERROR_CSS);
}
return (error == CSS_OK || error == CSS_NEEDDATA);
@@ -286,13 +282,11 @@ static css_error nscss_process_css_data(struct content_css_data *c,
bool nscss_convert(struct content *c)
{
nscss_content *css = (nscss_content *) c;
- union content_msg_data msg_data;
css_error error;
error = nscss_convert_css_data(&css->data);
if (error != CSS_OK) {
- msg_data.error = "?";
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(c, NSERROR_CSS);
return false;
}
@@ -327,9 +321,11 @@ static css_error nscss_convert_css_data(struct content_css_data *c)
const char *url;
if (css_stylesheet_get_url(c->sheet, &url) == CSS_OK) {
- LOG("Failed converting %p %s (%d)", c, url, error);
+ NSLOG(netsurf, INFO, "Failed converting %p %s (%d)",
+ c, url, error);
} else {
- LOG("Failed converting %p (%d)", c, error);
+ NSLOG(netsurf, INFO, "Failed converting %p (%d)", c,
+ error);
}
}
@@ -475,7 +471,6 @@ content_type nscss_content_type(void)
*/
void nscss_content_done(struct content_css_data *css, void *pw)
{
- union content_msg_data msg_data;
struct content *c = pw;
uint32_t i;
size_t size;
@@ -484,8 +479,7 @@ void nscss_content_done(struct content_css_data *css, void *pw)
/* Retrieve the size of this sheet */
error = css_stylesheet_size(css->sheet, &size);
if (error != CSS_OK) {
- msg_data.error = "?";
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(c, NSERROR_CSS);
content_set_error(c);
return;
}
@@ -606,7 +600,9 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent,
nsurl_unref(ns_ref);
#ifdef NSCSS_IMPORT_TRACE
- LOG("Import %d '%s' -> (handle: %p ctx: %p)", c->import_count, lwc_string_data(url), c->imports[c->import_count].c, ctx);
+ NSLOG(netsurf, INFO, "Import %d '%s' -> (handle: %p ctx: %p)",
+ c->import_count, lwc_string_data(url),
+ c->imports[c->import_count].c, ctx);
#endif
c->import_count++;
@@ -629,7 +625,7 @@ nserror nscss_import(hlcache_handle *handle,
css_error error = CSS_OK;
#ifdef NSCSS_IMPORT_TRACE
- LOG("Event %d for %p (%p)", event->type, handle, ctx);
+ NSLOG(netsurf, INFO, "Event %d for %p (%p)", event->type, handle, ctx);
#endif
assert(ctx->css->imports[ctx->index].c == handle);
@@ -639,6 +635,7 @@ nserror nscss_import(hlcache_handle *handle,
error = nscss_import_complete(ctx);
break;
+ case CONTENT_MSG_ERRORCODE:
case CONTENT_MSG_ERROR:
hlcache_handle_release(handle);
ctx->css->imports[ctx->index].c = NULL;
@@ -670,7 +667,8 @@ css_error nscss_import_complete(nscss_import_ctx *ctx)
error = nscss_register_imports(ctx->css);
#ifdef NSCSS_IMPORT_TRACE
- LOG("Destroying import context %p for %d", ctx, ctx->index);
+ NSLOG(netsurf, INFO, "Destroying import context %p for %d", ctx,
+ ctx->index);
#endif
/* No longer need import context */
diff --git a/content/handlers/css/dump.c b/content/handlers/css/dump.c
index 1ad188cb8..b12e1d9e8 100644
--- a/content/handlers/css/dump.c
+++ b/content/handlers/css/dump.c
@@ -20,6 +20,7 @@
#include <libcss/libcss.h>
#include "css/dump.h"
+#include "css/utils.h"
/**
* Dump a fixed point value to the stream in a textual form.
@@ -112,6 +113,45 @@ static void dump_css_unit(FILE *stream, css_fixed val, css_unit unit)
case CSS_UNIT_KHZ:
fprintf(stream, "kHz");
break;
+ case CSS_UNIT_CAP:
+ fprintf(stream, "cap");
+ break;
+ case CSS_UNIT_CH:
+ fprintf(stream, "ch");
+ break;
+ case CSS_UNIT_IC:
+ fprintf(stream, "ic");
+ break;
+ case CSS_UNIT_REM:
+ fprintf(stream, "rem");
+ break;
+ case CSS_UNIT_LH:
+ fprintf(stream, "lh");
+ break;
+ case CSS_UNIT_RLH:
+ fprintf(stream, "rlh");
+ break;
+ case CSS_UNIT_VH:
+ fprintf(stream, "vh");
+ break;
+ case CSS_UNIT_VW:
+ fprintf(stream, "vw");
+ break;
+ case CSS_UNIT_VI:
+ fprintf(stream, "vi");
+ break;
+ case CSS_UNIT_VB:
+ fprintf(stream, "vb");
+ break;
+ case CSS_UNIT_VMIN:
+ fprintf(stream, "vmin");
+ break;
+ case CSS_UNIT_VMAX:
+ fprintf(stream, "vmax");
+ break;
+ case CSS_UNIT_Q:
+ fprintf(stream, "q");
+ break;
}
}
@@ -783,7 +823,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
}
/* display */
- val = css_computed_display_static(style);
+ val = ns_computed_display_static(style);
switch (val) {
case CSS_DISPLAY_INLINE:
fprintf(stream, "display: inline ");
@@ -1268,7 +1308,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
}
/* min-height */
- val = css_computed_min_height(style, &len1, &unit1);
+ val = ns_computed_min_height(style, &len1, &unit1);
switch (val) {
case CSS_MIN_HEIGHT_SET:
fprintf(stream, "min-height: ");
@@ -1282,7 +1322,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
}
/* min-width */
- val = css_computed_min_width(style, &len1, &unit1);
+ val = ns_computed_min_width(style, &len1, &unit1);
switch (val) {
case CSS_MIN_WIDTH_SET:
fprintf(stream, "min-width: ");
diff --git a/content/handlers/css/hints.c b/content/handlers/css/hints.c
index a96212386..3a15f8e08 100644
--- a/content/handlers/css/hints.c
+++ b/content/handlers/css/hints.c
@@ -748,6 +748,8 @@ static void css_hint_vertical_align_table_cells(
corestring_dom_valign, &attr);
if (err == DOM_NO_ERR && attr != NULL) {
+ hint->data.length.value = 0;
+ hint->data.length.unit = CSS_UNIT_PX;
if (dom_string_caseless_lwc_isequal(attr,
corestring_lwc_top)) {
hint->prop = CSS_PROP_VERTICAL_ALIGN;
@@ -882,6 +884,7 @@ static void css_hint_margin_left_right_align_center(
corestring_dom_align, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
+ memset(hint, 0, sizeof(*hint) * 2);
if (dom_string_caseless_lwc_isequal(attr,
corestring_lwc_center) ||
dom_string_caseless_lwc_isequal(attr,
@@ -1022,6 +1025,7 @@ static void css_hint_margin_left_right_hr(
corestring_dom_align, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
+ memset(hint, 0, sizeof(*hint) * 2);
if (dom_string_caseless_lwc_isequal(attr,
corestring_lwc_left)) {
hint->prop = CSS_PROP_MARGIN_LEFT;
@@ -1584,6 +1588,7 @@ css_error node_presentational_hint(void *pw, void *node,
css_hint_width(pw, node);
break;
case DOM_HTML_ELEMENT_TYPE_HR:
+ css_hint_width(pw, node);
css_hint_margin_left_right_hr(pw, node);
break;
case DOM_HTML_ELEMENT_TYPE_TEXTAREA:
@@ -1612,7 +1617,7 @@ css_error node_presentational_hint(void *pw, void *node,
}
#ifdef LOG_STATS
- LOG("Properties with hints: %i", hint_ctx.len);
+ NSLOG(netsurf, INFO, "Properties with hints: %i", hint_ctx.len);
#endif
css_hint_get_hints(hints, nhints);
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index daa3b4087..ee79eb394 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -175,20 +175,20 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
error = css_stylesheet_create(&params, &sheet);
if (error != CSS_OK) {
- LOG("Failed creating sheet: %d", error);
+ NSLOG(netsurf, INFO, "Failed creating sheet: %d", error);
return NULL;
}
error = css_stylesheet_append_data(sheet, data, len);
if (error != CSS_OK && error != CSS_NEEDDATA) {
- LOG("failed appending data: %d", error);
+ NSLOG(netsurf, INFO, "failed appending data: %d", error);
css_stylesheet_destroy(sheet);
return NULL;
}
error = css_stylesheet_data_done(sheet);
if (error != CSS_OK) {
- LOG("failed completing parse: %d", error);
+ NSLOG(netsurf, INFO, "failed completing parse: %d", error);
css_stylesheet_destroy(sheet);
return NULL;
}
@@ -214,7 +214,8 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_CLONED,
NULL, src, dst, data);
if (error != CSS_OK)
- LOG("Failed to clone libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to clone libcss_node_data.");
break;
case DOM_NODE_RENAMED:
@@ -222,7 +223,8 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_MODIFIED,
NULL, src, NULL, data);
if (error != CSS_OK)
- LOG("Failed to update libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to update libcss_node_data.");
break;
case DOM_NODE_IMPORTED:
@@ -232,11 +234,12 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_DELETED,
NULL, src, NULL, data);
if (error != CSS_OK)
- LOG("Failed to delete libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to delete libcss_node_data.");
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -275,7 +278,7 @@ css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
* element's style */
error = css_computed_style_compose(ctx->parent_style,
styles->styles[CSS_PSEUDO_ELEMENT_NONE],
- nscss_compute_font_size, NULL,
+ nscss_compute_font_size, ctx,
&composed);
if (error != CSS_OK) {
css_select_results_destroy(styles);
@@ -307,7 +310,7 @@ css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
error = css_computed_style_compose(
styles->styles[CSS_PSEUDO_ELEMENT_NONE],
styles->styles[pseudo_element],
- nscss_compute_font_size, NULL,
+ nscss_compute_font_size, ctx,
&composed);
if (error != CSS_OK) {
/* TODO: perhaps this shouldn't be quite so
@@ -346,7 +349,7 @@ css_computed_style *nscss_get_blank_style(nscss_select_ctx *ctx,
/* TODO: Do we really need to compose? Initial style shouldn't
* have any inherited properties. */
error = css_computed_style_compose(parent, partial,
- nscss_compute_font_size, NULL, &composed);
+ nscss_compute_font_size, ctx, &composed);
css_computed_style_destroy(partial);
if (error != CSS_OK) {
css_computed_style_destroy(composed);
@@ -419,14 +422,37 @@ css_error nscss_compute_font_size(void *pw, const css_hint *parent,
FDIV(parent_size.value, FLTTOFIX(1.2));
size->data.length.unit = parent_size.unit;
} else if (size->data.length.unit == CSS_UNIT_EM ||
- size->data.length.unit == CSS_UNIT_EX) {
+ size->data.length.unit == CSS_UNIT_EX ||
+ size->data.length.unit == CSS_UNIT_CAP ||
+ size->data.length.unit == CSS_UNIT_CH ||
+ size->data.length.unit == CSS_UNIT_IC) {
size->data.length.value =
FMUL(size->data.length.value, parent_size.value);
- if (size->data.length.unit == CSS_UNIT_EX) {
+ switch (size->data.length.unit) {
+ case CSS_UNIT_EX:
/* 1ex = 0.6em in NetSurf */
size->data.length.value = FMUL(size->data.length.value,
FLTTOFIX(0.6));
+ break;
+ case CSS_UNIT_CAP:
+ /* Height of captals. 1cap = 0.9em in NetSurf. */
+ size->data.length.value = FMUL(size->data.length.value,
+ FLTTOFIX(0.9));
+ break;
+ case CSS_UNIT_CH:
+ /* Width of '0'. 1ch = 0.4em in NetSurf. */
+ size->data.length.value = FMUL(size->data.length.value,
+ FLTTOFIX(0.4));
+ break;
+ case CSS_UNIT_IC:
+ /* Width of U+6C43. 1ic = 1.1em in NetSurf. */
+ size->data.length.value = FMUL(size->data.length.value,
+ FLTTOFIX(1.1));
+ break;
+ default:
+ /* No scaling required for EM. */
+ break;
}
size->data.length.unit = parent_size.unit;
@@ -434,6 +460,25 @@ css_error nscss_compute_font_size(void *pw, const css_hint *parent,
size->data.length.value = FDIV(FMUL(size->data.length.value,
parent_size.value), INTTOFIX(100));
size->data.length.unit = parent_size.unit;
+ } else if (size->data.length.unit == CSS_UNIT_REM) {
+ nscss_select_ctx *ctx = pw;
+ if (parent == NULL) {
+ size->data.length.value = parent_size.value;
+ size->data.length.unit = parent_size.unit;
+ } else {
+ css_computed_font_size(ctx->root_style,
+ &parent_size.value,
+ &size->data.length.unit);
+ size->data.length.value = FMUL(
+ size->data.length.value,
+ parent_size.value);
+ }
+ } else if (size->data.length.unit == CSS_UNIT_RLH) {
+ /** TODO: Convert root element line-height to absolute value. */
+ size->data.length.value = FMUL(size->data.length.value, FDIV(
+ INTTOFIX(nsoption_int(font_size)),
+ INTTOFIX(10)));
+ size->data.length.unit = CSS_UNIT_PT;
}
size->status = CSS_FONT_SIZE_DIMENSION;
diff --git a/content/handlers/css/select.h b/content/handlers/css/select.h
index abfb85814..9fa6d3a56 100644
--- a/content/handlers/css/select.h
+++ b/content/handlers/css/select.h
@@ -37,6 +37,7 @@ typedef struct nscss_select_ctx
bool quirks;
struct nsurl *base_url;
lwc_string *universal;
+ const css_computed_style *root_style;
const css_computed_style *parent_style;
} nscss_select_ctx;
diff --git a/content/handlers/css/utils.c b/content/handlers/css/utils.c
index 5c7cbd9a7..8fe157bd2 100644
--- a/content/handlers/css/utils.c
+++ b/content/handlers/css/utils.c
@@ -27,11 +27,75 @@
/** Screen DPI in fixed point units: defaults to 90, which RISC OS uses */
css_fixed nscss_screen_dpi = F_90;
+
+/**
+ * Map viewport-relative length units to either vh or vw.
+ *
+ * Non-viewport-relative units are unchanged.
+ *
+ * \param[in] ctx Length conversion context.
+ * \param[in] unit Unit to map.
+ * \return the mapped unit.
+ */
+static inline css_unit css_utils__fudge_viewport_units(
+ const nscss_len_ctx *ctx,
+ css_unit unit)
+{
+ switch (unit) {
+ case CSS_UNIT_VI:
+ assert(ctx->root_style != NULL);
+ if (css_computed_writing_mode(ctx->root_style) ==
+ CSS_WRITING_MODE_HORIZONTAL_TB) {
+ unit = CSS_UNIT_VW;
+ } else {
+ unit = CSS_UNIT_VH;
+ }
+ break;
+ case CSS_UNIT_VB:
+ assert(ctx->root_style != NULL);
+ if (css_computed_writing_mode(ctx->root_style) ==
+ CSS_WRITING_MODE_HORIZONTAL_TB) {
+ unit = CSS_UNIT_VH;
+ } else {
+ unit = CSS_UNIT_VW;
+ }
+ break;
+ case CSS_UNIT_VMIN:
+ if (ctx->vh < ctx->vw) {
+ unit = CSS_UNIT_VH;
+ } else {
+ unit = CSS_UNIT_VW;
+ }
+ break;
+ case CSS_UNIT_VMAX:
+ if (ctx->vh > ctx->vw) {
+ unit = CSS_UNIT_VH;
+ } else {
+ unit = CSS_UNIT_VW;
+ }
+ break;
+ default: break;
+ }
+
+ return unit;
+}
+
/* exported interface documented in content/handlers/css/utils.h */
-css_fixed nscss_len2pt(css_fixed length, css_unit unit)
+css_fixed nscss_len2pt(
+ const nscss_len_ctx *ctx,
+ css_fixed length,
+ css_unit unit)
{
/* Length must not be relative */
- assert(unit != CSS_UNIT_EM && unit != CSS_UNIT_EX);
+ assert(unit != CSS_UNIT_EM &&
+ unit != CSS_UNIT_EX &&
+ unit != CSS_UNIT_CAP &&
+ unit != CSS_UNIT_CH &&
+ unit != CSS_UNIT_IC &&
+ unit != CSS_UNIT_REM &&
+ unit != CSS_UNIT_RLH);
+
+ unit = css_utils__fudge_viewport_units(ctx, unit);
switch (unit) {
/* We assume the screen and any other output has the same dpi */
@@ -45,36 +109,50 @@ css_fixed nscss_len2pt(css_fixed length, css_unit unit)
/* 1in = 25.4mm => 1mm = (72/25.4)pt */
case CSS_UNIT_MM: return FMUL(length,
FDIV(F_72, FLTTOFIX(25.4)));
+ /* 1in = 101.6q => 1mm = (72/101.6)pt */
+ case CSS_UNIT_Q: return FMUL(length,
+ FDIV(F_72, FLTTOFIX(101.6)));
case CSS_UNIT_PT: return length;
/* 1pc = 12pt */
case CSS_UNIT_PC: return FMUL(length, INTTOFIX(12));
+ case CSS_UNIT_VH: return FDIV(FMUL(FDIV((length * ctx->vh), F_100),
+ F_72), nscss_screen_dpi);
+ case CSS_UNIT_VW: return FDIV(FMUL(FDIV((length * ctx->vw), F_100),
+ F_72), nscss_screen_dpi);
default: break;
}
return 0;
}
-
/* exported interface documented in content/handlers/css/utils.h */
-css_fixed nscss_len2px(css_fixed length, css_unit unit,
+css_fixed nscss_len2px(
+ const nscss_len_ctx *ctx,
+ css_fixed length,
+ css_unit unit,
const css_computed_style *style)
{
/* We assume the screen and any other output has the same dpi */
css_fixed px_per_unit;
- assert(style != NULL || (unit != CSS_UNIT_EM && unit != CSS_UNIT_EX));
+ unit = css_utils__fudge_viewport_units(ctx, unit);
switch (unit) {
case CSS_UNIT_EM:
case CSS_UNIT_EX:
+ case CSS_UNIT_CAP:
+ case CSS_UNIT_CH:
+ case CSS_UNIT_IC:
{
css_fixed font_size = 0;
css_unit font_unit = CSS_UNIT_PT;
+ assert(style != NULL);
+
css_computed_font_size(style, &font_size, &font_unit);
/* Convert to points */
- font_size = nscss_len2pt(font_size, font_unit);
+ font_size = nscss_len2pt(ctx, font_size, font_unit);
/* Clamp to configured minimum */
if (font_size < FDIV(INTTOFIX(nsoption_int(font_min_size)), F_10)) {
@@ -85,9 +163,22 @@ css_fixed nscss_len2px(css_fixed length, css_unit unit,
* 1in = 72pt => 1pt = (DPI/72)px */
px_per_unit = FDIV(FMUL(font_size, nscss_screen_dpi), F_72);
- /* Scale ex units: we use a fixed ratio of 1ex = 0.6em */
- if (unit == CSS_UNIT_EX)
+ /* Scale non-em units to em. We have fixed ratios. */
+ switch (unit) {
+ case CSS_UNIT_EX:
px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.6));
+ break;
+ case CSS_UNIT_CAP:
+ px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.9));
+ break;
+ case CSS_UNIT_CH:
+ px_per_unit = FMUL(px_per_unit, FLTTOFIX(0.4));
+ break;
+ case CSS_UNIT_IC:
+ px_per_unit = FMUL(px_per_unit, FLTTOFIX(1.1));
+ break;
+ default: break;
+ }
}
break;
case CSS_UNIT_PX:
@@ -105,6 +196,10 @@ css_fixed nscss_len2px(css_fixed length, css_unit unit,
case CSS_UNIT_MM:
px_per_unit = FDIV(nscss_screen_dpi, FLTTOFIX(25.4));
break;
+ /* 1in = 101.6q => 1q = (DPI/101.6)px */
+ case CSS_UNIT_Q:
+ px_per_unit = FDIV(nscss_screen_dpi, FLTTOFIX(101.6));
+ break;
/* 1in = 72pt => 1pt = (DPI/72)px */
case CSS_UNIT_PT:
px_per_unit = FDIV(nscss_screen_dpi, F_72);
@@ -113,6 +208,39 @@ css_fixed nscss_len2px(css_fixed length, css_unit unit,
case CSS_UNIT_PC:
px_per_unit = FDIV(nscss_screen_dpi, INTTOFIX(6));
break;
+ case CSS_UNIT_REM:
+ {
+ css_fixed font_size = 0;
+ css_unit font_unit = CSS_UNIT_PT;
+
+ assert(ctx->root_style != NULL);
+
+ css_computed_font_size(ctx->root_style,
+ &font_size, &font_unit);
+
+ /* Convert to points */
+ font_size = nscss_len2pt(ctx, font_size, font_unit);
+
+ /* Clamp to configured minimum */
+ if (font_size < FDIV(INTTOFIX(nsoption_int(font_min_size)), F_10)) {
+ font_size = FDIV(INTTOFIX(nsoption_int(font_min_size)), F_10);
+ }
+
+ /* Convert to pixels (manually, to maximise precision)
+ * 1in = 72pt => 1pt = (DPI/72)px */
+ px_per_unit = FDIV(FMUL(font_size, nscss_screen_dpi), F_72);
+ break;
+ }
+ /* 1rlh = <user_font_size>pt => 1rlh = (DPI/user_font_size)px */
+ case CSS_UNIT_RLH:
+ px_per_unit = FDIV(nscss_screen_dpi, FDIV(
+ INTTOFIX(nsoption_int(font_size)),
+ INTTOFIX(10)));
+ break;
+ case CSS_UNIT_VH:
+ return TRUNCATEFIX((FDIV((length * ctx->vh), F_100) + F_0_5));
+ case CSS_UNIT_VW:
+ return TRUNCATEFIX((FDIV((length * ctx->vw), F_100) + F_0_5));
default:
px_per_unit = 0;
break;
diff --git a/content/handlers/css/utils.h b/content/handlers/css/utils.h
index 58a5ea6e6..c8f4c82f4 100644
--- a/content/handlers/css/utils.h
+++ b/content/handlers/css/utils.h
@@ -27,23 +27,122 @@
extern css_fixed nscss_screen_dpi;
/**
+ * Length conversion context data.
+ */
+typedef struct nscss_len_ctx {
+ /**
+ * Viewport width in px.
+ * Only used if unit is vh, vw, vi, vb, vmin, or vmax.
+ */
+ int vw;
+ /**
+ * Viewport height in px.
+ * Only used if unit is vh, vw, vi, vb, vmin, or vmax.
+ */
+ int vh;
+ /**
+ * Computed style for the document root element.
+ * May be NULL if unit is not rem, or rlh.
+ */
+ const css_computed_style *root_style;
+} nscss_len_ctx;
+
+/**
* Convert an absolute CSS length to points.
*
- * \param[in] length Absolute CSS length.
- * \param[in] unit Unit of the length.
+ * \param[in] ctx Length conversion context.
+ * \param[in] length Absolute CSS length.
+ * \param[in] unit Unit of the length.
* \return length in points
*/
-css_fixed nscss_len2pt(css_fixed length, css_unit unit);
+css_fixed nscss_len2pt(
+ const nscss_len_ctx *ctx,
+ css_fixed length,
+ css_unit unit);
/**
* Convert a CSS length to pixels.
*
- * \param length Length to convert
- * \param unit Corresponding unit
- * \param style Computed style applying to length. May be NULL if unit is
- * neither em nor ex
+ * \param[in] ctx Length conversion context.
+ * \param[in] length Length to convert.
+ * \param[in] unit Corresponding unit.
+ * \param[in] style Computed style applying to length.
+ * May be NULL if unit is not em, ex, cap, ch, or ic.
* \return length in pixels
*/
-css_fixed nscss_len2px(css_fixed length, css_unit unit, const css_computed_style *style);
+css_fixed nscss_len2px(
+ const nscss_len_ctx *ctx,
+ css_fixed length,
+ css_unit unit,
+ const css_computed_style *style);
+
+
+/**
+ * Temporary helper wrappers for for libcss computed style getter, while
+ * we don't support flexbox related property values.
+ */
+
+static inline uint8_t ns_computed_display(
+ const css_computed_style *style, bool root)
+{
+ uint8_t value = css_computed_display(style, root);
+
+ if (value == CSS_DISPLAY_FLEX) {
+ return CSS_DISPLAY_BLOCK;
+
+ } else if (value == CSS_DISPLAY_INLINE_FLEX) {
+ return CSS_DISPLAY_INLINE_BLOCK;
+ }
+
+ return value;
+}
+
+
+static inline uint8_t ns_computed_display_static(
+ const css_computed_style *style)
+{
+ uint8_t value = css_computed_display_static(style);
+
+ if (value == CSS_DISPLAY_FLEX) {
+ return CSS_DISPLAY_BLOCK;
+
+ } else if (value == CSS_DISPLAY_INLINE_FLEX) {
+ return CSS_DISPLAY_INLINE_BLOCK;
+ }
+
+ return value;
+}
+
+
+static inline uint8_t ns_computed_min_height(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ uint8_t value = css_computed_min_height(style, length, unit);
+
+ if (value == CSS_MIN_HEIGHT_AUTO) {
+ value = CSS_MIN_HEIGHT_SET;
+ *length = 0;
+ *unit = CSS_UNIT_PX;
+ }
+
+ return value;
+}
+
+
+static inline uint8_t ns_computed_min_width(
+ const css_computed_style *style,
+ css_fixed *length, css_unit *unit)
+{
+ uint8_t value = css_computed_min_width(style, length, unit);
+
+ if (value == CSS_MIN_WIDTH_AUTO) {
+ value = CSS_MIN_WIDTH_SET;
+ *length = 0;
+ *unit = CSS_UNIT_PX;
+ }
+
+ return value;
+}
#endif
diff --git a/content/handlers/html/Makefile b/content/handlers/html/Makefile
new file mode 100644
index 000000000..afefba27d
--- /dev/null
+++ b/content/handlers/html/Makefile
@@ -0,0 +1,7 @@
+# HTML content handler sources
+
+S_HTML := box.c box_construct.c box_normalise.c box_textarea.c \
+ font.c form.c imagemap.c layout.c search.c table.c \
+ html.c html_css.c html_css_fetcher.c html_script.c \
+ html_interaction.c html_redraw.c html_redraw_border.c \
+ html_forms.c html_object.c
diff --git a/render/box.c b/content/handlers/html/box.c
index 11a24e797..52cf12413 100644
--- a/render/box.c
+++ b/content/handlers/html/box.c
@@ -41,9 +41,9 @@
#include "desktop/scrollbar.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
+#include "html/box.h"
+#include "html/form_internal.h"
+#include "html/html_internal.h"
#define box_is_float(box) (box->type == BOX_FLOAT_LEFT || \
box->type == BOX_FLOAT_RIGHT)
@@ -62,7 +62,7 @@ static int box_talloc_destructor(struct box *b)
css_computed_style_destroy(b->style);
b->style = NULL;
}
-
+
if (b->styles != NULL) {
css_select_results_destroy(b->styles);
b->styles = NULL;
@@ -112,7 +112,7 @@ static int box_talloc_destructor(struct box *b)
*/
struct box * box_create(css_select_results *styles, css_computed_style *style,
- bool style_owned, nsurl *href, const char *target,
+ bool style_owned, nsurl *href, const char *target,
const char *title, lwc_string *id, void *context)
{
unsigned int i;
@@ -342,20 +342,27 @@ void box_bounds(struct box *box, struct rect *r)
/**
* Determine if a point lies within a box.
*
- * \param box box to consider
- * \param x coordinate relative to box
- * \param y coordinate relative to box
- * \param physically if function returning true, physically is set true if
- * point is within the box's physical dimensions and false
- * if the point is not within the box's physical dimensions
- * but is in the area defined by the box's descendants.
- * if function returning false, physically is undefined.
+ * \param[in] len_ctx CSS length conversion context to use.
+ * \param[in] box Box to consider
+ * \param[in] x Coordinate relative to box
+ * \param[in] y Coordinate relative to box
+ * \param[out] physically If function returning true, physically is set true
+ * iff point is within the box's physical dimensions and
+ * false if the point is not within the box's physical
+ * dimensions but is in the area defined by the box's
+ * descendants. If function returns false, physically
+ * is undefined.
* \return true if the point is within the box or a descendant box
*
* This is a helper function for box_at_point().
*/
-static bool box_contains_point(struct box *box, int x, int y, bool *physically)
+static bool box_contains_point(
+ const nscss_len_ctx *len_ctx,
+ const struct box *box,
+ int x,
+ int y,
+ bool *physically)
{
css_computed_clip_rect css_rect;
@@ -382,25 +389,25 @@ static bool box_contains_point(struct box *box, int x, int y, bool *physically)
/* Adjust rect to css clip region */
if (css_rect.left_auto == false) {
- r.x0 += FIXTOINT(nscss_len2px(
+ r.x0 += FIXTOINT(nscss_len2px(len_ctx,
css_rect.left, css_rect.lunit,
box->style));
}
if (css_rect.top_auto == false) {
- r.y0 += FIXTOINT(nscss_len2px(
+ r.y0 += FIXTOINT(nscss_len2px(len_ctx,
css_rect.top, css_rect.tunit,
box->style));
}
if (css_rect.right_auto == false) {
r.x1 = box->border[LEFT].width +
- FIXTOINT(nscss_len2px(
+ FIXTOINT(nscss_len2px(len_ctx,
css_rect.right,
css_rect.runit,
box->style));
}
if (css_rect.bottom_auto == false) {
r.y1 = box->border[TOP].width +
- FIXTOINT(nscss_len2px(
+ FIXTOINT(nscss_len2px(len_ctx,
css_rect.bottom,
css_rect.bunit,
box->style));
@@ -441,7 +448,7 @@ static bool box_contains_point(struct box *box, int x, int y, bool *physically)
*physically = true;
return true;
}
- if ((box->style && css_computed_overflow_x(box->style) ==
+ if ((box->style && css_computed_overflow_x(box->style) ==
CSS_OVERFLOW_VISIBLE) || !box->style) {
if (box->descendant_x0 <= x &&
x < box->descendant_x1) {
@@ -449,7 +456,7 @@ static bool box_contains_point(struct box *box, int x, int y, bool *physically)
return true;
}
}
- if ((box->style && css_computed_overflow_y(box->style) ==
+ if ((box->style && css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_VISIBLE) || !box->style) {
if (box->descendant_y0 <= y &&
y < box->descendant_y1) {
@@ -659,6 +666,7 @@ skip_children:
/**
* Find the boxes at a point.
*
+ * \param len_ctx CSS length conversion context for document.
* \param box box to search children of
* \param x point to find, in global document coordinates
* \param y point to find, in global document coordinates
@@ -674,13 +682,14 @@ skip_children:
* struct box *box = top_of_document_to_search;
* int box_x = 0, box_y = 0;
*
- * while ((box = box_at_point(box, x, y, &box_x, &box_y))) {
+ * while ((box = box_at_point(len_ctx, box, x, y, &box_x, &box_y))) {
* // process box
* }
* \endcode
*/
-struct box *box_at_point(struct box *box, const int x, const int y,
+struct box *box_at_point(const nscss_len_ctx *len_ctx,
+ struct box *box, const int x, const int y,
int *box_x, int *box_y)
{
bool skip_children;
@@ -690,7 +699,7 @@ struct box *box_at_point(struct box *box, const int x, const int y,
skip_children = false;
while ((box = box_next_xy(box, box_x, box_y, skip_children))) {
- if (box_contains_point(box, x - *box_x, y - *box_y,
+ if (box_contains_point(len_ctx, box, x - *box_x, y - *box_y,
&physically)) {
*box_x -= scrollbar_get_offset(box->scroll_x);
*box_y -= scrollbar_get_offset(box->scroll_y);
@@ -972,7 +981,7 @@ struct box *box_find_by_id(struct box *box, lwc_string *id)
bool box_visible(struct box *box)
{
/* visibility: hidden */
- if (box->style && css_computed_visibility(box->style) ==
+ if (box->style && css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
return false;
@@ -1031,7 +1040,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
if (box->space)
fprintf(stream, "space ");
if (box->object) {
- fprintf(stream, "(object '%s') ",
+ fprintf(stream, "(object '%s') ",
nsurl_access(hlcache_handle_get_url(box->object)));
}
if (box->iframe) {
@@ -1048,7 +1057,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
if (box->title)
fprintf(stream, " [%s]", box->title);
if (box->id)
- fprintf(stream, " <%s>", lwc_string_data(box->id));
+ fprintf(stream, " ID:%s", lwc_string_data(box->id));
if (box->type == BOX_INLINE || box->type == BOX_INLINE_END)
fprintf(stream, " inline_end %p", box->inline_end);
if (box->float_children)
@@ -1071,6 +1080,13 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
box->col[i].min, box->col[i].max);
fprintf(stream, ")");
}
+ if (box->node != NULL) {
+ dom_string *name;
+ if (dom_node_get_node_name(box->node, &name) == DOM_NO_ERR) {
+ fprintf(stream, " <%s>", dom_string_data(name));
+ dom_string_unref(name);
+ }
+ }
fprintf(stream, "\n");
if (box->list_marker) {
@@ -1148,7 +1164,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
if (box->scroll_y == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
guit->misc->warning("NoMemory", 0);
return false;
}
@@ -1169,7 +1185,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
if (box->scroll_x == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
guit->misc->warning("NoMemory", 0);
return false;
}
@@ -1190,10 +1206,10 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
visible_width, full_width);
}
}
-
+
if (right && bottom)
scrollbar_make_pair(box->scroll_x, box->scroll_y);
-
+
return true;
}
@@ -1223,4 +1239,3 @@ bool box_hscrollbar_present(const struct box * const box)
return box->padding[LEFT] + box->width + box->padding[RIGHT] +
box->border[RIGHT].width < box->descendant_x1;
}
-
diff --git a/render/box.h b/content/handlers/html/box.h
index 2800d4026..0952b841b 100644
--- a/render/box.h
+++ b/content/handlers/html/box.h
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Box tree construction and manipulation (interface).
*
* This stage of rendering converts a tree of dom_nodes (produced by libdom)
@@ -83,14 +84,16 @@
* \endcode
*/
-#ifndef _NETSURF_RENDER_BOX_H_
-#define _NETSURF_RENDER_BOX_H_
+#ifndef NETSURF_HTML_BOX_H
+#define NETSURF_HTML_BOX_H
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <libcss/libcss.h>
+#include "content/handlers/css/utils.h"
+
struct content;
struct box;
struct browser_window;
@@ -319,7 +322,7 @@ extern const char *TARGET_BLANK;
struct box * box_create(css_select_results *styles, css_computed_style *style,
- bool style_owned, struct nsurl *href, const char *target,
+ bool style_owned, struct nsurl *href, const char *target,
const char *title, lwc_string *id, void *context);
void box_add_child(struct box *parent, struct box *child);
void box_insert_sibling(struct box *box, struct box *new_box);
@@ -328,7 +331,9 @@ void box_free(struct box *box);
void box_free_box(struct box *box);
void box_bounds(struct box *box, struct rect *r);
void box_coords(struct box *box, int *x, int *y);
-struct box *box_at_point(struct box *box, const int x, const int y,
+struct box *box_at_point(
+ const nscss_len_ctx *len_ctx,
+ struct box *box, const int x, const int y,
int *box_x, int *box_y);
struct box *box_pick_text_box(struct html_content *html,
int x, int y, int dir, int *dx, int *dy);
@@ -356,6 +361,20 @@ bool box_hscrollbar_present(const struct box *box);
nserror dom_to_box(struct dom_node *n, struct html_content *c,
box_construct_complete_cb cb);
-bool box_normalise_block(struct box *block, struct html_content *c);
+bool box_normalise_block(
+ struct box *block,
+ const struct box *root,
+ struct html_content *c);
+
+/**
+ * Check if layout box is a first child.
+ *
+ * \param[in] b Box to check.
+ * \return true iff box is first child.
+ */
+static inline bool box_is_first_child(struct box *b)
+{
+ return (b->parent == NULL || b == b->parent->children);
+}
#endif
diff --git a/render/box_construct.c b/content/handlers/html/box_construct.c
index f2d041385..5650fbf55 100644
--- a/render/box_construct.c
+++ b/content/handlers/html/box_construct.c
@@ -46,12 +46,14 @@
#include "content/content_protected.h"
#include "css/hints.h"
#include "css/select.h"
+#include "css/utils.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/box_textarea.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
+#include "html/html.h"
+#include "html/box.h"
+#include "html/box_textarea.h"
+#include "html/form_internal.h"
+#include "html/html_internal.h"
/**
* Context for box tree construction
@@ -103,7 +105,8 @@ static bool box_construct_element(struct box_construct_ctx *ctx,
static void box_construct_element_after(dom_node *n, html_content *content);
static bool box_construct_text(struct box_construct_ctx *ctx);
static css_select_results * box_get_style(html_content *c,
- const css_computed_style *parent_style, dom_node *n);
+ const css_computed_style *parent_style,
+ const css_computed_style *root_style, dom_node *n);
static void box_text_transform(char *s, unsigned int len,
enum css_text_transform_e tt);
#define BOX_SPECIAL_PARAMS dom_node *n, html_content *content, \
@@ -428,7 +431,8 @@ void convert_xml_to_box(struct box_construct_ctx *ctx)
root.children->parent = &root;
/** \todo Remove box_normalise_block */
- if (box_normalise_block(&root, ctx->content) == false) {
+ if (box_normalise_block(&root, ctx->root_box,
+ ctx->content) == false) {
ctx->cb(ctx->content, false);
} else {
ctx->content->layout = root.children;
@@ -594,6 +598,7 @@ static void box_construct_generate(dom_node *n, html_content *content,
struct box *box, const css_computed_style *style)
{
struct box *gen = NULL;
+ enum css_display_e computed_display;
const css_computed_content_item *c_item;
/* Nothing to generate if the parent box is not a block */
@@ -611,8 +616,10 @@ static void box_construct_generate(dom_node *n, html_content *content,
}
/* create box for this element */
- if (css_computed_display(style, box_is_root(n)) == CSS_DISPLAY_BLOCK) {
- /* currently only support block level elements */
+ computed_display = ns_computed_display(style, box_is_root(n));
+ if (computed_display == CSS_DISPLAY_BLOCK ||
+ computed_display == CSS_DISPLAY_TABLE) {
+ /* currently only support block level boxes */
/** \todo Not wise to drop const from the computed style */
gen = box_create(NULL, (css_computed_style *) style,
@@ -622,7 +629,7 @@ static void box_construct_generate(dom_node *n, html_content *content,
}
/* set box type from computed display */
- gen->type = box_map[css_computed_display(
+ gen->type = box_map[ns_computed_display(
style, box_is_root(n))];
box_add_child(box, gen);
@@ -737,6 +744,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
lwc_string *bgimage_uri;
dom_exception err;
struct box_construct_props props;
+ const css_computed_style *root_style = NULL;
assert(ctx->n != NULL);
@@ -744,12 +752,17 @@ bool box_construct_element(struct box_construct_ctx *ctx,
if (props.containing_block != NULL) {
/* In case the containing block is a pre block, we clear
- * the PRE_STRIP flag since it is not used if we follow
- * the pre with a tag */
+ * the PRE_STRIP flag since it is not used if we follow
+ * the pre with a tag */
props.containing_block->flags &= ~PRE_STRIP;
}
- styles = box_get_style(ctx->content, props.parent_style, ctx->n);
+ if (props.node_is_root == false) {
+ root_style = ctx->root_box->style;
+ }
+
+ styles = box_get_style(ctx->content, props.parent_style, root_style,
+ ctx->n);
if (styles == NULL)
return false;
@@ -828,11 +841,11 @@ bool box_construct_element(struct box_construct_ctx *ctx,
if ((css_computed_position(box->style) == CSS_POSITION_ABSOLUTE ||
css_computed_position(box->style) ==
CSS_POSITION_FIXED) &&
- (css_computed_display_static(box->style) ==
+ (ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE ||
- css_computed_display_static(box->style) ==
+ ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE_BLOCK ||
- css_computed_display_static(box->style) ==
+ ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE_TABLE)) {
/* Special case for absolute positioning: make absolute inlines
* into inline block so that the boxes are constructed in an
@@ -845,7 +858,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box->type = BOX_BLOCK;
} else {
/* Normal mapping */
- box->type = box_map[css_computed_display(box->style,
+ box->type = box_map[ns_computed_display(box->style,
props.node_is_root)];
}
@@ -873,7 +886,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box->styles->styles[CSS_PSEUDO_ELEMENT_BEFORE]);
}
- if (box->type == BOX_NONE || (css_computed_display(box->style,
+ if (box->type == BOX_NONE || (ns_computed_display(box->style,
props.node_is_root) == CSS_DISPLAY_NONE &&
props.node_is_root == false)) {
css_select_results_destroy(styles);
@@ -965,7 +978,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box_add_child(props.inline_container, box);
} else {
- if (css_computed_display(box->style, props.node_is_root) ==
+ if (ns_computed_display(box->style, props.node_is_root) ==
CSS_DISPLAY_LIST_ITEM) {
/* List item: compute marker */
if (box_construct_marker(box, props.title, ctx,
@@ -1317,13 +1330,15 @@ bool box_construct_text(struct box_construct_ctx *ctx)
/**
* Get the style for an element.
*
- * \param c content of type CONTENT_HTML that is being processed
+ * \param c content of type CONTENT_HTML that is being processed
* \param parent_style style at this point in xml tree, or NULL for root
- * \param n node in xml tree
+ * \param root_style root node's style, or NULL for root
+ * \param n node in xml tree
* \return the new style, or NULL on memory exhaustion
*/
css_select_results *box_get_style(html_content *c,
- const css_computed_style *parent_style, dom_node *n)
+ const css_computed_style *parent_style,
+ const css_computed_style *root_style, dom_node *n)
{
dom_string *s;
dom_exception err;
@@ -1355,6 +1370,7 @@ css_select_results *box_get_style(html_content *c,
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
ctx.base_url = c->base_url;
ctx.universal = c->universal;
+ ctx.root_style = root_style;
ctx.parent_style = parent_style;
/* Select style for element */
@@ -1556,7 +1572,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
css_unit wunit = CSS_UNIT_PX;
css_unit hunit = CSS_UNIT_PX;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -1663,7 +1679,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
dom_node *c;
dom_exception err;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -1897,7 +1913,7 @@ bool box_frameset(BOX_SPECIAL_PARAMS)
bool ok;
if (content->frameset) {
- LOG("Error: multiple framesets in document.");
+ NSLOG(netsurf, INFO, "Error: multiple framesets in document.");
/* Don't convert children */
if (convert_children)
*convert_children = false;
@@ -2053,9 +2069,9 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
/* common extension: frameborder="yes|no" to control all children */
err = dom_element_get_attribute(n, corestring_dom_frameborder, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (dom_string_caseless_lwc_isequal(s,
- corestring_lwc_no) == 0)
- default_border = false;
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no) == 0)
+ default_border = false;
dom_string_unref(s);
}
@@ -2199,8 +2215,8 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
/* copy url */
if (url != NULL) {
- /* no self-references */
- if (nsurl_compare(content->base_url, url,
+ /* no self-references */
+ if (nsurl_compare(content->base_url, url,
NSURL_COMPLETE) == false)
frame->url = url;
url = NULL;
@@ -2313,7 +2329,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
struct content_html_iframe *iframe;
int i;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -2548,7 +2564,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
corestring_lwc_image)) {
gadget->type = GADGET_IMAGE;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) != CSS_DISPLAY_NONE &&
nsoption_bool(foreground_images) == true) {
dom_string *s;
@@ -2884,7 +2900,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
dom_string *src;
dom_exception err;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -3049,7 +3065,7 @@ bool box_get_attribute(dom_node *n, const char *attribute,
}
-/* exported function documented in render/box.h */
+/* exported function documented in html/box.h */
bool
box_extract_link(const html_content *content,
const dom_string *dsrel,
@@ -3117,6 +3133,3 @@ box_extract_link(const html_content *content,
return true;
}
-
-
-
diff --git a/render/box_normalise.c b/content/handlers/html/box_normalise.c
index 5d36b99d7..7155cb722 100644
--- a/render/box_normalise.c
+++ b/content/handlers/html/box_normalise.c
@@ -19,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Box tree normalisation (implementation).
*/
@@ -31,9 +32,9 @@
#include "utils/errors.h"
#include "css/select.h"
-#include "render/box.h"
-#include "render/html_internal.h"
-#include "render/table.h"
+#include "html/box.h"
+#include "html/html_internal.h"
+#include "html/table.h"
/* Define to enable box normalise debug */
#undef BOX_NORMALISE_DEBUG
@@ -65,24 +66,38 @@ struct columns {
};
-static bool box_normalise_table(struct box *table, html_content *c);
-static bool box_normalise_table_spans(struct box *table,
- struct span_info *spans, html_content *c);
-static bool box_normalise_table_row_group(struct box *row_group,
+static bool box_normalise_table(
+ struct box *table,
+ const struct box *root,
+ html_content *c);
+static bool box_normalise_table_spans(
+ struct box *table,
+ const struct box *root,
+ struct span_info *spans,
+ html_content *c);
+static bool box_normalise_table_row_group(
+ struct box *row_group,
+ const struct box *root,
struct columns *col_info,
html_content *c);
-static bool box_normalise_table_row(struct box *row,
+static bool box_normalise_table_row(
+ struct box *row,
+ const struct box *root,
struct columns *col_info,
html_content *c);
static bool calculate_table_row(struct columns *col_info,
unsigned int col_span, unsigned int row_span,
unsigned int *start_column, struct box *cell);
-static bool box_normalise_inline_container(struct box *cont, html_content *c);
+static bool box_normalise_inline_container(
+ struct box *cont,
+ const struct box *root,
+ html_content *c);
/**
* Ensure the box tree is correctly nested by adding and removing nodes.
*
* \param block box of type BLOCK, INLINE_BLOCK, or TABLE_CELL
+ * \param root root box of document
* \param c content of boxes
* \return true on success, false on memory exhaustion
*
@@ -100,7 +115,10 @@ static bool box_normalise_inline_container(struct box *cont, html_content *c);
* \endcode
*/
-bool box_normalise_block(struct box *block, html_content *c)
+bool box_normalise_block(
+ struct box *block,
+ const struct box *root,
+ html_content *c)
{
struct box *child;
struct box *next_child;
@@ -109,9 +127,12 @@ bool box_normalise_block(struct box *block, html_content *c)
nscss_select_ctx ctx;
assert(block != NULL);
+ assert(root != NULL);
+
+ ctx.root_style = root->style;
#ifdef BOX_NORMALISE_DEBUG
- LOG("block %p, block->type %u", block, block->type);
+ NSLOG(netsurf, INFO, "block %p, block->type %u", block, block->type);
#endif
assert(block->type == BOX_BLOCK || block->type == BOX_INLINE_BLOCK ||
@@ -119,7 +140,8 @@ bool box_normalise_block(struct box *block, html_content *c)
for (child = block->children; child != NULL; child = next_child) {
#ifdef BOX_NORMALISE_DEBUG
- LOG("child %p, child->type = %d", child, child->type);
+ NSLOG(netsurf, INFO, "child %p, child->type = %d", child,
+ child->type);
#endif
next_child = child->next; /* child may be destroyed */
@@ -127,15 +149,15 @@ bool box_normalise_block(struct box *block, html_content *c)
switch (child->type) {
case BOX_BLOCK:
/* ok */
- if (box_normalise_block(child, c) == false)
+ if (box_normalise_block(child, root, c) == false)
return false;
break;
case BOX_INLINE_CONTAINER:
- if (box_normalise_inline_container(child, c) == false)
+ if (box_normalise_inline_container(child, root, c) == false)
return false;
break;
case BOX_TABLE:
- if (box_normalise_table(child, c) == false)
+ if (box_normalise_table(child, root, c) == false)
return false;
break;
case BOX_INLINE:
@@ -198,7 +220,7 @@ bool box_normalise_block(struct box *block, html_content *c)
block->last = table;
table->parent = block;
- if (box_normalise_table(table, c) == false)
+ if (box_normalise_table(table, root, c) == false)
return false;
break;
default:
@@ -210,7 +232,10 @@ bool box_normalise_block(struct box *block, html_content *c)
}
-bool box_normalise_table(struct box *table, html_content * c)
+bool box_normalise_table(
+ struct box *table,
+ const struct box *root,
+ html_content * c)
{
struct box *child;
struct box *next_child;
@@ -222,8 +247,10 @@ bool box_normalise_table(struct box *table, html_content * c)
assert(table != NULL);
assert(table->type == BOX_TABLE);
+ ctx.root_style = root->style;
+
#ifdef BOX_NORMALISE_DEBUG
- LOG("table %p", table);
+ NSLOG(netsurf, INFO, "table %p", table);
#endif
col_info.num_columns = 1;
@@ -242,7 +269,7 @@ bool box_normalise_table(struct box *table, html_content * c)
switch (child->type) {
case BOX_TABLE_ROW_GROUP:
/* ok */
- if (box_normalise_table_row_group(child,
+ if (box_normalise_table_row_group(child, root,
&col_info, c) == false) {
free(col_info.spans);
return false;
@@ -307,7 +334,7 @@ bool box_normalise_table(struct box *table, html_content * c)
table->last = row_group;
row_group->parent = table;
- if (box_normalise_table_row_group(row_group,
+ if (box_normalise_table_row_group(row_group, root,
&col_info, c) == false) {
free(col_info.spans);
return false;
@@ -337,7 +364,8 @@ bool box_normalise_table(struct box *table, html_content * c)
struct box *row;
#ifdef BOX_NORMALISE_DEBUG
- LOG("table->children == 0, creating implied row");
+ NSLOG(netsurf, INFO,
+ "table->children == 0, creating implied row");
#endif
assert(table->style != NULL);
@@ -388,18 +416,15 @@ bool box_normalise_table(struct box *table, html_content * c)
table->rows = 1;
}
- if (box_normalise_table_spans(table, col_info.spans, c) == false) {
+ if (box_normalise_table_spans(table, root, col_info.spans, c) == false) {
free(col_info.spans);
return false;
}
free(col_info.spans);
- if (table_calculate_column_types(table) == false)
- return false;
-
#ifdef BOX_NORMALISE_DEBUG
- LOG("table %p done", table);
+ NSLOG(netsurf, INFO, "table %p done", table);
#endif
return true;
@@ -411,12 +436,16 @@ bool box_normalise_table(struct box *table, html_content * c)
* Additionally, generate empty cells.
*
* \param table Table to process
+ * \param root root box of document
* \param spans Array of length table->columns for use in empty cell detection
* \param c Content containing table
* \return True on success, false on memory exhaustion.
*/
-bool box_normalise_table_spans(struct box *table, struct span_info *spans,
+bool box_normalise_table_spans(
+ struct box *table,
+ const struct box *root,
+ struct span_info *spans,
html_content *c)
{
struct box *table_row_group;
@@ -427,10 +456,12 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
unsigned int col;
nscss_select_ctx ctx;
+ ctx.root_style = root->style;
+
/* Clear span data */
memset(spans, 0, table->columns * sizeof(struct span_info));
- /* Scan table, filling in width and height of table cells with
+ /* Scan table, filling in width and height of table cells with
* colspan = 0 and rowspan = 0. Also generate empty cells */
for (table_row_group = table->children;
table_row_group != NULL;
@@ -479,34 +510,34 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
css_computed_style *style;
struct box *cell, *prev;
- /* If it's already zero, then we need
- * to generate an empty cell for the
- * gap in the row that spans as many
- * columns as remain blank.
+ /* If it's already zero, then we need
+ * to generate an empty cell for the
+ * gap in the row that spans as many
+ * columns as remain blank.
*/
assert(table_row->style != NULL);
/* Find width of gap */
while (col < table->columns &&
- spans[col].row_span ==
+ spans[col].row_span ==
0) {
col++;
}
ctx.ctx = c->select_ctx;
- ctx.quirks = (c->quirks ==
+ ctx.quirks = (c->quirks ==
DOM_DOCUMENT_QUIRKS_MODE_FULL);
ctx.base_url = c->base_url;
ctx.universal = c->universal;
- style = nscss_get_blank_style(&ctx,
+ style = nscss_get_blank_style(&ctx,
table_row->style);
if (style == NULL)
return false;
- cell = box_create(NULL, style, true,
- table_row->href,
- table_row->target,
+ cell = box_create(NULL, style, true,
+ table_row->href,
+ table_row->target,
NULL, NULL, c->bctx);
if (cell == NULL) {
css_computed_style_destroy(
@@ -523,8 +554,8 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
for (prev = table_row->children;
prev != NULL;
prev = prev->next) {
- if (prev->start_column +
- prev->columns ==
+ if (prev->start_column +
+ prev->columns ==
start)
break;
if (prev->next == NULL)
@@ -539,7 +570,7 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
else
table_row->last = cell;
- cell->next =
+ cell->next =
table_row->children;
table_row->children = cell;
} else {
@@ -570,7 +601,9 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
}
-bool box_normalise_table_row_group(struct box *row_group,
+bool box_normalise_table_row_group(
+ struct box *row_group,
+ const struct box *root,
struct columns *col_info,
html_content * c)
{
@@ -584,8 +617,10 @@ bool box_normalise_table_row_group(struct box *row_group,
assert(row_group != 0);
assert(row_group->type == BOX_TABLE_ROW_GROUP);
+ ctx.root_style = root->style;
+
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group %p", row_group);
+ NSLOG(netsurf, INFO, "row_group %p", row_group);
#endif
for (child = row_group->children; child != NULL; child = next_child) {
@@ -595,7 +630,7 @@ bool box_normalise_table_row_group(struct box *row_group,
case BOX_TABLE_ROW:
/* ok */
group_row_count++;
- if (box_normalise_table_row(child, col_info,
+ if (box_normalise_table_row(child, root, col_info,
c) == false)
return false;
break;
@@ -655,7 +690,7 @@ bool box_normalise_table_row_group(struct box *row_group,
row->parent = row_group;
group_row_count++;
- if (box_normalise_table_row(row, col_info,
+ if (box_normalise_table_row(row, root, col_info,
c) == false)
return false;
break;
@@ -677,7 +712,8 @@ bool box_normalise_table_row_group(struct box *row_group,
if (row_group->children == NULL) {
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group->children == 0, inserting implied row");
+ NSLOG(netsurf, INFO,
+ "row_group->children == 0, inserting implied row");
#endif
assert(row_group->style != NULL);
@@ -712,14 +748,16 @@ bool box_normalise_table_row_group(struct box *row_group,
row_group->rows = group_row_count;
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group %p done", row_group);
+ NSLOG(netsurf, INFO, "row_group %p done", row_group);
#endif
return true;
}
-bool box_normalise_table_row(struct box *row,
+bool box_normalise_table_row(
+ struct box *row,
+ const struct box *root,
struct columns *col_info,
html_content * c)
{
@@ -733,8 +771,10 @@ bool box_normalise_table_row(struct box *row,
assert(row != NULL);
assert(row->type == BOX_TABLE_ROW);
+ ctx.root_style = root->style;
+
#ifdef BOX_NORMALISE_DEBUG
- LOG("row %p", row);
+ NSLOG(netsurf, INFO, "row %p", row);
#endif
for (child = row->children; child != NULL; child = next_child) {
@@ -743,7 +783,7 @@ bool box_normalise_table_row(struct box *row,
switch (child->type) {
case BOX_TABLE_CELL:
/* ok */
- if (box_normalise_block(child, c) == false)
+ if (box_normalise_block(child, root, c) == false)
return false;
cell = child;
break;
@@ -802,7 +842,7 @@ bool box_normalise_table_row(struct box *row,
row->last = cell;
cell->parent = row;
- if (box_normalise_block(cell, c) == false)
+ if (box_normalise_block(cell, root, c) == false)
return false;
break;
case BOX_INLINE:
@@ -828,7 +868,7 @@ bool box_normalise_table_row(struct box *row,
/* Update row spanning details for all columns */
for (i = 0; i < col_info->num_columns; i++) {
- if (col_info->spans[i].row_span != 0 &&
+ if (col_info->spans[i].row_span != 0 &&
col_info->spans[i].auto_row == false) {
/* This cell spans rows, and is not an auto row.
* Reduce number of rows left to span */
@@ -843,7 +883,7 @@ bool box_normalise_table_row(struct box *row,
col_info->num_rows++;
#ifdef BOX_NORMALISE_DEBUG
- LOG("row %p done", row);
+ NSLOG(netsurf, INFO, "row %p done", row);
#endif
return true;
@@ -887,12 +927,12 @@ bool calculate_table_row(struct columns *col_info,
* No other browser supports colspan=0, anyway. */
if (col_span == 0)
col_span = 1;
-
+
cell_end_col = cell_start_col + col_span;
if (col_info->num_columns < cell_end_col) {
/* It appears that this row has more columns than
- * the maximum recorded for the table so far.
+ * the maximum recorded for the table so far.
* Allocate more span records. */
spans = realloc(col_info->spans,
sizeof *spans * (cell_end_col + 1));
@@ -907,7 +947,7 @@ bool calculate_table_row(struct columns *col_info,
col_info->spans[cell_end_col].auto_row = false;
}
- /* This cell may span multiple columns. If it also wants to span
+ /* This cell may span multiple columns. If it also wants to span
* multiple rows, temporarily assume it spans 1 row only. This will
* be fixed up in box_normalise_table_spans() */
for (i = cell_start_col; i < cell_end_col; i++) {
@@ -925,7 +965,10 @@ bool calculate_table_row(struct columns *col_info,
}
-bool box_normalise_inline_container(struct box *cont, html_content * c)
+bool box_normalise_inline_container(
+ struct box *cont,
+ const struct box *root,
+ html_content * c)
{
struct box *child;
struct box *next_child;
@@ -934,7 +977,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
assert(cont->type == BOX_INLINE_CONTAINER);
#ifdef BOX_NORMALISE_DEBUG
- LOG("cont %p", cont);
+ NSLOG(netsurf, INFO, "cont %p", cont);
#endif
for (child = cont->children; child != NULL; child = next_child) {
@@ -948,7 +991,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
break;
case BOX_INLINE_BLOCK:
/* ok */
- if (box_normalise_block(child, c) == false)
+ if (box_normalise_block(child, root, c) == false)
return false;
break;
case BOX_FLOAT_LEFT:
@@ -958,12 +1001,12 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
switch (child->children->type) {
case BOX_BLOCK:
- if (box_normalise_block(child->children,
+ if (box_normalise_block(child->children, root,
c) == false)
return false;
break;
case BOX_TABLE:
- if (box_normalise_table(child->children,
+ if (box_normalise_table(child->children, root,
c) == false)
return false;
break;
@@ -997,7 +1040,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
}
#ifdef BOX_NORMALISE_DEBUG
- LOG("cont %p done", cont);
+ NSLOG(netsurf, INFO, "cont %p done", cont);
#endif
return true;
diff --git a/render/box_textarea.c b/content/handlers/html/box_textarea.c
index 44f5c0b16..c19afbb77 100644
--- a/render/box_textarea.c
+++ b/content/handlers/html/box_textarea.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Box tree treeview box replacement (implementation).
*/
@@ -27,9 +28,11 @@
#include "netsurf/keypress.h"
#include "desktop/textarea.h"
-#include "render/box_textarea.h"
-#include "render/font.h"
-#include "render/form_internal.h"
+#include "html/html_internal.h"
+#include "html/box.h"
+#include "html/box_textarea.h"
+#include "html/font.h"
+#include "html/form_internal.h"
bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
@@ -149,7 +152,9 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg)
break;
default:
- LOG("Drag type %d not handled.", msg->data.drag);
+ NSLOG(netsurf, INFO,
+ "Drag type %d not handled.",
+ msg->data.drag);
/* This is a logic faliure in the
* front end code so abort.
*/
@@ -237,8 +242,16 @@ bool box_textarea_create_textarea(html_content *html,
dom_exception err;
textarea_setup ta_setup;
textarea_flags ta_flags;
- plot_font_style_t fstyle;
+ plot_font_style_t fstyle = {
+ .family = PLOT_FONT_FAMILY_SANS_SERIF,
+ .size = 10 * PLOT_STYLE_SCALE,
+ .weight = 400,
+ .flags = FONTF_NONE,
+ .background = 0,
+ .foreground = 0,
+ };
bool read_only = false;
+ bool disabled = false;
struct form_control *gadget = box->gadget;
const char *text;
@@ -257,6 +270,11 @@ bool box_textarea_create_textarea(html_content *html,
if (err != DOM_NO_ERR)
return false;
+ err = dom_html_text_area_element_get_disabled(
+ textarea, &disabled);
+ if (err != DOM_NO_ERR)
+ return false;
+
/* Get the textarea's initial content */
err = dom_html_text_area_element_get_value(textarea, &dom_text);
if (err != DOM_NO_ERR)
@@ -270,6 +288,11 @@ bool box_textarea_create_textarea(html_content *html,
if (err != DOM_NO_ERR)
return false;
+ err = dom_html_input_element_get_disabled(
+ input, &disabled);
+ if (err != DOM_NO_ERR)
+ return false;
+
if (gadget->type == GADGET_PASSWORD)
ta_flags = TEXTAREA_PASSWORD;
else
@@ -289,13 +312,11 @@ bool box_textarea_create_textarea(html_content *html,
text = "";
}
- if (read_only)
+ if (read_only || disabled)
ta_flags |= TEXTAREA_READONLY;
gadget->data.text.data.gadget = gadget;
- font_plot_style_from_css(gadget->box->style, &fstyle);
-
/* Reset to correct values by layout */
ta_setup.width = 200;
ta_setup.height = 20;
@@ -329,4 +350,3 @@ bool box_textarea_create_textarea(html_content *html,
return true;
}
-
diff --git a/render/box_textarea.h b/content/handlers/html/box_textarea.h
index a7a377076..822fc8b10 100644
--- a/render/box_textarea.h
+++ b/content/handlers/html/box_textarea.h
@@ -16,20 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Box tree treeview box replacement (interface).
*/
-
-
-#ifndef _NETSURF_RENDER_BOX_TEXTAREA_H_
-#define _NETSURF_RENDER_BOX_TEXTAREA_H_
-
-
-#include "render/box.h"
-#include "render/html_internal.h"
+#ifndef NETSURF_HTML_BOX_TEXTAREA_H
+#define NETSURF_HTML_BOX_TEXTAREA_H
struct dom_node;
+struct html_content;
+struct box;
/**
* Create textarea widget for a form element
@@ -38,7 +35,7 @@ struct dom_node;
* \param box box with gadget to be given textarea widget
* \param node DOM node for form element
*/
-bool box_textarea_create_textarea(html_content *html,
+bool box_textarea_create_textarea(struct html_content *html,
struct box *box, struct dom_node *node);
@@ -50,6 +47,6 @@ bool box_textarea_create_textarea(html_content *html,
* \param key keypress
* \return true iff keypress handled
*/
-bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key);
+bool box_textarea_keypress(struct html_content *html, struct box *box, uint32_t key);
#endif
diff --git a/render/font.c b/content/handlers/html/font.c
index 94ef877c7..7ebe16825 100644
--- a/render/font.c
+++ b/content/handlers/html/font.c
@@ -19,23 +19,23 @@
/**
* \file
*
- * Renderer internal font handling implementation.
+ * HTML internal font handling implementation.
*/
#include "utils/nsoption.h"
#include "netsurf/plot_style.h"
#include "css/utils.h"
-#include "render/font.h"
+#include "html/font.h"
/**
* Map a generic CSS font family to a generic plot font family
*
- * \param css Generic CSS font family
+ * \param css Generic CSS font family
* \return Plot font family
*/
-static plot_font_generic_family_t plot_font_generic_family(
- enum css_font_family_e css)
+static plot_font_generic_family_t
+plot_font_generic_family(enum css_font_family_e css)
{
plot_font_generic_family_t plot;
@@ -131,8 +131,10 @@ static plot_font_flags_t plot_font_flags(enum css_font_style_e style,
}
-/* exported function documented in render/font_internal.h */
-void font_plot_style_from_css(const css_computed_style *css,
+/* exported function documented in html/font.h */
+void font_plot_style_from_css(
+ const nscss_len_ctx *len_ctx,
+ const css_computed_style *css,
plot_font_style_t *fstyle)
{
lwc_string **families;
@@ -142,14 +144,15 @@ void font_plot_style_from_css(const css_computed_style *css,
fstyle->family = plot_font_generic_family(
css_computed_font_family(css, &families));
+ fstyle->families = families;
css_computed_font_size(css, &length, &unit);
- fstyle->size = FIXTOINT(FMUL(nscss_len2pt(length, unit),
- INTTOFIX(FONT_SIZE_SCALE)));
+ fstyle->size = FIXTOINT(FMUL(nscss_len2pt(len_ctx, length, unit),
+ INTTOFIX(PLOT_STYLE_SCALE)));
/* Clamp font size to configured minimum */
- if (fstyle->size < (nsoption_int(font_min_size) * FONT_SIZE_SCALE) / 10)
- fstyle->size = (nsoption_int(font_min_size) * FONT_SIZE_SCALE) / 10;
+ if (fstyle->size < (nsoption_int(font_min_size) * PLOT_STYLE_SCALE) / 10)
+ fstyle->size = (nsoption_int(font_min_size) * PLOT_STYLE_SCALE) / 10;
fstyle->weight = plot_font_weight(css_computed_font_weight(css));
fstyle->flags = plot_font_flags(css_computed_font_style(css),
diff --git a/render/font.h b/content/handlers/html/font.h
index fba368a97..5f69ee7d3 100644
--- a/render/font.h
+++ b/content/handlers/html/font.h
@@ -16,26 +16,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- *
+/**
+ * \file
* Internal font handling interfaces.
*
* These functions provide font related services. They all work on
* UTF-8 strings with lengths given.
*/
-#ifndef _NETSURF_RENDER_FONT_H_
-#define _NETSURF_RENDER_FONT_H_
+#ifndef NETSURF_HTML_FONT_H
+#define NETSURF_HTML_FONT_H
struct plot_font_style;
/**
* Populate a font style using data from a computed CSS style
*
- * \param css Computed style to consider
- * \param fstyle Font style to populate
+ * \param len_ctx Length conversion context
+ * \param css Computed style to consider
+ * \param fstyle Font style to populate
*/
-void font_plot_style_from_css(const css_computed_style *css,
+void font_plot_style_from_css(const nscss_len_ctx *len_ctx,
+ const css_computed_style *css,
struct plot_font_style *fstyle);
#endif
diff --git a/render/form.c b/content/handlers/html/form.c
index 6eb1b80b8..8ba99d4ab 100644
--- a/render/form.c
+++ b/content/handlers/html/form.c
@@ -52,12 +52,12 @@
#include "desktop/textarea.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/font.h"
-#include "render/form_internal.h"
-#include "render/html.h"
-#include "render/html_internal.h"
-#include "render/layout.h"
+#include "html/box.h"
+#include "html/font.h"
+#include "html/form_internal.h"
+#include "html/html.h"
+#include "html/html_internal.h"
+#include "html/layout.h"
#define MAX_SELECT_HEIGHT 210
#define SELECT_LINE_SPACING 0.2
@@ -96,9 +96,9 @@ static void form_select_menu_clicked(struct form_control *control,
static void form_select_menu_scroll_callback(void *client_data,
struct scrollbar_msg_data *scrollbar_data);
-/* exported interface documented in render/form_internal.h */
-struct form *form_new(void *node, const char *action, const char *target,
- form_method method, const char *charset,
+/* exported interface documented in html/form_internal.h */
+struct form *form_new(void *node, const char *action, const char *target,
+ form_method method, const char *charset,
const char *doc_charset)
{
struct form *form;
@@ -146,7 +146,7 @@ struct form *form_new(void *node, const char *action, const char *target,
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
void form_free(struct form *form)
{
struct form_control *c, *d;
@@ -165,7 +165,7 @@ void form_free(struct form *form)
free(form);
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
struct form_control *form_new_control(void *node, form_control_type type)
{
struct form_control *control;
@@ -218,7 +218,8 @@ void form_free_control(struct form_control *control)
struct form_control *c;
assert(control != NULL);
- LOG("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value);
+ NSLOG(netsurf, INFO, "Control:%p name:%p value:%p initial:%p",
+ control, control->name, control->value, control->initial_value);
free(control->name);
free(control->value);
free(control->initial_value);
@@ -229,7 +230,9 @@ void form_free_control(struct form_control *control)
for (option = control->data.select.items; option;
option = next) {
next = option->next;
- LOG("select option:%p text:%p value:%p", option, option->text, option->value);
+ NSLOG(netsurf, INFO,
+ "select option:%p text:%p value:%p", option,
+ option->text, option->value);
free(option->text);
free(option->value);
free(option);
@@ -324,7 +327,7 @@ bool form_add_option(struct form_control *control, char *value, char *text,
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
bool form_successful_controls_dom(struct form *_form,
struct form_control *_submit_button,
struct fetch_multipart_data **successful_controls)
@@ -344,11 +347,11 @@ bool form_successful_controls_dom(struct form *_form,
last_success = &sentinel;
sentinel.next = NULL;
-
+
/** \todo Replace this call with something DOMish */
charset = form_acceptable_charset(_form);
if (charset == NULL) {
- LOG("failed to find charset");
+ NSLOG(netsurf, INFO, "failed to find charset");
return false;
}
@@ -358,22 +361,22 @@ bool form_successful_controls_dom(struct form *_form,
form_encode_item(dom_string_data(i), dom_string_byte_length(i), \
charset, _form->document_charset) \
))
-
+
err = dom_html_form_element_get_elements(form, &form_elements);
-
+
if (err != DOM_NO_ERR) {
- LOG("Could not get form elements");
+ NSLOG(netsurf, INFO, "Could not get form elements");
goto dom_no_memory;
}
-
-
+
+
err = dom_html_collection_get_length(form_elements, &element_count);
-
+
if (err != DOM_NO_ERR) {
- LOG("Could not get form element count");
+ NSLOG(netsurf, INFO, "Could not get form element count");
goto dom_no_memory;
}
-
+
for (index = 0; index < element_count; index++) {
if (form_element != NULL) {
dom_node_unref(form_element);
@@ -402,7 +405,8 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_collection_item(form_elements,
index, &form_element);
if (err != DOM_NO_ERR) {
- LOG("Could not retrieve form element %d", index);
+ NSLOG(netsurf, INFO,
+ "Could not retrieve form element %d", index);
goto dom_no_memory;
}
@@ -414,7 +418,7 @@ bool form_successful_controls_dom(struct form *_form,
*/
err = dom_node_get_node_name(form_element, &nodename);
if (err != DOM_NO_ERR) {
- LOG("Could not get node name");
+ NSLOG(netsurf, INFO, "Could not get node name");
goto dom_no_memory;
}
@@ -423,14 +427,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_text_area_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get text area disabled property");
goto dom_no_memory;
}
err = dom_html_text_area_element_get_name(
(dom_html_text_area_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area name property");
+ NSLOG(netsurf, INFO,
+ "Could not get text area name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -438,14 +444,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get select disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get select disabled property");
goto dom_no_memory;
}
err = dom_html_select_element_get_name(
(dom_html_select_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get select name property");
+ NSLOG(netsurf, INFO,
+ "Could not get select name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_INPUT)) {
@@ -453,14 +461,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get input disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get input disabled property");
goto dom_no_memory;
}
err = dom_html_input_element_get_name(
(dom_html_input_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get input name property");
+ NSLOG(netsurf, INFO,
+ "Could not get input name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) {
@@ -468,34 +478,37 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get button disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get button disabled property");
goto dom_no_memory;
}
err = dom_html_button_element_get_name(
(dom_html_button_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get button name property");
+ NSLOG(netsurf, INFO,
+ "Could not get button name property");
goto dom_no_memory;
}
} else {
/* Unknown element type came through! */
- LOG("Unknown element type: %*s",
- (int)dom_string_byte_length(nodename),
- dom_string_data(nodename));
+ NSLOG(netsurf, INFO, "Unknown element type: %*s",
+ (int)dom_string_byte_length(nodename),
+ dom_string_data(nodename));
goto dom_no_memory;
}
if (element_disabled)
continue;
if (inputname == NULL)
continue;
-
+
if (dom_string_isequal(nodename, corestring_dom_TEXTAREA)) {
err = dom_html_text_area_element_get_value(
(dom_html_text_area_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area content");
+ NSLOG(netsurf, INFO,
+ "Could not get text area content");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -504,13 +517,15 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&options);
if (err != DOM_NO_ERR) {
- LOG("Could not get select options collection");
+ NSLOG(netsurf, INFO,
+ "Could not get select options collection");
goto dom_no_memory;
}
err = dom_html_options_collection_get_length(
options, &options_count);
if (err != DOM_NO_ERR) {
- LOG("Could not get select options collection length");
+ NSLOG(netsurf, INFO,
+ "Could not get select options collection length");
goto dom_no_memory;
}
for(option_index = 0; option_index < options_count;
@@ -527,14 +542,17 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_options_collection_item(
options, option_index, &option_element);
if (err != DOM_NO_ERR) {
- LOG("Could not get options item %d", option_index);
+ NSLOG(netsurf, INFO,
+ "Could not get options item %d",
+ option_index);
goto dom_no_memory;
}
err = dom_html_option_element_get_selected(
(dom_html_option_element *)option_element,
&selected);
if (err != DOM_NO_ERR) {
- LOG("Could not get option selected property");
+ NSLOG(netsurf, INFO,
+ "Could not get option selected property");
goto dom_no_memory;
}
if (!selected)
@@ -543,27 +561,31 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_option_element *)option_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get option value");
+ NSLOG(netsurf, INFO,
+ "Could not get option value");
goto dom_no_memory;
}
-
+
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG("Could not allocate data for option");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for option");
goto dom_no_memory;
}
-
+
last_success->next = success_new;
last_success = success_new;
-
+
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG("Could not encode name for option");
+ NSLOG(netsurf, INFO,
+ "Could not encode name for option");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG("Could not encode value for option");
+ NSLOG(netsurf, INFO,
+ "Could not encode value for option");
goto dom_no_memory;
}
}
@@ -573,7 +595,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG("Could not get button element type");
+ NSLOG(netsurf, INFO,
+ "Could not get button element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -593,7 +616,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get submit button value");
+ NSLOG(netsurf, INFO,
+ "Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report successful button */
@@ -610,7 +634,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element type");
+ NSLOG(netsurf, INFO,
+ "Could not get input element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -630,7 +655,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get submit button value");
+ NSLOG(netsurf, INFO,
+ "Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report the successful button */
@@ -642,67 +668,75 @@ bool form_successful_controls_dom(struct form *_form,
if ((dom_node *)submit_button !=
(dom_node *)form_element)
continue;
-
+
err = dom_node_get_user_data(
form_element,
corestring_dom___ns_key_image_coords_node_data,
&coords);
if (err != DOM_NO_ERR) {
- LOG("Could not get image XY data");
+ NSLOG(netsurf, INFO,
+ "Could not get image XY data");
goto dom_no_memory;
}
if (coords == NULL) {
- LOG("No XY data on the image input");
+ NSLOG(netsurf, INFO,
+ "No XY data on the image input");
goto dom_no_memory;
}
-
+
basename = ENCODE_ITEM(inputname);
-
+
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG("Could not allocate data for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for image.x");
goto dom_no_memory;
}
-
+
last_success->next = success_new;
last_success = success_new;
-
+
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG("Could not allocate name for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate name for image.x");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG("Could not allocate value for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate value for image.x");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.x", basename);
sprintf(success_new->value, "%d", coords->x);
-
+
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG("Could not allocate data for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for image.y");
goto dom_no_memory;
}
-
+
last_success->next = success_new;
last_success = success_new;
-
+
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG("Could not allocate name for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate name for image.y");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG("Could not allocate value for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate value for image.y");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.y", basename);
@@ -717,7 +751,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&checked);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element checked");
+ NSLOG(netsurf, INFO,
+ "Could not get input element checked");
goto dom_no_memory;
}
if (!checked)
@@ -726,7 +761,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element value");
+ NSLOG(netsurf, INFO,
+ "Could not get input element value");
goto dom_no_memory;
}
if (inputvalue == NULL) {
@@ -741,7 +777,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get file value");
+ NSLOG(netsurf, INFO,
+ "Could not get file value");
goto dom_no_memory;
}
err = dom_node_get_user_data(
@@ -749,14 +786,16 @@ bool form_successful_controls_dom(struct form *_form,
corestring_dom___ns_key_file_name_node_data,
&rawfile_temp);
if (err != DOM_NO_ERR) {
- LOG("Could not get file rawname");
+ NSLOG(netsurf, INFO,
+ "Could not get file rawname");
goto dom_no_memory;
}
rawfile_temp = strdup(rawfile_temp != NULL ?
rawfile_temp :
"");
if (rawfile_temp == NULL) {
- LOG("Could not copy file rawname");
+ NSLOG(netsurf, INFO,
+ "Could not copy file rawname");
goto dom_no_memory;
}
/* Fall out to the allocation */
@@ -765,7 +804,8 @@ bool form_successful_controls_dom(struct form *_form,
dom_string_caseless_isequal(
inputtype, corestring_dom_button)) {
/* Skip these */
- LOG("Skipping RESET and BUTTON");
+ NSLOG(netsurf, INFO,
+ "Skipping RESET and BUTTON");
continue;
} else {
/* Everything else is treated as text values */
@@ -773,30 +813,34 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get input value");
+ NSLOG(netsurf, INFO,
+ "Could not get input value");
goto dom_no_memory;
}
/* Fall out to the allocation */
}
}
-
+
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG("Could not allocate data for generic");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for generic");
goto dom_no_memory;
}
-
+
last_success->next = success_new;
last_success = success_new;
-
+
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG("Could not encode name for generic");
+ NSLOG(netsurf, INFO,
+ "Could not encode name for generic");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG("Could not encode value for generic");
+ NSLOG(netsurf, INFO,
+ "Could not encode value for generic");
goto dom_no_memory;
}
if (rawfile_temp != NULL) {
@@ -805,7 +849,7 @@ bool form_successful_controls_dom(struct form *_form,
rawfile_temp = NULL;
}
}
-
+
free(charset);
if (form_element != NULL) {
@@ -845,13 +889,13 @@ bool form_successful_controls_dom(struct form *_form,
}
*successful_controls = sentinel.next;
-
+
return true;
-
+
dom_no_memory:
free(charset);
fetch_multipart_data_destroy(sentinel.next);
-
+
if (form_elements != NULL)
dom_html_collection_unref(form_elements);
if (form_element != NULL)
@@ -870,7 +914,7 @@ dom_no_memory:
dom_string_unref(inputtype);
if (rawfile_temp != NULL)
free(rawfile_temp);
-
+
return false;
}
#undef ENCODE_ITEM
@@ -1047,7 +1091,7 @@ char *form_encode_item(const char *item, uint32_t len, const char *charset,
if (err == NSERROR_BAD_ENCODING) {
/* nope, try fallback charset (if any) */
if (fallback) {
- snprintf(cset, sizeof cset,
+ snprintf(cset, sizeof cset,
"%s//TRANSLIT", fallback);
err = utf8_to_enc(item, cset, 0, &ret);
@@ -1078,7 +1122,7 @@ char *form_encode_item(const char *item, uint32_t len, const char *charset,
return ret;
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
bool form_open_select_menu(void *client_data,
struct form_control *control,
select_menu_redraw_callback callback,
@@ -1089,6 +1133,7 @@ bool form_open_select_menu(void *client_data,
plot_font_style_t fstyle;
int total_height;
struct form_select_menu *menu;
+ html_content *html = (html_content *)c;
/* if the menu is opened for the first time */
@@ -1109,13 +1154,13 @@ bool form_open_select_menu(void *client_data,
box->border[LEFT].width +
box->padding[RIGHT] + box->padding[LEFT];
- font_plot_style_from_css(control->box->style,
+ font_plot_style_from_css(&html->len_ctx, control->box->style,
&fstyle);
menu->f_size = fstyle.size;
menu->line_height = FIXTOINT(FDIV((FMUL(FLTTOFIX(1.2),
FMUL(nscss_screen_dpi,
- INTTOFIX(fstyle.size / FONT_SIZE_SCALE)))),
+ INTTOFIX(fstyle.size / PLOT_STYLE_SCALE)))),
F_72));
line_height_with_spacing = menu->line_height +
@@ -1134,7 +1179,7 @@ bool form_open_select_menu(void *client_data,
menu->callback = callback;
if (scrollbar_create(false,
menu->height,
- total_height,
+ total_height,
menu->height,
control,
form_select_menu_scroll_callback,
@@ -1152,7 +1197,7 @@ bool form_open_select_menu(void *client_data,
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
void form_free_select_menu(struct form_control *control)
{
if (control->data.select.menu->scrollbar != NULL)
@@ -1162,12 +1207,11 @@ void form_free_select_menu(struct form_control *control)
}
-/* exported interface documented in render/form_internal.h */
+/* exported interface documented in html/form_internal.h */
bool form_redraw_select_menu(struct form_control *control, int x, int y,
float scale, const struct rect *clip,
const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
struct box *box;
struct form_select_menu *menu = control->data.select.menu;
struct form_option *option;
@@ -1181,26 +1225,28 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
int scroll;
int x_cp, y_cp;
struct rect r;
-
+ struct rect rect;
+ nserror res;
+
box = control->box;
-
+
x_cp = x;
y_cp = y;
width = menu->width;
height = menu->height;
line_height = menu->line_height;
-
+
line_height_with_spacing = line_height +
line_height * SELECT_LINE_SPACING;
scroll = scrollbar_get_offset(menu->scrollbar);
-
+
if (scale != 1.0) {
x *= scale;
y *= scale;
width *= scale;
height *= scale;
scrollbar_width *= scale;
-
+
i = scroll / line_height_with_spacing;
scroll -= i * line_height_with_spacing;
line_height *= scale;
@@ -1208,8 +1254,8 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
scroll *= scale;
scroll += i * line_height_with_spacing;
}
-
-
+
+
x0 = x;
y0 = y;
x1 = x + width - 1;
@@ -1220,12 +1266,20 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
r.y0 = y0;
r.x1 = x1 + 1;
r.y1 = y1 + 1;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
- if (!plot->rectangle(x0, y0, x1, y1 ,plot_style_stroke_darkwbasec))
+ }
+
+ rect.x0 = x0;
+ rect.y0 = y0;
+ rect.x1 = x1;
+ rect.y1 = y1;
+ res = ctx->plot->rectangle(ctx, plot_style_stroke_darkwbasec, &rect);
+ if (res != NSERROR_OK) {
return false;
-
-
+ }
+
x0 = x0 + SELECT_BORDER_WIDTH;
y0 = y0 + SELECT_BORDER_WIDTH;
x1 = x1 - SELECT_BORDER_WIDTH;
@@ -1236,14 +1290,19 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
r.y0 = y0;
r.x1 = x1 + 1;
r.y1 = y1 + 1;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
- if (!plot->rectangle(x0, y0, x1 + 1, y1 + 1,
- plot_style_fill_lightwbasec))
+ }
+
+ res = ctx->plot->rectangle(ctx, plot_style_fill_lightwbasec, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
+
option = control->data.select.items;
item_y = line_height_with_spacing;
-
+
while (item_y < scroll) {
option = option->next;
item_y += line_height_with_spacing;
@@ -1252,36 +1311,46 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
text_pos_offset = y - scroll +
(int) (line_height * (0.75 + SELECT_LINE_SPACING));
text_x = x + (box->border[LEFT].width + box->padding[LEFT]) * scale;
-
+
plot_fstyle_entry.size = menu->f_size;
-
+
while (option && item_y - scroll < height) {
-
- if (option->selected) {
- y2 = y + item_y - scroll;
- y3 = y + item_y + line_height_with_spacing - scroll;
- if (!plot->rectangle(x0, (y0 > y2 ? y0 : y2),
- scrollbar_x + 1,
- (y3 < y1 + 1 ? y3 : y1 + 1),
- &plot_style_fill_selected))
+
+ if (option->selected) {
+ y2 = y + item_y - scroll;
+ y3 = y + item_y + line_height_with_spacing - scroll;
+
+ rect.x0 = x0;
+ rect.y0 = y0 > y2 ? y0 : y2;
+ rect.x1 = scrollbar_x + 1;
+ rect.y1 = y3 < y1 + 1 ? y3 : y1 + 1;
+ res = ctx->plot->rectangle(ctx, &plot_style_fill_selected, &rect);
+ if (res != NSERROR_OK) {
return false;
- }
-
+ }
+ }
+
y2 = text_pos_offset + item_y;
- if (!plot->text(text_x, y2, option->text,
- strlen(option->text), &plot_fstyle_entry))
+ res = ctx->plot->text(ctx,
+ &plot_fstyle_entry,
+ text_x, y2,
+ option->text, strlen(option->text));
+ if (res != NSERROR_OK) {
return false;
-
+ }
+
item_y += line_height_with_spacing;
option = option->next;
}
-
- if (!scrollbar_redraw(menu->scrollbar,
- x_cp + menu->width - SCROLLBAR_WIDTH,
- y_cp,
- clip, scale, ctx))
+
+ res = scrollbar_redraw(menu->scrollbar,
+ x_cp + menu->width - SCROLLBAR_WIDTH,
+ y_cp,
+ clip, scale, ctx);
+ if (res != NSERROR_OK) {
return false;
-
+ }
+
return true;
}
@@ -1299,16 +1368,16 @@ bool form_clip_inside_select_menu(struct form_control *control, float scale,
{
struct form_select_menu *menu = control->data.select.menu;
int width, height;
-
+
width = menu->width;
height = menu->height;
-
+
if (scale != 1.0) {
width *= scale;
height *= scale;
}
-
+
if (clip->x0 >= 0 && clip->x1 <= width &&
clip->y0 >= 0 && clip->y1 <= height)
return true;
@@ -1440,26 +1509,26 @@ nserror form_control_bounding_rect(struct form_control *control, struct rect *r)
/**
* Handle a click on the area of the currently opened select menu.
- *
+ *
* \param control the select menu which received the click
* \param x X coordinate of click
* \param y Y coordinate of click
*/
void form_select_menu_clicked(struct form_control *control, int x, int y)
-{
+{
struct form_select_menu *menu = control->data.select.menu;
struct form_option *option;
html_content *html = (html_content *)menu->c;
- int line_height, line_height_with_spacing;
+ int line_height, line_height_with_spacing;
int item_bottom_y;
int scroll, i;
-
+
scroll = scrollbar_get_offset(menu->scrollbar);
-
+
line_height = menu->line_height;
line_height_with_spacing = line_height +
line_height * SELECT_LINE_SPACING;
-
+
option = control->data.select.items;
item_bottom_y = line_height_with_spacing;
i = 0;
@@ -1468,11 +1537,11 @@ void form_select_menu_clicked(struct form_control *control, int x, int y)
option = option->next;
i++;
}
-
+
if (option != NULL) {
form__select_process_selection(html, control, i);
}
-
+
menu->callback(menu->client_data, 0, 0, menu->width, menu->height);
}
@@ -1484,7 +1553,7 @@ void form_select_menu_clicked(struct form_control *control, int x, int y)
* \param x X coordinate of click
* \param y Y coordinate of click
* \return text for the browser status bar or NULL if the menu has
- * to be closed
+ * to be closed
*/
const char *form_select_mouse_action(struct form_control *control,
browser_mouse_state mouse, int x, int y)
@@ -1493,13 +1562,13 @@ const char *form_select_mouse_action(struct form_control *control,
int x0, y0, x1, y1, scrollbar_x;
const char *status = NULL;
bool multiple = control->data.select.multiple;
-
+
x0 = 0;
y0 = 0;
x1 = menu->width;
y1 = menu->height;
scrollbar_x = x1 - SCROLLBAR_WIDTH;
-
+
if (menu->scroll_capture ||
(x > scrollbar_x && x < x1 && y > y0 && y < y1)) {
/* The scroll is currently capturing all events or the mouse
@@ -1510,25 +1579,25 @@ const char *form_select_mouse_action(struct form_control *control,
scrollbar_mouse_action(menu->scrollbar,
mouse, x, y));
}
-
-
+
+
if (x > x0 && x < scrollbar_x && y > y0 && y < y1) {
/* over option area */
-
+
if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2))
/* button 1 or 2 click */
form_select_menu_clicked(control, x, y);
-
+
if (!(mouse & BROWSER_MOUSE_CLICK_1 && !multiple))
/* anything but a button 1 click over a single select
menu */
status = messages_get(control->data.select.multiple ?
"SelectMClick" : "SelectClick");
-
+
} else if (!(mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)))
/* if not a button 1 or 2 click*/
status = messages_get("SelectClose");
-
+
return status;
}
@@ -1565,13 +1634,13 @@ void form_select_mouse_drag_end(struct form_control *control,
scrollbar_mouse_drag_end(menu->scrollbar, mouse, x, y);
return;
}
-
+
x0 = 0;
y0 = 0;
x1 = menu->width;
y1 = menu->height;
-
-
+
+
if (x > x0 && x < x1 - SCROLLBAR_WIDTH && y > y0 && y < y1)
/* handle drag end above the option area like a regular click */
form_select_menu_clicked(control, x, y);
@@ -1586,13 +1655,13 @@ void form_select_menu_scroll_callback(void *client_data,
struct form_control *control = client_data;
struct form_select_menu *menu = control->data.select.menu;
html_content *html = (html_content *)menu->c;
-
+
switch (scrollbar_data->msg) {
case SCROLLBAR_MSG_MOVED:
menu->callback(menu->client_data,
- 0, 0,
+ 0, 0,
menu->width,
- menu->height);
+ menu->height);
break;
case SCROLLBAR_MSG_SCROLL_START:
{
@@ -1643,10 +1712,10 @@ void form_select_menu_callback(void *client_data,
html_content *html = client_data;
int menu_x, menu_y;
struct box *box;
-
+
box = html->visible_select_menu->box;
box_coords(box, &menu_x, &menu_y);
-
+
menu_x -= box->border[LEFT].width;
menu_y += box->height + box->border[BOTTOM].width +
box->padding[BOTTOM] +
@@ -1733,7 +1802,7 @@ void form_submit(nsurl *page_url, struct browser_window *target,
}
/* Replace query segment */
- error = nsurl_replace_query(action_url, data, &action_query);
+ error = nsurl_replace_query(action_url, data, &action_query);
if (error != NSERROR_OK) {
nsurl_unref(action_query);
free(data);
@@ -1773,12 +1842,12 @@ void form_submit(nsurl *page_url, struct browser_window *target,
break;
case method_POST_MULTIPART:
- browser_window_navigate(target,
- action_url,
+ browser_window_navigate(target,
+ action_url,
page_url,
BW_NAVIGATE_HISTORY,
- NULL,
- success,
+ NULL,
+ success,
NULL);
break;
diff --git a/render/form_internal.h b/content/handlers/html/form_internal.h
index 0ffb6b46c..a77e823b3 100644
--- a/render/form_internal.h
+++ b/content/handlers/html/form_internal.h
@@ -18,11 +18,11 @@
/**
* \file
- * Interface to form handling functions internal to render.
+ * Interface to form handling functions internal to HTML content handler.
*/
-#ifndef _NETSURF_RENDER_FORM_INTERNAL_H_
-#define _NETSURF_RENDER_FORM_INTERNAL_H_
+#ifndef NETSURF_HTML_FORM_INTERNAL_H
+#define NETSURF_HTML_FORM_INTERNAL_H
#include <stdbool.h>
@@ -229,7 +229,7 @@ bool form_successful_controls_dom(struct form *form,
bool form_open_select_menu(void *client_data,
struct form_control *control,
select_menu_redraw_callback redraw_callback,
- struct content *c);
+ struct content *c);
void form_select_menu_callback(void *client_data,
diff --git a/render/html.c b/content/handlers/html/html.c
index 6f7ad6249..f721b98ab 100644
--- a/render/html.c
+++ b/content/handlers/html/html.c
@@ -19,7 +19,7 @@
/**
* \file
- * Content for text/html (implementation).
+ * Implementation of HTML content handling.
*/
#include <assert.h>
@@ -54,12 +54,14 @@
#include "javascript/js.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
-#include "render/imagemap.h"
-#include "render/layout.h"
-#include "render/search.h"
+#include "html/html.h"
+#include "html/html_save.h"
+#include "html/html_internal.h"
+#include "html/box.h"
+#include "html/form_internal.h"
+#include "html/imagemap.h"
+#include "html/layout.h"
+#include "html/search.h"
#define CHUNK 4096
@@ -89,8 +91,8 @@ bool fire_dom_event(dom_string *type, dom_node *target,
dom_event_unref(evt);
return false;
}
- LOG("Dispatching '%*s' against %p",
- dom_string_length(type), dom_string_data(type), target);
+ NSLOG(netsurf, INFO, "Dispatching '%*s' against %p",
+ dom_string_length(type), dom_string_data(type), target);
exc = dom_event_target_dispatch_event(target, evt, &result);
if (exc != DOM_NO_ERR) {
result = false;
@@ -111,7 +113,7 @@ static void html_box_convert_done(html_content *c, bool success)
dom_exception exc; /* returned by libdom functions */
dom_node *html;
- LOG("Done XML to box (%p)", c);
+ NSLOG(netsurf, INFO, "Done XML to box (%p)", c);
/* Clean up and report error if unsuccessful or aborted */
if ((success == false) || (c->aborted)) {
@@ -139,9 +141,9 @@ static void html_box_convert_done(html_content *c, bool success)
exc = dom_document_get_document_element(c->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
/** @todo should this call html_object_free_objects(c);
- * like the other error paths
+ * like the other error paths
*/
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&c->base, NSERROR_DOM);
content_set_error(&c->base);
return;
@@ -150,7 +152,7 @@ static void html_box_convert_done(html_content *c, bool success)
/* extract image maps - can't do this sensibly in dom_to_box */
err = imagemap_extract(c);
if (err != NSERROR_OK) {
- LOG("imagemap extraction failed");
+ NSLOG(netsurf, INFO, "imagemap extraction failed");
html_object_free_objects(c);
content_broadcast_errorcode(&c->base, err);
content_set_error(&c->base);
@@ -443,7 +445,7 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
c->base.refresh = nsurl_ref(
content_get_url(&c->base));
- content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_REFRESH, &msg_data);
return NSERROR_OK;
}
@@ -522,7 +524,8 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
c->base.refresh = nsurl;
- content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_REFRESH,
+ &msg_data);
c->refresh = true;
}
@@ -567,7 +570,7 @@ static bool html_process_img(html_content *c, dom_node *node)
return success;
}
-/* exported function documented in render/html_internal.h */
+/* exported function documented in html/html_internal.h */
void html_finish_conversion(html_content *htmlc)
{
union content_msg_data msg_data;
@@ -600,14 +603,14 @@ void html_finish_conversion(html_content *htmlc)
}
/* convert dom tree to box tree */
- LOG("DOM to box (%p)", htmlc);
+ NSLOG(netsurf, INFO, "DOM to box (%p)", htmlc);
content_set_status(&htmlc->base, messages_get("Processing"));
msg_data.explicit_status_text = NULL;
- content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, &msg_data);
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
content_set_error(&htmlc->base);
return;
@@ -615,7 +618,7 @@ void html_finish_conversion(html_content *htmlc)
error = dom_to_box(html, htmlc, html_box_convert_done);
if (error != NSERROR_OK) {
- LOG("box conversion failed");
+ NSLOG(netsurf, INFO, "box conversion failed");
dom_node_unref(html);
html_object_free_objects(htmlc);
content_broadcast_errorcode(&htmlc->base, error);
@@ -685,9 +688,11 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
msg_data.jscontext = &htmlc->jscontext;
content_broadcast(&htmlc->base,
CONTENT_MSG_GETCTX,
- msg_data);
- LOG("javascript context: %p",
- htmlc->jscontext);
+ &msg_data);
+ NSLOG(netsurf, INFO,
+ "javascript context: %p (htmlc: %p)",
+ htmlc->jscontext,
+ htmlc);
}
if (htmlc->jscontext != NULL) {
js_handle_new_element(htmlc->jscontext,
@@ -705,7 +710,6 @@ dom_default_action_DOMSubtreeModified_cb(struct dom_event *evt, void *pw)
{
dom_event_target *node;
dom_node_type type;
- dom_string *name;
dom_exception exc;
html_content *htmlc = pw;
@@ -721,16 +725,19 @@ dom_default_action_DOMSubtreeModified_cb(struct dom_event *evt, void *pw)
exc = dom_node_get_node_type(node, &type);
if ((exc == DOM_NO_ERR) && (type == DOM_ELEMENT_NODE)) {
/* an element node has been modified */
- exc = dom_node_get_node_name(node, &name);
- if ((exc == DOM_NO_ERR) && (name != NULL)) {
+ dom_html_element_type tag_type;
- if (dom_string_caseless_isequal(name,
- corestring_dom_style)) {
- html_css_update_style(htmlc,
- (dom_node *)node);
- }
+ exc = dom_html_element_get_tag_type(node, &tag_type);
+ if (exc != DOM_NO_ERR) {
+ tag_type = DOM_HTML_ELEMENT_TYPE__UNKNOWN;
+ }
- dom_string_unref(name);
+ switch (tag_type) {
+ case DOM_HTML_ELEMENT_TYPE_STYLE:
+ html_css_update_style(htmlc, (dom_node *)node);
+ break;
+ default:
+ break;
}
}
dom_node_unref(node);
@@ -764,7 +771,7 @@ dom_event_fetcher(dom_string *type,
dom_default_action_phase phase,
void **pw)
{
- //LOG("type:%s", dom_string_data(type));
+ NSLOG(netsurf, DEEPDEBUG, "type:%s", dom_string_data(type));
if (phase == DOM_DEFAULT_ACTION_END) {
if (dom_string_isequal(type, corestring_dom_DOMNodeInserted)) {
@@ -791,22 +798,22 @@ html_document_user_data_handler(dom_node_operation operation,
switch (operation) {
case DOM_NODE_CLONED:
- LOG("Cloned");
+ NSLOG(netsurf, INFO, "Cloned");
break;
case DOM_NODE_RENAMED:
- LOG("Renamed");
+ NSLOG(netsurf, INFO, "Renamed");
break;
case DOM_NODE_IMPORTED:
- LOG("imported");
+ NSLOG(netsurf, INFO, "imported");
break;
case DOM_NODE_ADOPTED:
- LOG("Adopted");
+ NSLOG(netsurf, INFO, "Adopted");
break;
case DOM_NODE_DELETED:
/* This is the only path I expect */
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -931,7 +938,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
lwc_string_unref(c->universal);
c->universal = NULL;
- LOG("Unable to set user data.");
+ NSLOG(netsurf, INFO, "Unable to set user data.");
return NSERROR_DOM;
}
@@ -993,8 +1000,8 @@ html_create(const content_handler *handler,
static nserror
-html_process_encoding_change(struct content *c,
- const char *data,
+html_process_encoding_change(struct content *c,
+ const char *data,
unsigned int size)
{
html_content *html = (html_content *) c;
@@ -1005,7 +1012,7 @@ html_process_encoding_change(struct content *c,
unsigned long source_size;
/* Retrieve new encoding */
- encoding = dom_hubbub_parser_get_encoding(html->parser,
+ encoding = dom_hubbub_parser_get_encoding(html->parser,
&html->encoding_source);
if (encoding == NULL) {
return NSERROR_NOMEM;
@@ -1065,10 +1072,10 @@ html_process_encoding_change(struct content *c,
/* Reprocess all the data. This is safe because
* the encoding is now specified at parser start which means
- * it cannot be changed again.
+ * it cannot be changed again.
*/
- error = dom_hubbub_parser_parse_chunk(html->parser,
- (const uint8_t *)source_data,
+ error = dom_hubbub_parser_parse_chunk(html->parser,
+ (const uint8_t *)source_data,
source_size);
return libdom_hubbub_error_to_nserror(error);
@@ -1086,8 +1093,8 @@ html_process_data(struct content *c, const char *data, unsigned int size)
dom_hubbub_error dom_ret;
nserror err = NSERROR_OK; /* assume its all going to be ok */
- dom_ret = dom_hubbub_parser_parse_chunk(html->parser,
- (const uint8_t *) data,
+ dom_ret = dom_hubbub_parser_parse_chunk(html->parser,
+ (const uint8_t *) data,
size);
err = libdom_hubbub_error_to_nserror(dom_ret);
@@ -1103,7 +1110,7 @@ html_process_data(struct content *c, const char *data, unsigned int size)
return false;
}
- return true;
+ return true;
}
@@ -1138,11 +1145,11 @@ static bool html_convert(struct content *c)
exc = dom_document_get_quirks_mode(htmlc->document, &htmlc->quirks);
if (exc == DOM_NO_ERR) {
html_css_quirks_stylesheets(htmlc);
- LOG("quirks set to %d", htmlc->quirks);
+ NSLOG(netsurf, INFO, "quirks set to %d", htmlc->quirks);
}
htmlc->base.active--; /* the html fetch is no longer active */
- LOG("%d fetches active", htmlc->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active (%p)", htmlc->base.active, c);
/* The parse cannot be completed here because it may be paused
* untill all the resources being fetched have completed.
@@ -1183,25 +1190,25 @@ html_begin_conversion(html_content *htmlc)
dom_string *node_name = NULL;
dom_hubbub_error error;
- /* The act of completing the parse can result in additional data
- * being flushed through the parser. This may result in new style or
- * script nodes, upon which the conversion depends. Thus, once we
- * have completed the parse, we must check again to see if we can
- * begin the conversion. If we can't, we must stop and wait for the
+ /* The act of completing the parse can result in additional data
+ * being flushed through the parser. This may result in new style or
+ * script nodes, upon which the conversion depends. Thus, once we
+ * have completed the parse, we must check again to see if we can
+ * begin the conversion. If we can't, we must stop and wait for the
* new styles/scripts to be processed. Once they have been processed,
- * we will be called again to begin the conversion for real. Thus,
- * we must also ensure that we don't attempt to complete the parse
+ * we will be called again to begin the conversion for real. Thus,
+ * we must also ensure that we don't attempt to complete the parse
* multiple times, so store a flag to indicate that parsing is
* complete to avoid repeating the completion pointlessly.
*/
if (htmlc->parse_completed == false) {
- LOG("Completing parse");
+ NSLOG(netsurf, INFO, "Completing parse (%p)", htmlc);
/* complete parsing */
error = dom_hubbub_parser_completed(htmlc->parser);
if (error != DOM_HUBBUB_OK) {
- LOG("Parsing failed");
-
- content_broadcast_errorcode(&htmlc->base,
+ NSLOG(netsurf, INFO, "Parsing failed");
+
+ content_broadcast_errorcode(&htmlc->base,
libdom_hubbub_error_to_nserror(error));
return false;
@@ -1210,12 +1217,16 @@ html_begin_conversion(html_content *htmlc)
}
if (html_can_begin_conversion(htmlc) == false) {
+ NSLOG(netsurf, INFO, "Can't begin conversion (%p)", htmlc);
/* We can't proceed (see commentary above) */
return true;
}
/* Give up processing if we've been aborted */
if (htmlc->aborted) {
+ NSLOG(netsurf, INFO, "Conversion aborted (%p) (active: %u)",
+ htmlc, htmlc->base.active);
+ content_set_error(&htmlc->base);
content_broadcast_errorcode(&htmlc->base, NSERROR_STOPPED);
return false;
}
@@ -1234,14 +1245,14 @@ html_begin_conversion(html_content *htmlc)
encoding = dom_hubbub_parser_get_encoding(htmlc->parser,
&htmlc->encoding_source);
if (encoding == NULL) {
- content_broadcast_errorcode(&htmlc->base,
+ content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
return false;
}
htmlc->encoding = strdup(encoding);
if (htmlc->encoding == NULL) {
- content_broadcast_errorcode(&htmlc->base,
+ content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
return false;
}
@@ -1250,7 +1261,7 @@ html_begin_conversion(html_content *htmlc)
/* locate root element and ensure it is html */
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
return false;
}
@@ -1259,8 +1270,8 @@ html_begin_conversion(html_content *htmlc)
if ((exc != DOM_NO_ERR) ||
(node_name == NULL) ||
(!dom_string_caseless_lwc_isequal(node_name,
- corestring_lwc_html))) {
- LOG("root element not html");
+ corestring_lwc_html))) {
+ NSLOG(netsurf, INFO, "root element not html");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
dom_node_unref(html);
return false;
@@ -1278,11 +1289,11 @@ html_begin_conversion(html_content *htmlc)
/* HTML5 4.10.22.3 step 9 */
nsurl *doc_addr = content_get_url(&htmlc->base);
ns_error = nsurl_join(htmlc->base_url,
- nsurl_access(doc_addr),
+ nsurl_access(doc_addr),
&action);
} else {
- ns_error = nsurl_join(htmlc->base_url,
- f->action,
+ ns_error = nsurl_join(htmlc->base_url,
+ f->action,
&action);
}
@@ -1297,7 +1308,7 @@ html_begin_conversion(html_content *htmlc)
f->action = strdup(nsurl_access(action));
nsurl_unref(action);
if (f->action == NULL) {
- content_broadcast_errorcode(&htmlc->base,
+ content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
dom_node_unref(html);
@@ -1308,7 +1319,7 @@ html_begin_conversion(html_content *htmlc)
if (f->document_charset == NULL) {
f->document_charset = strdup(htmlc->encoding);
if (f->document_charset == NULL) {
- content_broadcast_errorcode(&htmlc->base,
+ content_broadcast_errorcode(&htmlc->base,
NSERROR_NOMEM);
dom_node_unref(html);
return false;
@@ -1354,7 +1365,7 @@ static void html_stop(struct content *c)
html_object_abort_objects(htmlc);
/* If there are no further active fetches and we're still
- * in the READY state, transition to the DONE state. */
+ * in the READY state, transition to the DONE state. */
if (c->status == CONTENT_STATUS_READY && c->active == 0) {
content_set_done(c);
}
@@ -1366,7 +1377,8 @@ static void html_stop(struct content *c)
break;
default:
- LOG("Unexpected status %d", c->status);
+ NSLOG(netsurf, INFO, "Unexpected status %d (%p)", c->status,
+ c);
assert(0);
}
}
@@ -1388,6 +1400,10 @@ static void html_reformat(struct content *c, int width, int height)
htmlc->reflowing = true;
+ htmlc->len_ctx.vw = width;
+ htmlc->len_ctx.vh = height;
+ htmlc->len_ctx.root_style = htmlc->layout->style;
+
layout_document(htmlc, width, height);
layout = htmlc->layout;
@@ -1479,8 +1495,8 @@ static void html_destroy_frameset(struct content_html_frames *frameset)
nsurl_unref(frameset->children[i].url);
frameset->children[i].url = NULL;
}
- if (frameset->children[i].children)
- html_destroy_frameset(&frameset->children[i]);
+ if (frameset->children[i].children)
+ html_destroy_frameset(&frameset->children[i]);
}
talloc_free(frameset->children);
frameset->children = NULL;
@@ -1508,7 +1524,7 @@ static void html_free_layout(html_content *htmlc)
{
if (htmlc->bctx != NULL) {
/* freeing talloc context should let the entire box
- * set be destroyed
+ * set be destroyed
*/
talloc_free(htmlc->bctx);
}
@@ -1523,7 +1539,7 @@ static void html_destroy(struct content *c)
html_content *html = (html_content *) c;
struct form *f, *g;
- LOG("content %p", c);
+ NSLOG(netsurf, INFO, "content %p", c);
/* Destroy forms */
for (f = html->forms; f != NULL; f = g) {
@@ -1563,8 +1579,8 @@ static void html_destroy(struct content *c)
/* Free base target */
if (html->base_target != NULL) {
- free(html->base_target);
- html->base_target = NULL;
+ free(html->base_target);
+ html->base_target = NULL;
}
/* Free frameset */
@@ -1637,7 +1653,7 @@ html_open(struct content *c,
html->drag_owner.no_owner = true;
/* text selection */
- selection_init(&html->sel, html->layout);
+ selection_init(&html->sel, html->layout, &html->len_ctx);
html->selection_type = HTML_SELECTION_NONE;
html->selection_owner.none = true;
@@ -1758,7 +1774,8 @@ html_get_contextual_content(struct content *c, int x, int y,
struct box *next;
int box_x = 0, box_y = 0;
- while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
+ while ((next = box_at_point(&html->len_ctx, box, x, y,
+ &box_x, &box_y)) != NULL) {
box = next;
/* hidden boxes are ignored */
@@ -1835,7 +1852,8 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry)
/* TODO: invert order; visit deepest box first */
- while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
+ while ((next = box_at_point(&html->len_ctx, box, x, y,
+ &box_x, &box_y)) != NULL) {
box = next;
if (box->style && css_computed_visibility(box->style) ==
@@ -1912,7 +1930,7 @@ static void html__dom_user_data_handler(dom_node_operation operation,
free(data);
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -1928,11 +1946,12 @@ static void html__set_file_gadget_filename(struct content *c,
ret = guit->utf8->local_to_utf8(fn, 0, &utf8_fn);
if (ret != NSERROR_OK) {
assert(ret != NSERROR_BAD_ENCODING);
- LOG("utf8 to local encoding conversion failed");
+ NSLOG(netsurf, INFO,
+ "utf8 to local encoding conversion failed");
/* Load was for us - just no memory */
- return;
+ return;
}
-
+
form_gadget_update_value(gadget, utf8_fn);
/* corestring_dom___ns_key_file_name_node_data */
@@ -1945,7 +1964,7 @@ static void html__set_file_gadget_filename(struct content *c,
}
/* Redraw box. */
- html__redraw_a_box(html, file_box);
+ html__redraw_a_box(html, file_box);
}
void html_set_file_gadget_filename(struct hlcache_handle *hl,
@@ -1976,7 +1995,8 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
int box_x = 0, box_y = 0;
/* Scan box tree for boxes that can handle drop */
- while ((next = box_at_point(box, x, y, &box_x, &box_y)) != NULL) {
+ while ((next = box_at_point(&html->len_ctx, box, x, y,
+ &box_x, &box_y)) != NULL) {
box = next;
if (box->style && css_computed_visibility(box->style) ==
@@ -2080,7 +2100,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
if (ret != NSERROR_OK) {
/* bad encoding shouldn't happen */
assert(ret != NSERROR_BAD_ENCODING);
- LOG("local to utf8 encoding failed");
+ NSLOG(netsurf, INFO, "local to utf8 encoding failed");
free(buffer);
guit->misc->warning("NoMemory", NULL);
return true;
@@ -2146,19 +2166,19 @@ html_debug_dump(struct content *c, FILE *f, enum content_debug op)
ret = NSERROR_OK;
} else {
if (htmlc->document == NULL) {
- LOG("No document to dump");
+ NSLOG(netsurf, INFO, "No document to dump");
return NSERROR_DOM;
}
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("Unable to obtain root node");
+ NSLOG(netsurf, INFO, "Unable to obtain root node");
return NSERROR_DOM;
}
ret = libdom_dump_structure(html, f, 0);
- LOG("DOM structure dump returning %d", ret);
+ NSLOG(netsurf, INFO, "DOM structure dump returning %d", ret);
dom_node_unref(html);
}
@@ -2242,7 +2262,8 @@ dom_document *html_get_document(hlcache_handle *h)
* \param h HTML content to retrieve tree from
* \return Pointer to box tree
*
- * \todo This API must die, as must all use of the box tree outside render/
+ * \todo This API must die, as must all use of the box tree outside of
+ * HTML content handler
*/
struct box *html_get_box_tree(hlcache_handle *h)
{
diff --git a/render/html.h b/content/handlers/html/html.h
index b8429fd17..8d1c77992 100644
--- a/render/html.h
+++ b/content/handlers/html/html.h
@@ -16,20 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Content for text/html (interface).
+/**
+ * \file
+ * Interface to text/html content handler.
*
* These functions should in general be called via the content interface.
*/
-#ifndef _NETSURF_RENDER_HTML_H_
-#define _NETSURF_RENDER_HTML_H_
+#ifndef NETSURF_HTML_HTML_H
+#define NETSURF_HTML_HTML_H
#include <stdbool.h>
-#include <dom/dom.h>
-#include <dom/bindings/hubbub/parser.h>
-
#include "netsurf/types.h"
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
@@ -64,6 +62,7 @@ struct html_stylesheet {
bool unused;
};
+
/**
* Container for scripts used by an HTML document
*/
@@ -88,7 +87,9 @@ struct html_script {
};
-/** An object (<img>, <object>, etc.) in a CONTENT_HTML document. */
+/**
+ * An object (img, object, etc. tag) in a CONTENT_HTML document.
+ */
struct content_html_object {
struct content *parent; /**< Parent document */
struct content_html_object *next; /**< Next in chain */
@@ -100,12 +101,10 @@ struct content_html_object {
bool background; /**< This object is a background image. */
};
-struct html_scrollbar_data {
- struct content *c;
- struct box *box;
-};
-/** Frame tree (<frameset>, <frame>) */
+/**
+ * Frame tree (frameset or frame tag)
+ */
struct content_html_frames {
int cols; /** number of columns in frameset */
int rows; /** number of rows in frameset */
@@ -126,9 +125,11 @@ struct content_html_frames {
struct content_html_frames *children; /** [cols * rows] children */
};
-/** Inline frame list (<iframe>) */
+/**
+ * Inline frame list (iframe tag)
+ */
struct content_html_iframe {
- struct box *box;
+ struct box *box;
int margin_width; /** frame margin width */
int margin_height; /** frame margin height */
@@ -140,7 +141,7 @@ struct content_html_iframe {
bool border; /** frame has a border */
colour border_colour; /** frame border colour */
- struct content_html_iframe *next;
+ struct content_html_iframe *next;
};
/* entries in stylesheet_content */
@@ -150,32 +151,46 @@ struct content_html_iframe {
#define STYLESHEET_USER 3 /* user stylesheet */
#define STYLESHEET_START 4 /* start of document stylesheets */
+/**
+ * initialise content handler
+ *
+ * \return NSERROR_OK on success otherwise appropriate error code
+ */
nserror html_init(void);
+/**
+ * redraw a specific box
+ *
+ * used by core browser
+ */
void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
-void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
- browser_mouse_state mouse, int x, int y);
-
-bool text_redraw(const char *utf8_text, size_t utf8_len,
- size_t offset, int space,
- const struct plot_font_style *fstyle,
- int x, int y,
- const struct rect *clip,
- int height,
- float scale,
- bool excluded,
- struct content *c,
- const struct selection *sel,
- struct search_context *search,
- const struct redraw_context *ctx);
-
-dom_document *html_get_document(struct hlcache_handle *h);
-struct box *html_get_box_tree(struct hlcache_handle *h);
+/**
+ * obtain html frame content from handle
+ *
+ * used by core browser
+ */
struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
+
+/**
+ * obtain html iframe content from handle
+ *
+ * used by core browser
+ */
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
-struct nsurl *html_get_base_url(struct hlcache_handle *h);
+
+/**
+ * obtain html base target from handle
+ *
+ * used by core browser
+ */
const char *html_get_base_target(struct hlcache_handle *h);
+
+/**
+ * set filename on a file gadget
+ *
+ * used by core browser
+ */
void html_set_file_gadget_filename(struct hlcache_handle *hl,
struct form_control *gadget, const char *fn);
@@ -189,8 +204,19 @@ void html_set_file_gadget_filename(struct hlcache_handle *hl,
struct html_stylesheet *html_get_stylesheets(struct hlcache_handle *h,
unsigned int *n);
+/**
+ * Retrieve objects used by HTML document
+ *
+ * \param h Content to retrieve objects from
+ * \param n Pointer to location to receive number of objects
+ * \return Pointer to array of objects
+ */
struct content_html_object *html_get_objects(struct hlcache_handle *h,
unsigned int *n);
+
+/**
+ * get the offset within the docuemnt of a fragment id
+ */
bool html_get_id_offset(struct hlcache_handle *h, lwc_string *frag_id,
int *x, int *y);
diff --git a/render/html_css.c b/content/handlers/html/html_css.c
index 4d5469361..7b2d469c4 100644
--- a/render/html_css.c
+++ b/content/handlers/html/html_css.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Processing for html content css operations.
*/
@@ -37,7 +38,8 @@
#include "css/css.h"
#include "desktop/gui_internal.h"
-#include "render/html_internal.h"
+#include "html/html.h"
+#include "html/html_internal.h"
static nsurl *html_default_stylesheet_url;
static nsurl *html_adblock_stylesheet_url;
@@ -103,17 +105,23 @@ html_convert_css_callback(hlcache_handle *css,
switch (event->type) {
case CONTENT_MSG_DONE:
- LOG("done stylesheet slot %d '%s'", i, nsurl_access(hlcache_handle_get_url(css)));
+ NSLOG(netsurf, INFO, "done stylesheet slot %d '%s'", i,
+ nsurl_access(hlcache_handle_get_url(css)));
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
break;
case CONTENT_MSG_ERROR:
- LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
+ NSLOG(netsurf, INFO, "stylesheet %s failed: %s",
+ nsurl_access(hlcache_handle_get_url(css)),
+ event->data.error);
+ /* fall through */
+
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(css);
s->sheet = NULL;
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
content_add_error(&parent->base, "?", 0);
break;
@@ -150,7 +158,7 @@ html_stylesheet_from_domnode(html_content *c,
exc = dom_node_get_text_content(node, &style);
if ((exc != DOM_NO_ERR) || (style == NULL)) {
- LOG("No text content");
+ NSLOG(netsurf, INFO, "No text content");
return NSERROR_OK;
}
@@ -181,7 +189,7 @@ html_stylesheet_from_domnode(html_content *c,
nsurl_unref(url);
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
return NSERROR_OK;
}
@@ -253,13 +261,14 @@ static bool html_css_process_modified_style(html_content *c,
error = html_stylesheet_from_domnode(c, s->node, &sheet);
if (error != NSERROR_OK) {
- LOG("Failed to update sheet");
+ NSLOG(netsurf, INFO, "Failed to update sheet");
content_broadcast_errorcode(&c->base, error);
return false;
}
if (sheet != NULL) {
- LOG("Updating sheet %p with %p", s->sheet, sheet);
+ NSLOG(netsurf, INFO, "Updating sheet %p with %p", s->sheet,
+ sheet);
if (s->sheet != NULL) {
switch (content_get_status(s->sheet)) {
@@ -268,7 +277,8 @@ static bool html_css_process_modified_style(html_content *c,
default:
hlcache_handle_abort(s->sheet);
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
}
hlcache_handle_release(s->sheet);
}
@@ -313,7 +323,9 @@ bool html_css_update_style(html_content *c, dom_node *style)
s = html_create_style_element(c, style);
}
if (s == NULL) {
- LOG("Could not find or create inline stylesheet for %p", style);
+ NSLOG(netsurf, INFO,
+ "Could not find or create inline stylesheet for %p",
+ style);
return false;
}
@@ -417,7 +429,8 @@ bool html_css_process_link(html_content *htmlc, dom_node *node)
}
dom_string_unref(href);
- LOG("linked stylesheet %i '%s'", htmlc->stylesheet_count, nsurl_access(joined));
+ NSLOG(netsurf, INFO, "linked stylesheet %i '%s'",
+ htmlc->stylesheet_count, nsurl_access(joined));
/* extend stylesheets array to allow for new sheet */
stylesheets = realloc(htmlc->stylesheets,
@@ -452,7 +465,7 @@ bool html_css_process_link(html_content *htmlc, dom_node *node)
htmlc->stylesheet_count++;
htmlc->base.active++;
- LOG("%d fetches active", htmlc->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", htmlc->base.active);
return true;
@@ -461,7 +474,7 @@ no_memory:
return false;
}
-/* exported interface documented in render/html.h */
+/* exported interface documented in html/html.h */
struct html_stylesheet *html_get_stylesheets(hlcache_handle *h, unsigned int *n)
{
html_content *c = (html_content *) hlcache_handle_get_content(h);
@@ -475,7 +488,7 @@ struct html_stylesheet *html_get_stylesheets(hlcache_handle *h, unsigned int *n)
}
-/* exported interface documented in render/html_internal.h */
+/* exported interface documented in html/html_internal.h */
nserror html_css_free_stylesheets(html_content *html)
{
unsigned int i;
@@ -495,7 +508,7 @@ nserror html_css_free_stylesheets(html_content *html)
return NSERROR_OK;
}
-/* exported interface documented in render/html_internal.h */
+/* exported interface documented in html/html_internal.h */
nserror html_css_quirks_stylesheets(html_content *c)
{
nserror ns_error = NSERROR_OK;
@@ -517,13 +530,13 @@ nserror html_css_quirks_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
return ns_error;
}
-/* exported interface documented in render/html_internal.h */
+/* exported interface documented in html/html_internal.h */
nserror html_css_new_stylesheets(html_content *c)
{
nserror ns_error;
@@ -561,7 +574,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
if (nsoption_bool(block_advertisements)) {
@@ -575,7 +588,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
@@ -588,7 +601,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
return ns_error;
}
diff --git a/render/html_css_fetcher.c b/content/handlers/html/html_css_fetcher.c
index 9eda6aeb7..7987ea094 100644
--- a/render/html_css_fetcher.c
+++ b/content/handlers/html/html_css_fetcher.c
@@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * HTML fetcher for CSS objects
+ */
+
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -33,7 +38,7 @@
#include "content/fetch.h"
#include "content/fetchers.h"
-#include "render/html_internal.h"
+#include "html/html_internal.h"
typedef struct html_css_fetcher_item {
uint32_t key;
@@ -51,7 +56,7 @@ typedef struct html_css_fetcher_context {
bool aborted;
bool locked;
-
+
struct html_css_fetcher_context *r_next, *r_prev;
} html_css_fetcher_context;
@@ -61,13 +66,15 @@ static html_css_fetcher_context *ring = NULL;
static bool html_css_fetcher_initialise(lwc_string *scheme)
{
- LOG("html_css_fetcher_initialise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "html_css_fetcher_initialise called for %s",
+ lwc_string_data(scheme));
return true;
}
static void html_css_fetcher_finalise(lwc_string *scheme)
{
- LOG("html_css_fetcher_finalise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "html_css_fetcher_finalise called for %s",
+ lwc_string_data(scheme));
}
static bool html_css_fetcher_can_fetch(const nsurl *url)
@@ -84,7 +91,7 @@ static void *html_css_fetcher_setup(struct fetch *parent_fetch, nsurl *url,
lwc_string *path;
uint32_t key;
html_css_fetcher_item *item, *found = NULL;
-
+
/* format of a x-ns-css URL is:
* x-ns-url:<key>
* Where key is an unsigned 32bit integer
@@ -129,7 +136,7 @@ static void *html_css_fetcher_setup(struct fetch *parent_fetch, nsurl *url,
ctx->item = found;
RING_INSERT(ring, ctx);
-
+
return ctx;
}
@@ -158,14 +165,14 @@ static void html_css_fetcher_abort(void *ctx)
html_css_fetcher_context *c = ctx;
/* To avoid the poll loop having to deal with the fetch context
- * disappearing from under it, we simply flag the abort here.
+ * disappearing from under it, we simply flag the abort here.
* The poll loop itself will perform the appropriate cleanup.
*/
c->aborted = true;
}
-static void html_css_fetcher_send_callback(const fetch_msg *msg,
- html_css_fetcher_context *c)
+static void html_css_fetcher_send_callback(const fetch_msg *msg,
+ html_css_fetcher_context *c)
{
c->locked = true;
fetch_send_callback(msg, c->parent_fetch);
@@ -176,16 +183,16 @@ static void html_css_fetcher_poll(lwc_string *scheme)
{
fetch_msg msg;
html_css_fetcher_context *c, *next;
-
+
if (ring == NULL) return;
-
+
/* Iterate over ring, processing each pending fetch */
c = ring;
do {
/* Ignore fetches that have been flagged as locked.
* This allows safe re-entrant calls to this function.
* Re-entrancy can occur if, as a result of a callback,
- * the interested party causes fetch_poll() to be called
+ * the interested party causes fetch_poll() to be called
* again.
*/
if (c->locked == true) {
@@ -211,26 +218,26 @@ static void html_css_fetcher_poll(lwc_string *scheme)
msg.type = FETCH_HEADER;
msg.data.header_or_data.buf = (const uint8_t *) header;
msg.data.header_or_data.len = strlen(header);
- html_css_fetcher_send_callback(&msg, c);
+ html_css_fetcher_send_callback(&msg, c);
if (c->aborted == false) {
- snprintf(header, sizeof header,
+ snprintf(header, sizeof header,
"Content-Length: %"PRIsizet,
dom_string_byte_length(c->item->data));
msg.type = FETCH_HEADER;
- msg.data.header_or_data.buf =
+ msg.data.header_or_data.buf =
(const uint8_t *) header;
msg.data.header_or_data.len = strlen(header);
html_css_fetcher_send_callback(&msg, c);
}
if (c->aborted == false) {
- snprintf(header, sizeof header,
+ snprintf(header, sizeof header,
"X-NS-Base: %.*s",
(int) nsurl_length(c->item->base_url),
nsurl_access(c->item->base_url));
msg.type = FETCH_HEADER;
- msg.data.header_or_data.buf =
+ msg.data.header_or_data.buf =
(const uint8_t *) header;
msg.data.header_or_data.len = strlen(header);
html_css_fetcher_send_callback(&msg, c);
@@ -238,8 +245,8 @@ static void html_css_fetcher_poll(lwc_string *scheme)
if (c->aborted == false) {
msg.type = FETCH_DATA;
- msg.data.header_or_data.buf =
- (const uint8_t *)
+ msg.data.header_or_data.buf =
+ (const uint8_t *)
dom_string_data(c->item->data);
msg.data.header_or_data.len =
dom_string_byte_length(c->item->data);
@@ -251,9 +258,10 @@ static void html_css_fetcher_poll(lwc_string *scheme)
html_css_fetcher_send_callback(&msg, c);
}
} else {
- LOG("Processing of %s failed!", nsurl_access(c->url));
+ NSLOG(netsurf, INFO, "Processing of %s failed!",
+ nsurl_access(c->url));
- /* Ensure that we're unlocked here. If we aren't,
+ /* Ensure that we're unlocked here. If we aren't,
* then html_css_fetcher_process() is broken.
*/
assert(c->locked == false);
@@ -290,7 +298,7 @@ nserror html_css_fetcher_register(void)
if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"),
&scheme) != lwc_error_ok) {
- LOG("could not intern \"x-ns-css\".");
+ NSLOG(netsurf, INFO, "could not intern \"x-ns-css\".");
return NSERROR_INIT_FAILED;
}
@@ -315,4 +323,3 @@ html_css_fetcher_add_item(dom_string *data, nsurl *base_url, uint32_t *key)
return NSERROR_OK;
}
-
diff --git a/render/html_forms.c b/content/handlers/html/html_forms.c
index 39bc690d9..915eb002f 100644
--- a/render/html_forms.c
+++ b/content/handlers/html/html_forms.c
@@ -16,14 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * HTML form handling implementation
+ */
+
#include "utils/config.h"
#include "utils/corestrings.h"
#include "utils/log.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
+#include "html/form_internal.h"
+#include "html/html_internal.h"
-/**
+/**
* process form element from dom
*/
static struct form *
@@ -572,4 +577,3 @@ struct form_control *html_forms_get_control_for_node(struct form *forms,
return ctl;
}
-
diff --git a/render/html_interaction.c b/content/handlers/html/html_interaction.c
index e727a9ffc..648d27467 100644
--- a/render/html_interaction.c
+++ b/content/handlers/html/html_interaction.c
@@ -2,7 +2,7 @@
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
* Copyright 2006 Richard Wilson <info@tinct.net>
* Copyright 2008 Michael Drake <tlsa@netsurf-browser.org>
- * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
+ * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -21,7 +21,7 @@
/**
* \file
- * User interaction with a CONTENT_HTML (implementation).
+ * implementation of user interaction with a CONTENT_HTML.
*/
#include <assert.h>
@@ -48,13 +48,13 @@
#include "javascript/js.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/box_textarea.h"
-#include "render/font.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
-#include "render/imagemap.h"
-#include "render/search.h"
+#include "html/box.h"
+#include "html/box_textarea.h"
+#include "html/font.h"
+#include "html/form_internal.h"
+#include "html/html_internal.h"
+#include "html/imagemap.h"
+#include "html/search.h"
/**
* Get pointer shape for given box
@@ -208,7 +208,7 @@ static size_t html_selection_drag_end(struct html_content *html,
if (box) {
plot_font_style_t fstyle;
- font_plot_style_from_css(box->style, &fstyle);
+ font_plot_style_from_css(&html->len_ctx, box->style, &fstyle);
guit->layout->position(&fstyle, box->text, box->length,
dx, &idx, &pixel_offset);
@@ -289,11 +289,50 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation,
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
+
+/**
+ * End overflow scroll scrollbar drags
+ *
+ * \param scrollbar scrollbar widget
+ * \param mouse state of mouse buttons and modifier keys
+ * \param x coordinate of mouse
+ * \param y coordinate of mouse
+ */
+static void
+html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
+ browser_mouse_state mouse,
+ int x, int y)
+{
+ int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
+ struct html_scrollbar_data *data = scrollbar_get_data(scrollbar);
+ struct box *box;
+
+ box = data->box;
+ box_coords(box, &box_x, &box_y);
+
+ if (scrollbar_is_horizontal(scrollbar)) {
+ scroll_mouse_x = x - box_x;
+ scroll_mouse_y = y - (box_y + box->padding[TOP] +
+ box->height + box->padding[BOTTOM] -
+ SCROLLBAR_WIDTH);
+ scrollbar_mouse_drag_end(scrollbar, mouse,
+ scroll_mouse_x, scroll_mouse_y);
+ } else {
+ scroll_mouse_x = x - (box_x + box->padding[LEFT] +
+ box->width + box->padding[RIGHT] -
+ SCROLLBAR_WIDTH);
+ scroll_mouse_y = y - box_y;
+ scrollbar_mouse_drag_end(scrollbar, mouse,
+ scroll_mouse_x, scroll_mouse_y);
+ }
+}
+
+
/**
* Handle mouse clicks and movements in an HTML content window.
*
@@ -368,7 +407,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
mouse, x - box_x, y - box_y);
if (status != NULL) {
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
} else {
int width, height;
form_select_get_dimensions(html->visible_select_menu,
@@ -415,7 +454,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
size_t idx;
plot_font_style_t fstyle;
- font_plot_style_from_css(box->style, &fstyle);
+ font_plot_style_from_css(&html->len_ctx,
+ box->style, &fstyle);
guit->layout->position(&fstyle,
box->text, box->length,
@@ -459,7 +499,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
return;
}
@@ -504,7 +544,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
assert(html->drag_type == HTML_DRAG_NONE);
/* search the box tree for a link, imagemap, form control, or
- * box with scrollbars
+ * box with scrollbars
*/
box = html->layout;
@@ -514,7 +554,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
box_y = box->margin[TOP];
/* descend through visible boxes setting more specific values for:
- * box - deepest box at point
+ * box - deepest box at point
* html_object_box - html object
* html_object_pos_x - html object
* html_object_pos_y - html object
@@ -539,13 +579,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
* scrollbar - inside padding box stops decent
* scroll_mouse_x - inside padding box stops decent
* scroll_mouse_y - inside padding box stops decent
- *
+ *
* text_box - text box
* text_box_x - text_box
*/
do {
- if ((box->style != NULL) &&
- (css_computed_visibility(box->style) ==
+ if ((box->style != NULL) &&
+ (css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)) {
continue;
}
@@ -597,8 +637,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
pointer = get_pointer_shape(box, false);
-
- if ((box->scroll_x != NULL) ||
+
+ if ((box->scroll_x != NULL) ||
(box->scroll_y != NULL)) {
if (drag_candidate == NULL) {
@@ -613,29 +653,29 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
scrollbar_get_offset(box->scroll_y);
padding_bottom = padding_top + box->padding[TOP] +
box->height + box->padding[BOTTOM];
-
- if ((x > padding_left) &&
+
+ if ((x > padding_left) &&
(x < padding_right) &&
- (y > padding_top) &&
+ (y > padding_top) &&
(y < padding_bottom)) {
/* mouse inside padding box */
-
- if ((box->scroll_y != NULL) &&
+
+ if ((box->scroll_y != NULL) &&
(x > (padding_right -
SCROLLBAR_WIDTH))) {
/* mouse above vertical box scroll */
-
+
scrollbar = box->scroll_y;
scroll_mouse_x = x - (padding_right -
SCROLLBAR_WIDTH);
scroll_mouse_y = y - padding_top;
break;
-
+
} else if ((box->scroll_x != NULL) &&
(y > (padding_bottom -
- SCROLLBAR_WIDTH))) {
+ SCROLLBAR_WIDTH))) {
/* mouse above horizontal box scroll */
-
+
scrollbar = box->scroll_x;
scroll_mouse_x = x - padding_left;
scroll_mouse_y = y - (padding_bottom -
@@ -649,7 +689,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
text_box = box;
text_box_x = box_x;
}
- } while ((box = box_at_point(box, x, y, &box_x, &box_y)) != NULL);
+ } while ((box = box_at_point(&html->len_ctx, box, x, y,
+ &box_x, &box_y)) != NULL);
/* use of box_x, box_y, or content below this point is probably a
* mistake; they will refer to the last box returned by box_at_point */
@@ -678,7 +719,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
} else if (mouse & BROWSER_MOUSE_CLICK_1) {
msg_data.select_menu.gadget = gadget;
content_broadcast(c, CONTENT_MSG_SELECTMENU,
- msg_data);
+ &msg_data);
}
break;
case GADGET_CHECKBOX:
@@ -697,6 +738,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
form_radio_set(gadget);
break;
case GADGET_IMAGE:
+ /* This falls through to SUBMIT */
if (mouse & BROWSER_MOUSE_CLICK_1) {
struct image_input_coords *coords, *oldcoords;
/** \todo Find a way to not ignore errors */
@@ -714,7 +756,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
return;
free(oldcoords);
}
- /* drop through */
+ /* Fall through */
case GADGET_SUBMIT:
if (gadget->form) {
snprintf(status_buffer, sizeof status_buffer,
@@ -768,7 +810,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = messages_get("FormFile");
if (mouse & BROWSER_MOUSE_CLICK_1) {
msg_data.gadget_click.gadget = gadget;
- content_broadcast(c, CONTENT_MSG_GADGETCLICK, msg_data);
+ content_broadcast(c, CONTENT_MSG_GADGETCLICK,
+ &msg_data);
}
break;
case GADGET_BUTTON:
@@ -782,12 +825,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
if (mouse & BROWSER_MOUSE_DRAG_2) {
msg_data.dragsave.type = CONTENT_SAVE_NATIVE;
msg_data.dragsave.content = object;
- content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data);
} else if (mouse & BROWSER_MOUSE_DRAG_1) {
msg_data.dragsave.type = CONTENT_SAVE_ORIG;
msg_data.dragsave.content = object;
- content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data);
}
/* \todo should have a drag-saving object msg */
@@ -869,7 +912,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
mouse & BROWSER_MOUSE_MOD_1) {
msg_data.savelink.url = url;
msg_data.savelink.title = title;
- content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data);
+ content_broadcast(c, CONTENT_MSG_SAVELINK, &msg_data);
} else if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2))
@@ -890,7 +933,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
/* if clicking in the main page, remove the selection from any
* text areas */
if (!done) {
-
+
if (click && html->focus_type != HTML_FOCUS_SELF) {
union html_focus_owner fo;
fo.self = true;
@@ -908,8 +951,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
int pixel_offset;
size_t idx;
- font_plot_style_from_css(text_box->style,
- &fstyle);
+ font_plot_style_from_css(&html->len_ctx,
+ text_box->style, &fstyle);
guit->layout->position(&fstyle,
text_box->text,
@@ -968,7 +1011,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
msg_data.dragsave.content = NULL;
content_broadcast(c,
CONTENT_MSG_DRAGSAVE,
- msg_data);
+ &msg_data);
} else {
if (drag_candidate == NULL) {
browser_window_page_drag_start(
@@ -988,7 +1031,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
msg_data.dragsave.content = NULL;
content_broadcast(c,
CONTENT_MSG_DRAGSAVE,
- msg_data);
+ &msg_data);
} else {
if (drag_candidate == NULL) {
browser_window_page_drag_start(
@@ -1013,10 +1056,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
if (!iframe && !html_object_box) {
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
msg_data.pointer = pointer;
- content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
}
/* fire dom click event */
@@ -1186,7 +1229,7 @@ void html_overflow_scroll_callback(void *client_data,
union content_msg_data msg_data;
html_drag_type drag_type;
union html_drag_owner drag_owner;
-
+
switch(scrollbar_data->msg) {
case SCROLLBAR_MSG_MOVED:
@@ -1217,47 +1260,12 @@ void html_overflow_scroll_callback(void *client_data,
html_set_drag_type(html, drag_type, drag_owner, NULL);
msg_data.pointer = BROWSER_POINTER_AUTO;
- content_broadcast(data->c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(data->c, CONTENT_MSG_POINTER, &msg_data);
break;
}
}
-/**
- * End overflow scroll scrollbar drags
- *
- * \param scrollbar scrollbar widget
- * \param mouse state of mouse buttons and modifier keys
- * \param x coordinate of mouse
- * \param y coordinate of mouse
- */
-void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
- browser_mouse_state mouse, int x, int y)
-{
- int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
- struct html_scrollbar_data *data = scrollbar_get_data(scrollbar);
- struct box *box;
-
- box = data->box;
- box_coords(box, &box_x, &box_y);
-
- if (scrollbar_is_horizontal(scrollbar)) {
- scroll_mouse_x = x - box_x;
- scroll_mouse_y = y - (box_y + box->padding[TOP] +
- box->height + box->padding[BOTTOM] -
- SCROLLBAR_WIDTH);
- scrollbar_mouse_drag_end(scrollbar, mouse,
- scroll_mouse_x, scroll_mouse_y);
- } else {
- scroll_mouse_x = x - (box_x + box->padding[LEFT] +
- box->width + box->padding[RIGHT] -
- SCROLLBAR_WIDTH);
- scroll_mouse_y = y - box_y;
- scrollbar_mouse_drag_end(scrollbar, mouse,
- scroll_mouse_x, scroll_mouse_y);
- }
-}
-
/* Documented in html_internal.h */
void html_set_drag_type(html_content *html, html_drag_type drag_type,
union html_drag_owner drag_owner, const struct rect *rect)
@@ -1292,7 +1300,7 @@ void html_set_drag_type(html_content *html, html_drag_type drag_type,
msg_data.drag.rect = rect;
/* Inform of the content's drag status change */
- content_broadcast((struct content *)html, CONTENT_MSG_DRAG, msg_data);
+ content_broadcast((struct content *)html, CONTENT_MSG_DRAG, &msg_data);
}
/* Documented in html_internal.h */
@@ -1350,7 +1358,7 @@ void html_set_focus(html_content *html, html_focus_type focus_type,
}
/* Inform of the content's drag status change */
- content_broadcast((struct content *)html, CONTENT_MSG_CARET, msg_data);
+ content_broadcast((struct content *)html, CONTENT_MSG_CARET, &msg_data);
}
/* Documented in html_internal.h */
@@ -1426,5 +1434,5 @@ void html_set_selection(html_content *html, html_selection_type selection_type,
/* Inform of the content's selection status change */
content_broadcast((struct content *)html, CONTENT_MSG_SELECTION,
- msg_data);
+ &msg_data);
}
diff --git a/render/html_internal.h b/content/handlers/html/html_internal.h
index fd65707ce..77354c369 100644
--- a/render/html_internal.h
+++ b/content/handlers/html/html_internal.h
@@ -18,19 +18,21 @@
/**
* \file
- * Content for text/html (private data).
+ * Private data for text/html content.
*/
-#ifndef NETSURF_RENDER_HTML_INTERNAL_H_
-#define NETSURF_RENDER_HTML_INTERNAL_H_
+#ifndef NETSURF_HTML_HTML_INTERNAL_H
+#define NETSURF_HTML_HTML_INTERNAL_H
#include <libcss/libcss.h>
+#include <dom/bindings/hubbub/parser.h>
+#include "netsurf/types.h"
#include "content/content_protected.h"
#include "desktop/selection.h"
-#include "render/html.h"
struct gui_layout_table;
+struct scrollbar_msg_data;
typedef enum {
HTML_DRAG_NONE, /** No drag */
@@ -42,12 +44,15 @@ typedef enum {
HTML_DRAG_CONTENT_SCROLL /** Not own; drag in child content */
} html_drag_type;
+/**
+ * For drags we don't own
+ */
union html_drag_owner {
bool no_owner;
struct box *content;
struct scrollbar *scrollbar;
struct box *textarea;
-}; /**< For drags we don't own */
+};
typedef enum {
HTML_SELECTION_NONE, /** No selection */
@@ -55,24 +60,39 @@ typedef enum {
HTML_SELECTION_SELF, /** Selection in this html content */
HTML_SELECTION_CONTENT /** Selection in child content */
} html_selection_type;
+
+/**
+ * For getting at selections in this content or things in this content
+ */
union html_selection_owner {
bool none;
struct box *textarea;
struct box *content;
-}; /**< For getting at selections in this content or things in this content */
+};
typedef enum {
- HTML_FOCUS_SELF, /** Focus is our own */
- HTML_FOCUS_CONTENT, /** Focus belongs to child content */
- HTML_FOCUS_TEXTAREA /** Focus belongs to textarea */
+ HTML_FOCUS_SELF, /**< Focus is our own */
+ HTML_FOCUS_CONTENT, /**< Focus belongs to child content */
+ HTML_FOCUS_TEXTAREA /**< Focus belongs to textarea */
} html_focus_type;
+
+/**
+ * For directing input
+ */
union html_focus_owner {
bool self;
struct box *textarea;
struct box *content;
-}; /**< For directing input */
+};
-/** Data specific to CONTENT_HTML. */
+struct html_scrollbar_data {
+ struct content *c;
+ struct box *box;
+};
+
+/**
+ * Data specific to CONTENT_HTML.
+ */
typedef struct html_content {
struct content base;
@@ -94,6 +114,9 @@ typedef struct html_content {
/** Base target */
char *base_target;
+ /** CSS length conversion context for document. */
+ nscss_len_ctx len_ctx;
+
/** Content has been aborted in the LOADING state */
bool aborted;
@@ -109,7 +132,7 @@ typedef struct html_content {
/* Title element node */
dom_node *title;
- /** A talloc context purely for the render box tree */
+ /** A talloc context purely for the render box tree */
int *bctx;
/** Box tree, or NULL. */
struct box *layout;
@@ -153,7 +176,7 @@ typedef struct html_content {
/** Inline frame information */
struct content_html_iframe *iframe;
- /** Content of type CONTENT_HTML containing this, or NULL if not an
+ /** Content of type CONTENT_HTML containing this, or NULL if not an
* object within a page. */
struct html_content *page;
@@ -254,11 +277,20 @@ bool html_can_begin_conversion(html_content *htmlc);
*/
bool html_begin_conversion(html_content *htmlc);
-/* in render/html_redraw.c */
+/* in html/html_redraw.c */
bool html_redraw(struct content *c, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx);
-/* in render/html_interaction.c */
+/* in html/html_redraw_border.c */
+bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
+ int p_width, int p_height, const struct rect *clip, float scale,
+ const struct redraw_context *ctx);
+
+bool html_redraw_inline_borders(struct box *box, struct rect b,
+ const struct rect *clip, float scale, bool first, bool last,
+ const struct redraw_context *ctx);
+
+/* in html/html_interaction.c */
void html_mouse_track(struct content *c, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
void html_mouse_action(struct content *c, struct browser_window *bw,
@@ -271,7 +303,7 @@ void html_search(struct content *c, void *context,
void html_search_clear(struct content *c);
-/* in render/html_script.c */
+/* in html/html_script.c */
dom_hubbub_error html_process_script(void *ctx, dom_node *node);
/**
@@ -301,12 +333,12 @@ nserror html_script_free(html_content *htmlc);
*/
nserror html_script_invalidate_ctx(html_content *htmlc);
-/* in render/html_forms.c */
+/* in html/html_forms.c */
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
struct form_control *html_forms_get_control_for_node(struct form *forms,
dom_node *node);
-/* in render/html_css.c */
+/* in html/html_css.c */
nserror html_css_init(void);
void html_css_fini(void);
@@ -327,7 +359,7 @@ bool html_css_update_style(html_content *c, dom_node *style);
nserror html_css_new_selection_context(html_content *c,
css_select_ctx **ret_select_ctx);
-/* in render/html_css_fetcher.c */
+/* in html/html_css_fetcher.c */
/**
* Register the fetcher for the pseudo x-ns-css scheme.
*
@@ -337,7 +369,7 @@ nserror html_css_fetcher_register(void);
nserror html_css_fetcher_add_item(dom_string *data, nsurl *base_url,
uint32_t *key);
-/* in render/html_object.c */
+/* in html/html_object.c */
/**
* Start a fetch for an object required by a page.
@@ -393,5 +425,3 @@ extern struct dom_string *html_dom_string_type;
extern struct dom_string *html_dom_string_src;
#endif
-
-
diff --git a/render/html_object.c b/content/handlers/html/html_object.c
index bc351247c..7eab46647 100644
--- a/render/html_object.c
+++ b/content/handlers/html/html_object.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Processing for html content object operations.
*/
@@ -39,8 +40,9 @@
#include "desktop/scrollbar.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/html_internal.h"
+#include "html/html.h"
+#include "html/box.h"
+#include "html/html_internal.h"
/* break reference loop */
static void html_object_refresh(void *p);
@@ -97,6 +99,16 @@ html_object_done(struct box *box,
box->object = object;
+ /* Normalise the box type, now it has been replaced. */
+ switch (box->type) {
+ case BOX_TABLE:
+ box->type = BOX_BLOCK;
+ break;
+ default:
+ /* TODO: Any other box types need mapping? */
+ break;
+ }
+
if (!(box->flags & REPLACE_DIM)) {
/* invalidate parent min, max widths */
for (b = box; b; b = b->parent)
@@ -124,10 +136,10 @@ html_object_callback(hlcache_handle *object,
int x, y;
struct box *box;
- assert(c->base.status != CONTENT_STATUS_ERROR);
-
box = o->box;
- if (box == NULL && event->type != CONTENT_MSG_ERROR) {
+ if (box == NULL &&
+ event->type != CONTENT_MSG_ERROR &&
+ event->type != CONTENT_MSG_ERRORCODE) {
return NSERROR_OK;
}
@@ -160,7 +172,7 @@ html_object_callback(hlcache_handle *object,
case CONTENT_MSG_DONE:
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
html_object_done(box, object, o->background);
@@ -179,10 +191,11 @@ html_object_callback(hlcache_handle *object,
data.redraw.height = box->height;
data.redraw.full_redraw = true;
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
+ content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data);
}
break;
+ case CONTENT_MSG_ERRORCODE:
case CONTENT_MSG_ERROR:
hlcache_handle_release(object);
@@ -190,7 +203,8 @@ html_object_callback(hlcache_handle *object,
if (box != NULL) {
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
content_add_error(&c->base, "?", 0);
html_object_failed(box, c, o->background);
@@ -225,7 +239,8 @@ html_object_callback(hlcache_handle *object,
if (hunit == CSS_UNIT_PCT) {
l = (width - w) * hpos / INTTOFIX(100);
} else {
- l = FIXTOINT(nscss_len2px(hpos, hunit,
+ l = FIXTOINT(nscss_len2px(&c->len_ctx,
+ hpos, hunit,
box->style));
}
@@ -233,7 +248,8 @@ html_object_callback(hlcache_handle *object,
if (vunit == CSS_UNIT_PCT) {
t = (height - h) * vpos / INTTOFIX(100);
} else {
- t = FIXTOINT(nscss_len2px(vpos, vunit,
+ t = FIXTOINT(nscss_len2px(&c->len_ctx,
+ vpos, vunit,
box->style));
}
@@ -278,7 +294,7 @@ html_object_callback(hlcache_handle *object,
data.redraw.object_y += y;
content_broadcast(&c->base,
- CONTENT_MSG_REDRAW, data);
+ CONTENT_MSG_REDRAW, &data);
break;
} else {
@@ -317,7 +333,7 @@ html_object_callback(hlcache_handle *object,
data.redraw.object_y += y + box->padding[TOP];
}
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
+ content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data);
}
break;
@@ -356,7 +372,7 @@ html_object_callback(hlcache_handle *object,
msg_data.dragsave.content =
event->data.dragsave.content;
- content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, &msg_data);
}
break;
@@ -366,7 +382,7 @@ html_object_callback(hlcache_handle *object,
case CONTENT_MSG_GADGETCLICK:
/* These messages are for browser window layer.
* we're not interested, so pass them on. */
- content_broadcast(&c->base, event->type, event->data);
+ content_broadcast(&c->base, event->type, &event->data);
break;
case CONTENT_MSG_CARET:
@@ -436,39 +452,40 @@ html_object_callback(hlcache_handle *object,
}
if (c->base.status == CONTENT_STATUS_READY &&
- c->base.active == 0 &&
- (event->type == CONTENT_MSG_LOADING ||
- event->type == CONTENT_MSG_DONE ||
- event->type == CONTENT_MSG_ERROR)) {
+ c->base.active == 0 &&
+ (event->type == CONTENT_MSG_LOADING ||
+ event->type == CONTENT_MSG_DONE ||
+ event->type == CONTENT_MSG_ERROR ||
+ event->type == CONTENT_MSG_ERRORCODE)) {
/* all objects have arrived */
content__reformat(&c->base, false, c->base.available_width,
c->base.height);
content_set_done(&c->base);
} else if (nsoption_bool(incremental_reflow) &&
- event->type == CONTENT_MSG_DONE &&
- box != NULL &&
- !(box->flags & REPLACE_DIM) &&
- (c->base.status == CONTENT_STATUS_READY ||
- c->base.status == CONTENT_STATUS_DONE)) {
- /* 1) the configuration option to reflow pages while
- * objects are fetched is set
- * 2) an object is newly fetched & converted,
- * 3) the box's dimensions need to change due to being replaced
- * 4) the object's parent HTML is ready for reformat,
- */
- uint64_t ms_now;
- nsu_getmonotonic_ms(&ms_now);
- if (ms_now > c->base.reformat_time) {
- /* The time since the previous reformat is
- * more than the configured minimum time
- * between reformats so reformat the page to
- * display newly fetched objects
- */
- content__reformat(&c->base,
- false,
- c->base.available_width,
- c->base.height);
- }
+ event->type == CONTENT_MSG_DONE &&
+ box != NULL &&
+ !(box->flags & REPLACE_DIM) &&
+ (c->base.status == CONTENT_STATUS_READY ||
+ c->base.status == CONTENT_STATUS_DONE)) {
+ /* 1) the configuration option to reflow pages while
+ * objects are fetched is set
+ * 2) an object is newly fetched & converted,
+ * 3) the box's dimensions need to change due to being replaced
+ * 4) the object's parent HTML is ready for reformat,
+ */
+ uint64_t ms_now;
+ nsu_getmonotonic_ms(&ms_now);
+ if (ms_now > c->base.reformat_time) {
+ /* The time since the previous reformat is
+ * more than the configured minimum time
+ * between reformats so reformat the page to
+ * display newly fetched objects
+ */
+ content__reformat(&c->base,
+ false,
+ c->base.available_width,
+ c->base.height);
+ }
}
return NSERROR_OK;
@@ -501,7 +518,8 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url)
/* remove existing object */
if (content_get_status(object->content) != CONTENT_STATUS_DONE) {
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
}
hlcache_handle_release(object->content);
@@ -522,7 +540,7 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url)
for (page = c; page != NULL; page = page->page) {
page->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
page->base.status = CONTENT_STATUS_READY;
}
@@ -605,7 +623,8 @@ nserror html_object_abort_objects(html_content *htmlc)
object->content = NULL;
if (object->box != NULL) {
htmlc->base.active--;
- LOG("%d fetches active", htmlc->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ htmlc->base.active);
}
break;
@@ -643,7 +662,7 @@ nserror html_object_free_objects(html_content *html)
struct content_html_object *victim = html->object_list;
if (victim->content != NULL) {
- LOG("object %p", victim->content);
+ NSLOG(netsurf, INFO, "object %p", victim->content);
if (content_get_type(victim->content) == CONTENT_HTML) {
guit->misc->schedule(-1, html_object_refresh, victim);
@@ -659,7 +678,7 @@ nserror html_object_free_objects(html_content *html)
-/* exported interface documented in render/html_internal.h */
+/* exported interface documented in html/html_internal.h */
bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
content_type permitted_types,
int available_width, int available_height,
@@ -693,7 +712,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
content_get_url(&c->base), NULL,
html_object_callback, object, &child,
object->permitted_types, &object->content);
- if (error != NSERROR_OK) {
+ if (error != NSERROR_OK) {
free(object);
return error != NSERROR_NOMEM;
}
@@ -705,7 +724,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
c->num_objects++;
if (box != NULL) {
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
return true;
diff --git a/render/html_redraw.c b/content/handlers/html/html_redraw.c
index ae8675671..d05df8753 100644
--- a/render/html_redraw.c
+++ b/content/handlers/html/html_redraw.c
@@ -5,7 +5,7 @@
* Copyright 2005-2006 Adrian Lees <adrianl@users.sourceforge.net>
* Copyright 2006 Rob Kendrick <rjek@netsurf-browser.org>
* Copyright 2008 Michael Drake <tlsa@netsurf-browser.org>
- * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
+ * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -53,12 +53,12 @@
#include "desktop/textarea.h"
#include "desktop/gui_internal.h"
-#include "render/box.h"
-#include "render/font.h"
-#include "render/form_internal.h"
-#include "render/html_internal.h"
-#include "render/layout.h"
-#include "render/search.h"
+#include "html/box.h"
+#include "html/font.h"
+#include "html/form_internal.h"
+#include "html/html_internal.h"
+#include "html/layout.h"
+#include "html/search.h"
bool html_redraw_debug = false;
@@ -150,16 +150,26 @@ static struct box *html_redraw_find_bg_box(struct box *box)
* \return true iff successful and redraw should proceed
*/
-bool text_redraw(const char *utf8_text, size_t utf8_len,
- size_t offset, int space, const plot_font_style_t *fstyle,
- int x, int y, const struct rect *clip, int height,
- float scale, bool excluded, struct content *c,
- const struct selection *sel, struct search_context *search,
- const struct redraw_context *ctx)
+static bool
+text_redraw(const char *utf8_text,
+ size_t utf8_len,
+ size_t offset,
+ int space,
+ const plot_font_style_t *fstyle,
+ int x,
+ int y,
+ const struct rect *clip,
+ int height,
+ float scale,
+ bool excluded,
+ struct content *c,
+ const struct selection *sel,
+ struct search_context *search,
+ const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
bool highlighted = false;
plot_font_style_t plot_fstyle = *fstyle;
+ nserror res;
/* Need scaled text size to pass to plotters */
plot_fstyle.size *= scale;
@@ -195,7 +205,6 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
int startx, endx;
plot_style_t pstyle_fill_hback = *plot_style_fill_white;
plot_font_style_t fstyle_hback = plot_fstyle;
- nserror res;
if (end_idx > utf8_len) {
/* adjust for trailing space, not present in
@@ -230,19 +239,26 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
}
/* draw any text preceding highlighted portion */
- if (start_idx > 0 &&
- !plot->text(x, y + (int)(height * 0.75 * scale),
- utf8_text, start_idx,
- &plot_fstyle))
+ if ((start_idx > 0) &&
+ (ctx->plot->text(ctx,
+ &plot_fstyle,
+ x,
+ y + (int)(height * 0.75 * scale),
+ utf8_text,
+ start_idx) != NSERROR_OK))
return false;
pstyle_fill_hback.fill_colour = fstyle->foreground;
/* highlighted portion */
- if (!plot->rectangle(x + startx, y, x + endx,
- y + height * scale,
- &pstyle_fill_hback))
+ r.x0 = x + startx;
+ r.y0 = y;
+ r.x1 = x + endx;
+ r.y1 = y + height * scale;
+ res = ctx->plot->rectangle(ctx, &pstyle_fill_hback, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
if (start_idx > 0) {
int px0 = max(x + startx, clip->x0);
@@ -253,8 +269,11 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
r.y0 = clip->y0;
r.x1 = px1;
r.y1 = clip->y1;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
+
clip_changed = true;
} else {
text_visible = false;
@@ -267,10 +286,14 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
pstyle_fill_hback.fill_colour);
if (text_visible &&
- !plot->text(x, y + (int)(height * 0.75 * scale),
- utf8_text, endtxt_idx,
- &fstyle_hback))
+ (ctx->plot->text(ctx,
+ &fstyle_hback,
+ x,
+ y + (int)(height * 0.75 * scale),
+ utf8_text,
+ endtxt_idx) != NSERROR_OK)) {
return false;
+ }
/* draw any text succeeding highlighted portion */
if (endtxt_idx < utf8_len) {
@@ -281,858 +304,43 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
r.y0 = clip->y0;
r.x1 = clip->x1;
r.y1 = clip->y1;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
clip_changed = true;
- if (!plot->text(x, y + (int)
- (height * 0.75 * scale),
- utf8_text, utf8_len,
- &plot_fstyle))
+ res = ctx->plot->text(ctx,
+ &plot_fstyle,
+ x,
+ y + (int)(height * 0.75 * scale),
+ utf8_text,
+ utf8_len);
+ if (res != NSERROR_OK) {
return false;
+ }
}
}
if (clip_changed &&
- !plot->clip(clip))
+ (ctx->plot->clip(ctx, clip) != NSERROR_OK)) {
return false;
- }
- }
-
- if (!highlighted) {
- if (!plot->text(x, y + (int) (height * 0.75 * scale),
- utf8_text, utf8_len,
- &plot_fstyle))
- return false;
- }
- return true;
-}
-
-static plot_style_t plot_style_bdr = {
- .stroke_type = PLOT_OP_TYPE_DASH,
-};
-static plot_style_t plot_style_fillbdr = {
- .fill_type = PLOT_OP_TYPE_SOLID,
-};
-static plot_style_t plot_style_fillbdr_dark = {
- .fill_type = PLOT_OP_TYPE_SOLID,
-};
-static plot_style_t plot_style_fillbdr_light = {
- .fill_type = PLOT_OP_TYPE_SOLID,
-};
-static plot_style_t plot_style_fillbdr_ddark = {
- .fill_type = PLOT_OP_TYPE_SOLID,
-};
-static plot_style_t plot_style_fillbdr_dlight = {
- .fill_type = PLOT_OP_TYPE_SOLID,
-};
-
-/**
- * Draw one border.
- *
- * \param side index of border side (TOP, RIGHT, BOTTOM, LEFT)
- * \param p array of precomputed border vertices
- * \param c colour for border
- * \param style border line style
- * \param thickness border thickness
- * \param rectangular whether border is rectangular
- * \param clip cliping area for redrawing border.
- * \param ctx current redraw context
- * \return true if successful, false otherwise
- */
-
-static bool html_redraw_border_plot(const int side, const int *p, colour c,
- enum css_border_style_e style, int thickness, bool rectangular,
- const struct rect *clip, const struct redraw_context *ctx)
-{
- const struct plotter_table *plot = ctx->plot;
- int z[8]; /* Vertices of border part */
- unsigned int light = side;
- plot_style_t *plot_style_bdr_in;
- plot_style_t *plot_style_bdr_out;
-
- if (c == NS_TRANSPARENT)
- return true;
-
- plot_style_bdr.stroke_type = PLOT_OP_TYPE_DASH;
- plot_style_bdr.stroke_colour = c;
- plot_style_bdr.stroke_width = thickness;
- plot_style_fillbdr.fill_colour = c;
- plot_style_fillbdr_dark.fill_colour = darken_colour(c);
- plot_style_fillbdr_light.fill_colour = lighten_colour(c);
- plot_style_fillbdr_ddark.fill_colour = double_darken_colour(c);
- plot_style_fillbdr_dlight.fill_colour = double_lighten_colour(c);
-
- switch (style) {
- case CSS_BORDER_STYLE_DOTTED:
- plot_style_bdr.stroke_type = PLOT_OP_TYPE_DOT;
- /* fall through */
- case CSS_BORDER_STYLE_DASHED:
- if (!plot->line((p[0] + p[2]) / 2,
- (p[1] + p[3]) / 2,
- (p[4] + p[6]) / 2,
- (p[5] + p[7]) / 2,
- &plot_style_bdr))
- return false;
- break;
-
- case CSS_BORDER_STYLE_SOLID:
- /* fall through to default */
- default:
- if (rectangular || thickness == 1) {
- int x0, y0, x1, y1;
- if (side == TOP || side == RIGHT) {
- x0 = p[2]; y0 = p[3];
- x1 = p[6]; y1 = p[7];
- x1 = ((side == TOP) && (p[4] - p[6] != 0)) ?
- x1 + p[4] - p[6] : x1;
- } else {
- x0 = p[6]; y0 = p[7];
- x1 = p[2]; y1 = p[3];
- y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ?
- y1 + p[1] - p[3] : y1;
}
- /* find intersection of clip rectangle and border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- &plot_style_fillbdr))
- return false;
- }
- } else {
- if (!plot->polygon(p, 4, &plot_style_fillbdr))
- return false;
}
- break;
-
- case CSS_BORDER_STYLE_DOUBLE:
- z[0] = p[0];
- z[1] = p[1];
- z[2] = (p[0] * 2 + p[2]) / 3;
- z[3] = (p[1] * 2 + p[3]) / 3;
- z[4] = (p[6] * 2 + p[4]) / 3;
- z[5] = (p[7] * 2 + p[5]) / 3;
- z[6] = p[6];
- z[7] = p[7];
- if (!plot->polygon(z, 4, &plot_style_fillbdr))
- return false;
- z[0] = p[2];
- z[1] = p[3];
- z[2] = (p[2] * 2 + p[0]) / 3;
- z[3] = (p[3] * 2 + p[1]) / 3;
- z[4] = (p[4] * 2 + p[6]) / 3;
- z[5] = (p[5] * 2 + p[7]) / 3;
- z[6] = p[4];
- z[7] = p[5];
- if (!plot->polygon(z, 4, &plot_style_fillbdr))
- return false;
- break;
-
- case CSS_BORDER_STYLE_GROOVE:
- light = 3 - light;
- /* fall through */
- case CSS_BORDER_STYLE_RIDGE:
- /* choose correct colours for each part of the border line */
- if (light <= 1) {
- plot_style_bdr_in = &plot_style_fillbdr_dark;
- plot_style_bdr_out = &plot_style_fillbdr_light;
- } else {
- plot_style_bdr_in = &plot_style_fillbdr_light;
- plot_style_bdr_out = &plot_style_fillbdr_dark;
- }
-
- /* Render border */
- if ((rectangular || thickness == 2) && thickness != 1) {
- /* Border made up from two parts and can be plotted
- * with rectangles */
- int x0, y0, x1, y1;
-
- /* First part */
- if (side == TOP || side == RIGHT) {
- x0 = (p[0] + p[2]) / 2; y0 = (p[1] + p[3]) / 2;
- x1 = p[6]; y1 = p[7];
- } else {
- x0 = p[6]; y0 = p[7];
- x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2;
- }
- /* find intersection of clip rectangle and border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_in))
- return false;
- }
-
- /* Second part */
- if (side == TOP || side == RIGHT) {
- x0 = p[2]; y0 = p[3];
- x1 = (p[6] + p[4]) / 2; y1 = (p[7] + p[5]) / 2;
- } else {
- x0 = (p[6] + p[4]) / 2; y0 = (p[7] + p[5]) / 2;
- x1 = p[2]; y1 = p[3];
- }
- /* find intersection of clip rectangle and border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_out))
- return false;
- }
- } else if (thickness == 1) {
- /* Border made up from one part which can be plotted
- * as a rectangle */
- int x0, y0, x1, y1;
- if (side == TOP || side == RIGHT) {
- x0 = p[2]; y0 = p[3];
- x1 = p[6]; y1 = p[7];
- x1 = ((side == TOP) && (p[4] - p[6] != 0)) ?
- x1 + p[4] - p[6] : x1;
- /* find intersection of clip rectangle and
- * border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_in))
- return false;
- }
- } else {
- x0 = p[6]; y0 = p[7];
- x1 = p[2]; y1 = p[3];
- y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ?
- y1 + p[1] - p[3] : y1;
- /* find intersection of clip rectangle and
- * border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_out))
- return false;
- }
- }
- } else {
- /* Border made up from two parts and can't be plotted
- * with rectangles */
- z[0] = p[0];
- z[1] = p[1];
- z[2] = (p[0] + p[2]) / 2;
- z[3] = (p[1] + p[3]) / 2;
- z[4] = (p[6] + p[4]) / 2;
- z[5] = (p[7] + p[5]) / 2;
- z[6] = p[6];
- z[7] = p[7];
- if (!plot->polygon(z, 4, plot_style_bdr_in))
- return false;
- z[0] = p[2];
- z[1] = p[3];
- z[6] = p[4];
- z[7] = p[5];
- if (!plot->polygon(z, 4, plot_style_bdr_out))
- return false;
- }
- break;
-
- case CSS_BORDER_STYLE_INSET:
- light = (light + 2) % 4;
- /* fall through */
- case CSS_BORDER_STYLE_OUTSET:
- /* choose correct colours for each part of the border line */
- switch (light) {
- case 0:
- plot_style_bdr_in = &plot_style_fillbdr_light;
- plot_style_bdr_out = &plot_style_fillbdr_dlight;
- break;
- case 1:
- plot_style_bdr_in = &plot_style_fillbdr_ddark;
- plot_style_bdr_out = &plot_style_fillbdr_dark;
- break;
- case 2:
- plot_style_bdr_in = &plot_style_fillbdr_dark;
- plot_style_bdr_out = &plot_style_fillbdr_ddark;
- break;
- case 3:
- plot_style_bdr_in = &plot_style_fillbdr_dlight;
- plot_style_bdr_out = &plot_style_fillbdr_light;
- break;
- default:
- plot_style_bdr_in = &plot_style_fillbdr;
- plot_style_bdr_out = &plot_style_fillbdr;
- break;
- }
-
- /* Render border */
- if ((rectangular || thickness == 2) && thickness != 1) {
- /* Border made up from two parts and can be plotted
- * with rectangles */
- int x0, y0, x1, y1;
-
- /* First part */
- if (side == TOP || side == RIGHT) {
- x0 = (p[0] + p[2]) / 2; y0 = (p[1] + p[3]) / 2;
- x1 = p[6]; y1 = p[7];
- } else {
- x0 = p[6]; y0 = p[7];
- x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2;
- }
- /* find intersection of clip rectangle and border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_in))
- return false;
- }
-
- /* Second part */
- if (side == TOP || side == RIGHT) {
- x0 = p[2]; y0 = p[3];
- x1 = (p[6] + p[4]) / 2; y1 = (p[7] + p[5]) / 2;
- } else {
- x0 = (p[6] + p[4]) / 2; y0 = (p[7] + p[5]) / 2;
- x1 = p[2]; y1 = p[3];
- }
- /* find intersection of clip rectangle and border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_out))
- return false;
- }
- } else if (thickness == 1) {
- /* Border made up from one part which can be plotted
- * as a rectangle */
- int x0, y0, x1, y1;
- if (side == TOP || side == RIGHT) {
- x0 = p[2]; y0 = p[3];
- x1 = p[6]; y1 = p[7];
- x1 = ((side == TOP) && (p[4] - p[6] != 0)) ?
- x1 + p[4] - p[6] : x1;
- /* find intersection of clip rectangle and
- * border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_in))
- return false;
- }
- } else {
- x0 = p[6]; y0 = p[7];
- x1 = p[2]; y1 = p[3];
- y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ?
- y1 + p[1] - p[3] : y1;
- /* find intersection of clip rectangle and
- * border */
- x0 = (clip->x0 > x0) ? clip->x0 : x0;
- y0 = (clip->y0 > y0) ? clip->y0 : y0;
- x1 = (clip->x1 < x1) ? clip->x1 : x1;
- y1 = (clip->y1 < y1) ? clip->y1 : y1;
- if ((x0 < x1) && (y0 < y1)) {
- /* valid clip rectangles only */
- if (!plot->rectangle(x0, y0, x1, y1,
- plot_style_bdr_out))
- return false;
- }
- }
- } else {
- /* Border made up from two parts and can't be plotted
- * with rectangles */
- z[0] = p[0];
- z[1] = p[1];
- z[2] = (p[0] + p[2]) / 2;
- z[3] = (p[1] + p[3]) / 2;
- z[4] = (p[6] + p[4]) / 2;
- z[5] = (p[7] + p[5]) / 2;
- z[6] = p[6];
- z[7] = p[7];
- if (!plot->polygon(z, 4, plot_style_bdr_in))
- return false;
- z[0] = p[2];
- z[1] = p[3];
- z[6] = p[4];
- z[7] = p[5];
- if (!plot->polygon(z, 4, plot_style_bdr_out))
- return false;
- }
- break;
}
- return true;
-}
-
-
-/**
- * Draw borders for a box.
- *
- * \param box box to draw
- * \param x_parent coordinate of left padding edge of parent of box
- * \param y_parent coordinate of top padding edge of parent of box
- * \param p_width width of padding box
- * \param p_height height of padding box
- * \param clip cliping area for redrawing border.
- * \param scale scale for redraw
- * \param ctx current redraw context
- * \return true if successful, false otherwise
- */
-
-static bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
- int p_width, int p_height, const struct rect *clip, float scale,
- const struct redraw_context *ctx)
-{
- unsigned int sides[] = { LEFT, RIGHT, TOP, BOTTOM };
- int top = box->border[TOP].width;
- int right = box->border[RIGHT].width;
- int bottom = box->border[BOTTOM].width;
- int left = box->border[LEFT].width;
- int x, y;
- unsigned int i, side;
- int p[8]; /* Box border vertices */
- int z[8]; /* Border vertices */
- bool square_end_1 = false;
- bool square_end_2 = false;
-
- x = x_parent + box->x;
- y = y_parent + box->y;
-
- if (scale != 1.0) {
- top *= scale;
- right *= scale;
- bottom *= scale;
- left *= scale;
- x *= scale;
- y *= scale;
- }
-
- assert(box->style);
-
- /* Calculate border vertices
- *
- * A----------------------+
- * | \ / |
- * | B--------------+ |
- * | | | |
- * | +--------------C |
- * | / \ |
- * +----------------------D
- */
- p[0] = x - left; p[1] = y - top; /* A */
- p[2] = x; p[3] = y; /* B */
- p[4] = x + p_width; p[5] = y + p_height; /* C */
- p[6] = x + p_width + right; p[7] = y + p_height + bottom; /* D */
-
- for (i = 0; i != 4; i++) {
- colour col = 0;
- side = sides[i]; /* plot order */
-
- if (box->border[side].width == 0 ||
- nscss_color_is_transparent(box->border[side].c))
- continue;
-
- switch (side) {
- case LEFT:
- square_end_1 = (top == 0);
- square_end_2 = (bottom == 0);
-
- z[0] = p[0]; z[1] = p[7];
- z[2] = p[2]; z[3] = p[5];
- z[4] = p[2]; z[5] = p[3];
- z[6] = p[0]; z[7] = p[1];
-
- if (nscss_color_is_transparent(box->border[TOP].c) ==
- false &&
- box->border[TOP].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang top corner fully,
- * if top border is opaque */
- z[5] -= top;
- square_end_1 = true;
- }
- if (nscss_color_is_transparent(box->border[BOTTOM].c) ==
- false &&
- box->border[BOTTOM].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang bottom corner fully,
- * if bottom border is opaque */
- z[3] += bottom;
- square_end_2 = true;
- }
-
- col = nscss_color_to_ns(box->border[side].c);
-
- if (!html_redraw_border_plot(side, z, col,
- box->border[side].style,
- box->border[side].width * scale,
- square_end_1 && square_end_2,
- clip, ctx))
- return false;
- break;
- case RIGHT:
- square_end_1 = (top == 0);
- square_end_2 = (bottom == 0);
-
- z[0] = p[6]; z[1] = p[1];
- z[2] = p[4]; z[3] = p[3];
- z[4] = p[4]; z[5] = p[5];
- z[6] = p[6]; z[7] = p[7];
-
- if (nscss_color_is_transparent(box->border[TOP].c) ==
- false &&
- box->border[TOP].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang top corner fully,
- * if top border is opaque */
- z[3] -= top;
- square_end_1 = true;
- }
- if (nscss_color_is_transparent(box->border[BOTTOM].c) ==
- false &&
- box->border[BOTTOM].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang bottom corner fully,
- * if bottom border is opaque */
- z[5] += bottom;
- square_end_2 = true;
- }
-
- col = nscss_color_to_ns(box->border[side].c);
-
- if (!html_redraw_border_plot(side, z, col,
- box->border[side].style,
- box->border[side].width * scale,
- square_end_1 && square_end_2,
- clip, ctx))
- return false;
- break;
- case TOP:
- if (clip->y0 > p[3])
- /* clip rectangle is below border; nothing to
- * plot */
- continue;
-
- square_end_1 = (left == 0);
- square_end_2 = (right == 0);
-
- z[0] = p[2]; z[1] = p[3];
- z[2] = p[0]; z[3] = p[1];
- z[4] = p[6]; z[5] = p[1];
- z[6] = p[4]; z[7] = p[3];
-
- if (box->border[TOP].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[TOP].c ==
- box->border[LEFT].c) {
- /* don't bother overlapping left corner if
- * it's the same colour anyway */
- z[2] += left;
- square_end_1 = true;
- }
- if (box->border[TOP].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[TOP].c ==
- box->border[RIGHT].c) {
- /* don't bother overlapping right corner if
- * it's the same colour anyway */
- z[4] -= right;
- square_end_2 = true;
- }
-
- col = nscss_color_to_ns(box->border[side].c);
-
- if (!html_redraw_border_plot(side, z, col,
- box->border[side].style,
- box->border[side].width * scale,
- square_end_1 && square_end_2,
- clip, ctx))
- return false;
- break;
- case BOTTOM:
- if (clip->y1 < p[5])
- /* clip rectangle is above border; nothing to
- * plot */
- continue;
-
- square_end_1 = (left == 0);
- square_end_2 = (right == 0);
-
- z[0] = p[4]; z[1] = p[5];
- z[2] = p[6]; z[3] = p[7];
- z[4] = p[0]; z[5] = p[7];
- z[6] = p[2]; z[7] = p[5];
-
- if (box->border[BOTTOM].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[BOTTOM].c ==
- box->border[LEFT].c) {
- /* don't bother overlapping left corner if
- * it's the same colour anyway */
- z[4] += left;
- square_end_1 = true;
- }
- if (box->border[BOTTOM].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[BOTTOM].c ==
- box->border[RIGHT].c) {
- /* don't bother overlapping right corner if
- * it's the same colour anyway */
- z[2] -= right;
- square_end_2 = true;
- }
-
- col = nscss_color_to_ns(box->border[side].c);
-
- if (!html_redraw_border_plot(side, z, col,
- box->border[side].style,
- box->border[side].width * scale,
- square_end_1 && square_end_2,
- clip, ctx))
- return false;
- break;
- default:
- assert(side == TOP || side == BOTTOM ||
- side == LEFT || side == RIGHT);
- break;
- }
- }
-
- return true;
-}
-
-
-/**
- * Draw an inline's borders.
- *
- * \param box BOX_INLINE which created the border
- * \param b coordinates of border edge rectangle
- * \param clip cliping area for redrawing border.
- * \param scale scale for redraw
- * \param first true if this is the first rectangle associated with the inline
- * \param last true if this is the last rectangle associated with the inline
- * \param ctx current redraw context
- * \return true if successful, false otherwise
- */
-
-static bool html_redraw_inline_borders(struct box *box, struct rect b,
- const struct rect *clip, float scale, bool first, bool last,
- const struct redraw_context *ctx)
-{
- int top = box->border[TOP].width;
- int right = box->border[RIGHT].width;
- int bottom = box->border[BOTTOM].width;
- int left = box->border[LEFT].width;
- colour col;
- int p[8]; /* Box border vertices */
- int z[8]; /* Border vertices */
- bool square_end_1;
- bool square_end_2;
-
- if (scale != 1.0) {
- top *= scale;
- right *= scale;
- bottom *= scale;
- left *= scale;
- }
-
- /* Calculate border vertices
- *
- * A----------------------+
- * | \ / |
- * | B--------------+ |
- * | | | |
- * | +--------------C |
- * | / \ |
- * +----------------------D
- */
- p[0] = b.x0; p[1] = b.y0; /* A */
- p[2] = first ? b.x0 + left : b.x0; p[3] = b.y0 + top; /* B */
- p[4] = last ? b.x1 - right : b.x1; p[5] = b.y1 - bottom; /* C */
- p[6] = b.x1; p[7] = b.y1; /* D */
-
- assert(box->style);
-
- /* Left */
- square_end_1 = (top == 0);
- square_end_2 = (bottom == 0);
- if (left != 0 && first && nscss_color_is_transparent(
- box->border[LEFT].c) == false) {
- col = nscss_color_to_ns(box->border[LEFT].c);
-
- z[0] = p[0]; z[1] = p[7];
- z[2] = p[2]; z[3] = p[5];
- z[4] = p[2]; z[5] = p[3];
- z[6] = p[0]; z[7] = p[1];
-
- if (nscss_color_is_transparent(box->border[TOP].c) == false &&
- box->border[TOP].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang top corner fully,
- * if top border is opaque */
- z[5] -= top;
- square_end_1 = true;
- }
-
- if (nscss_color_is_transparent(box->border[BOTTOM].c) ==
- false &&
- box->border[BOTTOM].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang bottom corner fully,
- * if bottom border is opaque */
- z[3] += bottom;
- square_end_2 = true;
- }
-
- if (!html_redraw_border_plot(LEFT, z, col,
- box->border[LEFT].style,
- left, square_end_1 && square_end_2,
- clip, ctx))
- return false;
- }
-
- /* Right */
- square_end_1 = (top == 0);
- square_end_2 = (bottom == 0);
- if (right != 0 && last && nscss_color_is_transparent(
- box->border[RIGHT].c) == false) {
- col = nscss_color_to_ns(box->border[RIGHT].c);
-
- z[0] = p[6]; z[1] = p[1];
- z[2] = p[4]; z[3] = p[3];
- z[4] = p[4]; z[5] = p[5];
- z[6] = p[6]; z[7] = p[7];
-
- if (nscss_color_is_transparent(box->border[TOP].c) == false &&
- box->border[TOP].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang top corner fully,
- * if top border is opaque */
- z[3] -= top;
- square_end_1 = true;
- }
-
- if (nscss_color_is_transparent(box->border[BOTTOM].c) ==
- false &&
- box->border[BOTTOM].style !=
- CSS_BORDER_STYLE_DOUBLE) {
- /* make border overhang bottom corner fully,
- * if bottom border is opaque */
- z[5] += bottom;
- square_end_2 = true;
- }
-
- if (!html_redraw_border_plot(RIGHT, z, col,
- box->border[RIGHT].style,
- right, square_end_1 && square_end_2,
- clip, ctx))
- return false;
- }
-
- /* Top */
- square_end_1 = (left == 0);
- square_end_2 = (right == 0);
- if (top != 0 && nscss_color_is_transparent(
- box->border[TOP].c) == false) {
- col = nscss_color_to_ns(box->border[TOP].c);
-
- z[0] = p[2]; z[1] = p[3];
- z[2] = p[0]; z[3] = p[1];
- z[4] = p[6]; z[5] = p[1];
- z[6] = p[4]; z[7] = p[3];
-
- if (first && box->border[TOP].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[TOP].c ==
- box->border[LEFT].c) {
- /* don't bother overlapping left corner if
- * it's the same colour anyway */
- z[2] += left;
- square_end_1 = true;
- }
-
- if (last && box->border[TOP].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[TOP].c ==
- box->border[RIGHT].c) {
- /* don't bother overlapping right corner if
- * it's the same colour anyway */
- z[4] -= right;
- square_end_2 = true;
- }
-
- if (!html_redraw_border_plot(TOP, z, col,
- box->border[TOP].style,
- top, square_end_1 && square_end_2,
- clip, ctx))
+ if (!highlighted) {
+ res = ctx->plot->text(ctx,
+ &plot_fstyle,
+ x,
+ y + (int) (height * 0.75 * scale),
+ utf8_text,
+ utf8_len);
+ if (res != NSERROR_OK) {
return false;
- }
-
- /* Bottom */
- square_end_1 = (left == 0);
- square_end_2 = (right == 0);
- if (bottom != 0 && nscss_color_is_transparent(
- box->border[BOTTOM].c) == false) {
- col = nscss_color_to_ns(box->border[BOTTOM].c);
-
- z[0] = p[4]; z[1] = p[5];
- z[2] = p[6]; z[3] = p[7];
- z[4] = p[0]; z[5] = p[7];
- z[6] = p[2]; z[7] = p[5];
-
- if (first && box->border[BOTTOM].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[BOTTOM].c ==
- box->border[LEFT].c) {
- /* don't bother overlapping left corner if
- * it's the same colour anyway */
- z[4] += left;
- square_end_1 = true;
- }
-
- if (last && box->border[BOTTOM].style ==
- CSS_BORDER_STYLE_SOLID &&
- box->border[BOTTOM].c ==
- box->border[RIGHT].c) {
- /* don't bother overlapping right corner if
- * it's the same colour anyway */
- z[2] -= right;
- square_end_2 = true;
}
-
- if (!html_redraw_border_plot(BOTTOM, z, col,
- box->border[BOTTOM].style,
- bottom, square_end_1 && square_end_2,
- clip, ctx))
- return false;
}
-
return true;
}
@@ -1152,42 +360,85 @@ static bool html_redraw_inline_borders(struct box *box, struct rect b,
static bool html_redraw_checkbox(int x, int y, int width, int height,
bool selected, const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
- double z = width * 0.15;
- if (z == 0)
+ double z;
+ nserror res;
+ struct rect rect;
+
+ z = width * 0.15;
+ if (z == 0) {
z = 1;
+ }
- if (!(plot->rectangle(x, y, x + width, y + height,
- plot_style_fill_wbasec) &&
- plot->line(x, y, x + width, y, plot_style_stroke_darkwbasec) &&
- plot->line(x, y, x, y + height, plot_style_stroke_darkwbasec) &&
- plot->line(x + width, y, x + width, y + height,
- plot_style_stroke_lightwbasec) &&
- plot->line(x, y + height, x + width, y + height,
- plot_style_stroke_lightwbasec)))
+ rect.x0 = x;
+ rect.y0 = y ;
+ rect.x1 = x + width;
+ rect.y1 = y + height;
+ res = ctx->plot->rectangle(ctx, plot_style_fill_wbasec, &rect);
+ if (res != NSERROR_OK) {
return false;
+ }
+
+ /* dark line across top */
+ rect.y1 = y;
+ res = ctx->plot->line(ctx, plot_style_stroke_darkwbasec, &rect);
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ /* dark line across left */
+ rect.x1 = x;
+ rect.y1 = y + height;
+ res = ctx->plot->line(ctx, plot_style_stroke_darkwbasec, &rect);
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ /* light line across right */
+ rect.x0 = x + width;
+ rect.x1 = x + width;
+ res = ctx->plot->line(ctx, plot_style_stroke_lightwbasec, &rect);
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ /* light line across bottom */
+ rect.x0 = x;
+ rect.y0 = y + height;
+ res = ctx->plot->line(ctx, plot_style_stroke_lightwbasec, &rect);
+ if (res != NSERROR_OK) {
+ return false;
+ }
if (selected) {
if (width < 12 || height < 12) {
/* render a solid box instead of a tick */
- if (!plot->rectangle(x + z + z, y + z + z,
- x + width - z, y + height - z,
- plot_style_fill_wblobc))
+ rect.x0 = x + z + z;
+ rect.y0 = y + z + z;
+ rect.x1 = x + width - z;
+ rect.y1 = y + height - z;
+ res = ctx->plot->rectangle(ctx, plot_style_fill_wblobc, &rect);
+ if (res != NSERROR_OK) {
return false;
+ }
} else {
/* render a tick, as it'll fit comfortably */
- if (!(plot->line(x + width - z,
- y + z,
- x + (z * 3),
- y + height - z,
- plot_style_stroke_wblobc) &&
-
- plot->line(x + (z * 3),
- y + height - z,
- x + z + z,
- y + (height / 2),
- plot_style_stroke_wblobc)))
+ rect.x0 = x + width - z;
+ rect.y0 = y + z;
+ rect.x1 = x + (z * 3);
+ rect.y1 = y + height - z;
+ res = ctx->plot->line(ctx, plot_style_stroke_wblobc, &rect);
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ rect.x0 = x + (z * 3);
+ rect.y0 = y + height - z;
+ rect.x1 = x + z + z;
+ rect.y1 = y + (height / 2);
+ res = ctx->plot->line(ctx, plot_style_stroke_wblobc, &rect);
+ if (res != NSERROR_OK) {
return false;
+ }
}
}
return true;
@@ -1208,40 +459,52 @@ static bool html_redraw_checkbox(int x, int y, int width, int height,
static bool html_redraw_radio(int x, int y, int width, int height,
bool selected, const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
+ nserror res;
/* plot background of radio button */
- if (!plot->disc(x + width * 0.5,
- y + height * 0.5,
- width * 0.5 - 1,
- plot_style_fill_wbasec))
+ res = ctx->plot->disc(ctx,
+ plot_style_fill_wbasec,
+ x + width * 0.5,
+ y + height * 0.5,
+ width * 0.5 - 1);
+ if (res != NSERROR_OK) {
return false;
+ }
/* plot dark arc */
- if (!plot->arc(x + width * 0.5,
- y + height * 0.5,
- width * 0.5 - 1,
- 45,
- 225,
- plot_style_fill_darkwbasec))
+ res = ctx->plot->arc(ctx,
+ plot_style_fill_darkwbasec,
+ x + width * 0.5,
+ y + height * 0.5,
+ width * 0.5 - 1,
+ 45,
+ 225);
+ if (res != NSERROR_OK) {
return false;
+ }
/* plot light arc */
- if (!plot->arc(x + width * 0.5,
- y + height * 0.5,
- width * 0.5 - 1,
- 225,
- 45,
- plot_style_fill_lightwbasec))
+ res = ctx->plot->arc(ctx,
+ plot_style_fill_lightwbasec,
+ x + width * 0.5,
+ y + height * 0.5,
+ width * 0.5 - 1,
+ 225,
+ 45);
+ if (res != NSERROR_OK) {
return false;
+ }
if (selected) {
/* plot selection blob */
- if (!plot->disc(x + width * 0.5,
- y + height * 0.5,
- width * 0.3 - 1,
- plot_style_fill_wblobc))
+ res = ctx->plot->disc(ctx,
+ plot_style_fill_wblobc,
+ x + width * 0.5,
+ y + height * 0.5,
+ width * 0.3 - 1);
+ if (res != NSERROR_OK) {
return false;
+ }
}
return true;
@@ -1258,12 +521,14 @@ static bool html_redraw_radio(int x, int y, int width, int height,
* \param box box of input
* \param scale scale for redraw
* \param background_colour current background colour
+ * \param len_ctx Length conversion context
* \param ctx current redraw context
* \return true if successful, false otherwise
*/
static bool html_redraw_file(int x, int y, int width, int height,
struct box *box, float scale, colour background_colour,
+ const nscss_len_ctx *len_ctx,
const struct redraw_context *ctx)
{
int text_width;
@@ -1272,13 +537,14 @@ static bool html_redraw_file(int x, int y, int width, int height,
plot_font_style_t fstyle;
nserror res;
- font_plot_style_from_css(box->style, &fstyle);
+ font_plot_style_from_css(len_ctx, box->style, &fstyle);
fstyle.background = background_colour;
- if (box->gadget->value)
+ if (box->gadget->value) {
text = box->gadget->value;
- else
+ } else {
text = messages_get("Form_Drop");
+ }
length = strlen(text);
res = guit->layout->width(&fstyle, text, length, &text_width);
@@ -1292,13 +558,21 @@ static bool html_redraw_file(int x, int y, int width, int height,
x = x + 4;
}
- return ctx->plot->text(x, y + height * 0.75, text, length, &fstyle);
+ res = ctx->plot->text(ctx, &fstyle, x, y + height * 0.75, text, length);
+ if (res != NSERROR_OK) {
+ return false;
+ }
+ return true;
}
/**
* Plot background images.
*
+ * The reason for the presence of \a background is the backwards compatibility
+ * mess that is backgrounds on &lt;body&gt;. The background will be drawn relative
+ * to \a box, using the background information contained within \a background.
+ *
* \param x coordinate of box
* \param y coordinate of box
* \param box box to draw background image of
@@ -1306,19 +580,17 @@ static bool html_redraw_file(int x, int y, int width, int height,
* \param clip current clip rectangle
* \param background_colour current background colour
* \param background box containing background details (usually \a box)
- * \param ctx current redraw context
+ * \param len_ctx Length conversion context
+ * \param ctx current redraw context
* \return true if successful, false otherwise
- *
- * The reason for the presence of ::background is the backwards compatibility
- * mess that is backgrounds on &lt;body&gt;. The background will be drawn relative
- * to \a box, using the background information contained within \a background.
*/
static bool html_redraw_background(int x, int y, struct box *box, float scale,
const struct rect *clip, colour *background_colour,
- struct box *background, const struct redraw_context *ctx)
+ struct box *background,
+ const nscss_len_ctx *len_ctx,
+ const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
bool repeat_x = false;
bool repeat_y = false;
bool plot_colour = true;
@@ -1336,6 +608,7 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
.fill_type = PLOT_OP_TYPE_SOLID,
.fill_colour = *background_colour,
};
+ nserror res;
if (ctx->background_images == false)
return true;
@@ -1388,20 +661,20 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
css_computed_background_position(background->style,
&hpos, &hunit, &vpos, &vunit);
if (hunit == CSS_UNIT_PCT) {
- x += (width -
+ x += (width -
content_get_width(background->background)) *
scale * FIXTOFLT(hpos) / 100.;
} else {
- x += (int) (FIXTOFLT(nscss_len2px(hpos, hunit,
+ x += (int) (FIXTOFLT(nscss_len2px(len_ctx, hpos, hunit,
background->style)) * scale);
}
if (vunit == CSS_UNIT_PCT) {
- y += (height -
+ y += (height -
content_get_height(background->background)) *
scale * FIXTOFLT(vpos) / 100.;
} else {
- y += (int) (FIXTOFLT(nscss_len2px(vpos, vunit,
+ y += (int) (FIXTOFLT(nscss_len2px(len_ctx, vpos, vunit,
background->style)) * scale);
}
}
@@ -1451,10 +724,10 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
/* if the background content is opaque there
* is no need to plot underneath it.
*/
- if ((r.x0 >= r.x1) ||
+ if ((r.x0 >= r.x1) ||
(r.y0 >= r.y1) ||
(nscss_color_is_transparent(bgcol) == false) ||
- ((clip_box->background != NULL) &&
+ ((clip_box->background != NULL) &&
content_get_opaque(clip_box->background)))
continue;
}
@@ -1465,10 +738,12 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
if (nscss_color_is_transparent(bgcol) == false) {
*background_colour = nscss_color_to_ns(bgcol);
pstyle_fill_bg.fill_colour = *background_colour;
- if (plot_colour)
- if (!plot->rectangle(r.x0, r.y0, r.x1, r.y1,
- &pstyle_fill_bg))
+ if (plot_colour) {
+ res = ctx->plot->rectangle(ctx, &pstyle_fill_bg, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
+ }
}
/* and plot the image */
if (plot_content) {
@@ -1492,8 +767,10 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
struct content_redraw_data bg_data;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
bg_data.x = x;
bg_data.y = y;
@@ -1530,16 +807,17 @@ static bool html_redraw_background(int x, int y, struct box *box, float scale,
* \param first true if this is the first rectangle associated with the inline
* \param last true if this is the last rectangle associated with the inline
* \param background_colour updated to current background colour if plotted
- * \param ctx current redraw context
+ * \param len_ctx Length conversion context
+ * \param ctx current redraw context
* \return true if successful, false otherwise
*/
static bool html_redraw_inline_background(int x, int y, struct box *box,
float scale, const struct rect *clip, struct rect b,
bool first, bool last, colour *background_colour,
+ const nscss_len_ctx *len_ctx,
const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
struct rect r = *clip;
bool repeat_x = false;
bool repeat_y = false;
@@ -1552,6 +830,7 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
.fill_type = PLOT_OP_TYPE_SOLID,
.fill_colour = *background_colour,
};
+ nserror res;
plot_content = (box->background != NULL);
@@ -1564,7 +843,7 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
case CSS_BACKGROUND_REPEAT_REPEAT:
repeat_x = repeat_y = true;
/* optimisation: only plot the colour if
- * bitmap is not opaque
+ * bitmap is not opaque
*/
plot_colour = !content_get_opaque(box->background);
break;
@@ -1589,15 +868,15 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
&hpos, &hunit, &vpos, &vunit);
if (hunit == CSS_UNIT_PCT) {
x += (b.x1 - b.x0 -
- content_get_width(box->background) *
+ content_get_width(box->background) *
scale) * FIXTOFLT(hpos) / 100.;
- if (!repeat_x && ((hpos < 2 && !first) ||
+ if (!repeat_x && ((hpos < 2 && !first) ||
(hpos > 98 && !last))){
plot_content = false;
}
} else {
- x += (int) (FIXTOFLT(nscss_len2px(hpos, hunit,
+ x += (int) (FIXTOFLT(nscss_len2px(len_ctx, hpos, hunit,
box->style)) * scale);
}
@@ -1606,7 +885,7 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
content_get_height(box->background) *
scale) * FIXTOFLT(vpos) / 100.;
} else {
- y += (int) (FIXTOFLT(nscss_len2px(vpos, vunit,
+ y += (int) (FIXTOFLT(nscss_len2px(len_ctx, vpos, vunit,
box->style)) * scale);
}
}
@@ -1618,10 +897,12 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
*background_colour = nscss_color_to_ns(bgcol);
pstyle_fill_bg.fill_colour = *background_colour;
- if (plot_colour)
- if (!plot->rectangle(r.x0, r.y0, r.x1, r.y1,
- &pstyle_fill_bg))
+ if (plot_colour) {
+ res = ctx->plot->rectangle(ctx, &pstyle_fill_bg, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
+ }
}
/* and plot the image */
if (plot_content) {
@@ -1644,8 +925,10 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
struct content_redraw_data bg_data;
- if (!plot->clip(&r))
+ res = ctx->plot->clip(ctx, &r);
+ if (res != NSERROR_OK) {
return false;
+ }
bg_data.x = x;
bg_data.y = y;
@@ -1678,28 +961,36 @@ static bool html_redraw_inline_background(int x, int y, struct box *box,
* \return true if successful, false otherwise
*/
-static bool html_redraw_text_decoration_inline(struct box *box, int x, int y,
- float scale, colour colour, float ratio,
- const struct redraw_context *ctx)
+static bool
+html_redraw_text_decoration_inline(struct box *box,
+ int x, int y,
+ float scale,
+ colour colour,
+ float ratio,
+ const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
struct box *c;
plot_style_t plot_style_box = {
.stroke_type = PLOT_OP_TYPE_SOLID,
.stroke_colour = colour,
};
+ nserror res;
+ struct rect rect;
for (c = box->next;
- c && c != box->inline_end;
- c = c->next) {
- if (c->type != BOX_TEXT)
+ c && c != box->inline_end;
+ c = c->next) {
+ if (c->type != BOX_TEXT) {
continue;
- if (!plot->line((x + c->x) * scale,
- (y + c->y + c->height * ratio) * scale,
- (x + c->x + c->width) * scale,
- (y + c->y + c->height * ratio) * scale,
- &plot_style_box))
+ }
+ rect.x0 = (x + c->x) * scale;
+ rect.y0 = (y + c->y + c->height * ratio) * scale;
+ rect.x1 = (x + c->x + c->width) * scale;
+ rect.y1 = (y + c->y + c->height * ratio) * scale;
+ res = ctx->plot->line(ctx, &plot_style_box, &rect);
+ if (res != NSERROR_OK) {
return false;
+ }
}
return true;
}
@@ -1718,28 +1009,34 @@ static bool html_redraw_text_decoration_inline(struct box *box, int x, int y,
* \return true if successful, false otherwise
*/
-static bool html_redraw_text_decoration_block(struct box *box, int x, int y,
- float scale, colour colour, float ratio,
- const struct redraw_context *ctx)
+static bool
+html_redraw_text_decoration_block(struct box *box,
+ int x, int y,
+ float scale,
+ colour colour,
+ float ratio,
+ const struct redraw_context *ctx)
{
- const struct plotter_table *plot = ctx->plot;
struct box *c;
plot_style_t plot_style_box = {
.stroke_type = PLOT_OP_TYPE_SOLID,
.stroke_colour = colour,
};
+ nserror res;
+ struct rect rect;
/* draw through text descendants */
for (c = box->children; c; c = c->next) {
if (c->type == BOX_TEXT) {
- if (!plot->line((x + c->x) * scale,
- (y + c->y + c->height * ratio) * scale,
- (x + c->x + c->width) * scale,
- (y + c->y + c->height * ratio) * scale,
- &plot_style_box))
+ rect.x0 = (x + c->x) * scale;
+ rect.y0 = (y + c->y + c->height * ratio) * scale;
+ rect.x1 = (x + c->x + c->width) * scale;
+ rect.y1 = (y + c->y + c->height * ratio) * scale;
+ res = ctx->plot->line(ctx, &plot_style_box, &rect);
+ if (res != NSERROR_OK) {
return false;
- } else if (c->type == BOX_INLINE_CONTAINER ||
- c->type == BOX_BLOCK) {
+ }
+ } else if ((c->type == BOX_INLINE_CONTAINER) || (c->type == BOX_BLOCK)) {
if (!html_redraw_text_decoration_block(c,
x + c->x, y + c->y,
scale, colour, ratio, ctx))
@@ -1785,7 +1082,7 @@ static bool html_redraw_text_decoration(struct box *box,
if (!box->inline_end)
return true;
for (i = 0; i != NOF_ELEMENTS(decoration); i++)
- if (css_computed_text_decoration(box->style) &
+ if (css_computed_text_decoration(box->style) &
decoration[i])
if (!html_redraw_text_decoration_inline(box,
x_parent, y_parent, scale,
@@ -1793,7 +1090,7 @@ static bool html_redraw_text_decoration(struct box *box,
return false;
} else {
for (i = 0; i != NOF_ELEMENTS(decoration); i++)
- if (css_computed_text_decoration(box->style) &
+ if (css_computed_text_decoration(box->style) &
decoration[i])
if (!html_redraw_text_decoration_block(box,
x_parent + box->x,
@@ -1830,7 +1127,7 @@ static bool html_redraw_text_box(const html_content *html, struct box *box,
bool excluded = (box->object != NULL);
plot_font_style_t fstyle;
- font_plot_style_from_css(box->style, &fstyle);
+ font_plot_style_from_css(&html->len_ctx, box->style, &fstyle);
fstyle.background = current_background_color;
if (!text_redraw(box->text, box->length, box->byte_offset,
@@ -1924,6 +1221,7 @@ bool html_redraw_box(const html_content *html, struct box *box,
int padding_left, padding_top, padding_width, padding_height;
int border_left, border_top, border_right, border_bottom;
struct rect r;
+ struct rect rect;
int x_scrolled, y_scrolled;
struct box *bg_box = NULL;
bool has_x_scroll, has_y_scroll;
@@ -2067,19 +1365,21 @@ bool html_redraw_box(const html_content *html, struct box *box,
}
/* if visibility is hidden render children only */
- if (box->style && css_computed_visibility(box->style) ==
+ if (box->style && css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN) {
- if ((plot->group_start) && (!plot->group_start("hidden box")))
+ if ((ctx->plot->group_start) &&
+ (ctx->plot->group_start(ctx, "hidden box") != NSERROR_OK))
return false;
if (!html_redraw_box_children(html, box, x_parent, y_parent,
&r, scale, current_background_color, ctx))
return false;
- return ((!plot->group_end) || (plot->group_end()));
+ return ((!ctx->plot->group_end) || (ctx->plot->group_end(ctx) == NSERROR_OK));
}
- if ((plot->group_start) && (!plot->group_start("vis box")))
+ if ((ctx->plot->group_start) &&
+ (ctx->plot->group_start(ctx,"vis box") != NSERROR_OK)) {
return false;
-
+ }
if (box->style != NULL &&
css_computed_position(box->style) ==
@@ -2089,21 +1389,25 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* We have an absolutly positioned box with a clip rect */
if (css_rect.left_auto == false)
r.x0 = x - border_left + FIXTOINT(nscss_len2px(
+ &html->len_ctx,
css_rect.left, css_rect.lunit,
box->style));
if (css_rect.top_auto == false)
r.y0 = y - border_top + FIXTOINT(nscss_len2px(
+ &html->len_ctx,
css_rect.top, css_rect.tunit,
box->style));
if (css_rect.right_auto == false)
r.x1 = x - border_left + FIXTOINT(nscss_len2px(
+ &html->len_ctx,
css_rect.right, css_rect.runit,
box->style));
if (css_rect.bottom_auto == false)
r.y1 = y - border_top + FIXTOINT(nscss_len2px(
+ &html->len_ctx,
css_rect.bottom, css_rect.bunit,
box->style));
@@ -2115,9 +1419,10 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* Nothing to do for invalid rectangles */
if (r.x0 >= r.x1 || r.y0 >= r.y1)
/* not an error */
- return ((!plot->group_end) || (plot->group_end()));
+ return ((!ctx->plot->group_end) ||
+ (ctx->plot->group_end(ctx) == NSERROR_OK));
/* clip to it */
- if (!plot->clip(&r))
+ if (ctx->plot->clip(ctx, &r) != NSERROR_OK)
return false;
} else if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
@@ -2130,14 +1435,15 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* no point trying to draw 0-width/height boxes */
if (r.x0 == r.x1 || r.y0 == r.y1)
/* not an error */
- return ((!plot->group_end) || (plot->group_end()));
+ return ((!ctx->plot->group_end) ||
+ (ctx->plot->group_end(ctx) == NSERROR_OK));
/* clip to it */
- if (!plot->clip(&r))
+ if (ctx->plot->clip(ctx, &r) != NSERROR_OK)
return false;
} else {
/* clip box is fine, clip to it */
r = *clip;
- if (!plot->clip(&r))
+ if (ctx->plot->clip(ctx, &r) != NSERROR_OK)
return false;
}
@@ -2191,25 +1497,26 @@ bool html_redraw_box(const html_content *html, struct box *box,
if ((p.x0 < p.x1) && (p.y0 < p.y1)) {
/* plot background */
if (!html_redraw_background(x, y, box, scale, &p,
- &current_background_color, bg_box, ctx))
+ &current_background_color, bg_box,
+ &html->len_ctx, ctx))
return false;
/* restore previous graphics window */
- if (!plot->clip(&r))
+ if (ctx->plot->clip(ctx, &r) != NSERROR_OK)
return false;
}
}
/* borders for block level content and replaced inlines */
- if (box->style && box->type != BOX_TEXT &&
- box->type != BOX_INLINE_END &&