Institute of Informatics & Telecommunications – NCSR “Demokritos” TkGecko: Another Attempt for an HTML Renderer for Tk Georgios Petasis Software and Knowledge.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Internet Basics Instructors : Connie Hutchison & Christopher McCoy.
PNS: Personalized Multi-Source News Delivery Georgios Paliouras(1), Mouzakidis Alexandros(1), Christos Ntoutsis(2), Angelos Alexopoulos(3), Christos Skourlas(2)
Java Script Session1 INTRODUCTION.
The Web Warrior Guide to Web Design Technologies
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Mozilla Technologies Sept. 30, History of Mozilla Mosaic -> Netscape 1.0 -> Netscape 5.0 Netscape 5.0 was announced to be an Open Source project.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
Tomcat Configuration A Very, Very, Very Brief Overview.
The Internet 8th Edition Tutorial 1 Browser Basics.
COMPUTER TERMS PART 1. COOKIE A cookie is a small amount of data generated by a website and saved by your web browser. Its purpose is to remember information.
WEB BROWSERS. W EB B ROWSER B ASICS Define: a software application for retrieving, presenting, and traversing information resources on the World Wide.
1 Lesson 1 Quick HTML Know-How HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Quick Tour of the Web Technologies: The BIG picture LECTURE A bird’s eye view of the different web technologies that we shall explore and study.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
4.1 JavaScript Introduction
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
HTTP; The World Wide Web Protocol
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Institute of Informatics & Telecommunications – NCSR “Demokritos” Ellogon and the challenge of threads Georgios Petasis Software and Knowledge Engineering.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Institute of Informatics & Telecommunications – NCSR “Demokritos” TkRibbon: Windows Ribbons for Tk Georgios Petasis Software and Knowledge Engineering.
Silverlight Hitesh Trivedi Computer Science B.Tech A-Sec J.I.E.T.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
Nilanthi Seneviratne Meghavi Doshi iAnnotate: Digital Ink Annotation on the Web.
Flash & JavaScript Mariela Hristova October 19, 2004 INF 385E – Fall 2004 – School of Information.
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
Objective Understand concepts used to web-based digital media. Course Weight : 5%
Institute of Informatics & Telecommunications – NCSR “Demokritos” TileQt and TileGtk: current status Georgios Petasis Software and Knowledge Engineering.
An Introduction to JavaScript Summarized from Chapter 6 of “Web Programming: Building Internet Applications”, 3 rd Edition.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Scripting with the DOM Ellen Pearlman Eileen Mullin Programming the Web.
1 John Magee 9 November 2012 CS120 Lecture 17: The World Wide Web and HTML Web Publishing.
Conceptual Architecture of Mozilla Firefox (version ) Jared Haines Iris Lai John,Chun-Hung,Chiu Josh Fairhead June 5, 2007.
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
Prasanna K. Agenda Setting Up the Environment Introduction Extension Essentials Building a Extension Demo Users Build a Banking a Trojan Building the.
Chapter 5: Windows and Frames
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Web Automation Testing With Selenium By Rajesh Kanade.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
Department of Computer Science Internet Performance Measurements using Firefox Extensions Scot L. DeDeo Professor Craig Wills.
JavaScript Tutorial 1 - Introduction to JavaScript1 Tutorial 1 Introduction to JavaScript Section A – Programming, HTML, and JavaScript.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
Webview and Web services. Web Apps You can make your web content available to users in two ways in a traditional web browser in an Android application,
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
Institute of Informatics & Telecommunications – NCSR “Demokritos” TkDND: a cross-platform drag’n’drop package Georgios Petasis Software and Knowledge Engineering.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
TOPIC II Dynamic HTML Prepared by: Nimcan Cabd Cali.
Porting a large scale enterprise application from Tcl/Tk 8.4 to 8.5 Prashant Thakre, Tushar Gupta {prashant_thakre, Gaurav Bansal.
GRITS 2011: Benny Chan. Browsers as Application GUI  Modern Browsers are basically an HTML and a power JavaScript rendering engine.  As the internet.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
JavaScript and Ajax (Internet Background) Week 1 Web site:
Introduction to the World Wide Web & Internet CIS 101.
1 HTML: HyperText Markup Language Representation and Management of Data on the Internet.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Week-6 (Lecture-1) Publishing and Browsing the Web: Publishing: 1. upload the following items on the web Google documents Spreadsheets Presentations drawings.
Open Solutions for a Changing World™ Eddy Kleinjan Copyright 2005, Data Access WordwideNew Techniques for Building Web Applications June 6-9, 2005 Key.
2.2 Internet Basics.
Introduction Web Environments
Dongwhan Kim Annie Zhao Steven Lawrance
Web Application Development Using PHP
Presentation transcript:

Institute of Informatics & Telecommunications – NCSR “Demokritos” TkGecko: Another Attempt for an HTML Renderer for Tk Georgios Petasis Software and Knowledge Engineering Laboratory, Institute of Informatics and Telecommunications, National Centre for Scientific Research “Demokritos”, Athens, Greece

Overview  Tk and HTML –Tkhtml & Hv3 –Embedding popular browsers  Gecko –TkGecko: embedding Gecko  Examples –Rendering a URL –Retrieving information from the DOM tree  Conclusions 2 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk

Tk and HTML  Displaying HTML in Tk has always been an issue  This shortcoming has been the motivation for a large number of attempts: –From simple rendering of HTML subsets on the text or canvas widget i.e. for implementing help systems) –To full-featured Web browsers like Hv3 or BrowseX  The relevant Wiki page lists more than 20 projects –Does not cover all approaches trying to embed existing browsers in Tk (COM, X11, etc) 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 3

Tkhtml  Tkhtml is one of the most popular extensions –An implementation of an HTML rendering component for the Tk toolkit in C –Actively maintained –Supports many HTML 4 features CCS JavaScript (through the Simple ECMAScript Engine)  Despite the impressive supported list of features, Tkhtml is missing features like: –Complete JavaScript support –Flash –Java, Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 4

Embedding popular browsers  Several approaches that try to embed a full- featured Web browser have been presented  Internet Explorer is a popular target (Windows) –Through COM, either with Tcom or Optcl  Under Unix, a similar effort has been made by the Entice project –Which embeds Firefox through the TkXext extension for X11  TkGecko is a similar approach: tries to embed a popular and cross-platform browser –The rendering engine of Firefox was chosen, known as Gecko 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 5

TkGecko  Not the first project that tries to embed Gecko –An earlier attempt has been sponsored by a company(Eolas Technologies) –Presented at the 7 th Tcl conference (2000) –Closed-source project  Newer TkGecko is open source –Under the BSD license –Sources hosted at SourceForge 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 6

Mozilla’s Gecko  Gecko is a cross-platform, standards-compliant and feature-complete rendering engine  Quite popular: –Firefox, Thunderbird, Camino, Flock, SeaMonkey, k-Meleon, Netscape 9, etc.  Quite complex –Its complexity is evident not only by the size of its source code, but also by the effort required in order to embed it in a C++ application  Embedding is performed through XPCOM –A protocol similar to COM 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 7

Embedding Gecko  Documentation for embedding Gecko is available  Embedding Gecko is not easy: –Stability of the API: more fluid than stable Multiple embedding APIs available A new one has appeared since TkGecko development started (less than a year ago!) –Complexity of the API: functionality scattered among many interfaces –Thread-safety: unknown internal threading model –Dependence upon toolkits: i.e. GTK+ under Linux The toolkit must be initialised along Tk, and Tk windows to be mapped in windows of the toolkit 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 8

TkGecko  TkGecko implements a large percent of the required interfaces –Supporting a wide range of features  The source code is a mixture of static code, and code dynamically generated through SWIG –SWIG is mostly used to interface DOM classes  Building TkGecko is not difficult, due to CMake –Provided that a Development XULRunner SDK is available  Under Linux, GTK+ is initialised in a separate thread, under which Gecko is embedded –Messages are exchanged among this thread and Tk ones 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 9

Using TkGecko: an example (1) package require Tk package require tkgecko set paths { {C:\Program Files (x86)\Mozilla Firefox\xpcom.dll} {C:\Program Files\Mozilla Firefox\xpcom.dll} /usr/lib64/xulrunner-1.9.1/libxpcom.so /usr/lib64/xulrunner-sdk-1.9.1/sdk/lib/libxpcom.so /usr/lib/xulrunner-1.9.1/libxpcom.so /usr/lib/xulrunner-sdk-1.9.1/sdk/lib/libxpcom.so } set xpcom [tkgecko::initializeXPCOM {*}$paths] puts "XPCOM library: $xpcom" 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 10 CODE Initialise XPCOM/XUL Create a TkGecko widget Register Virtual Events Callbacks

Using TkGecko: an example (2) set xuldir [file nativename [file dirname $xpcom]] set appdir {} ;# Same as xuldir... set profiledir [file native [file normalize ~/.tkgecko]] puts "XUL directory: $xuldir" puts "APP directory: $appdir" puts "Profile directory: $profiledir" puts "tkgecko::initializeXUL:\ [tkgecko::initializeXUL $xuldir $appdir $profiledir]" puts ========================================================= puts " Initialisation completed!" puts ========================================================= 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 11

TkGecko: creating a widget set URI grid [ttk::button.back -text { < } -command onBack] \ [ttk::button.forward –text { > } -command onForward] \ [ttk::button.reload -text {Reload} –command onReload] \ [ttk::entry.uri -textvariable URI] \ [ttk::button.load -text {Load} -command onLoad] \ -padx 2 -pady 2 -sticky snew grid [tkgecko::browser.browser -width 800 \ -height 600 -highlightthickness 1] \ -columnspan 5 -sticky snew -padx 2 -pady 2 grid [ttk::label.status -textvariable STATUS] - - -\ [ttk::progressbar.progress] \ -sticky snew -padx 2 -pady 2 grid columnconfigure. 3 -weight 1 grid rowconfigure. 1 -weight 1 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 12

TkGecko: adding bindings ## Bindings: bind.browser > {set ::STATUS [lindex %d 0]} bind.browser > {set ::STATUS [lindex %d 0]} bind.browser > {set ::STATUS [lindex %d 0]} bind.browser > {wm title. [lindex %d 0]} bind.browser > {onProgress {*}%d} ## Other virtual events... # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} # bind.browser > {} bind.browser > {onLoadInit {*}%d} bind.browser > {onLoadFinish {*}%d} 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 13

Callbacks (1) proc onLoadInit {args} { puts " >: $args".progress state !disabled.progress configure -maximum 100 -value 0 };# onLoadInit proc onLoadFinish {args} { puts " >: $args".progress state disabled update idle after 1000 {set ::STATUS {}} testDOM };# onLoadFinish proc onLoad {} {.browser navigate $::URI onNewPage };# onLoad proc onBack {} {.browser back };# onBack proc onForward {} {.browser forward };# onForward proc onReload {} {.browser reload onNewPage };# onReload 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 14

Callbacks (2) proc onNewPage {} { if {[.browser can_go_back]} {.back state !disabled} else {.back state disabled} if {[.browser can_go_forward]} {.forward state !disabled} else {.forward state disabled} };# onNewPage proc onProgress {uri curUriProgress maxUriProgress curTotalProgress maxTotalProgress} { # puts "$curTotalProgress $maxTotalProgress" set curTotalProgress [expr {abs($curTotalProgress)}] set maxTotalProgress [expr {abs($maxTotalProgress)}] if {$maxTotalProgress >= $curTotalProgress} {.progress configure -maximum $maxTotalProgress \ -value $curTotalProgress } };# onProgress 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 15

Result 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 16

TkGecko widget subcommands  pathname focus_activate  pathname focus_deactivate  pathname navigate URI ?flags?  pathname load  pathname parse ?-base base_uri? ?-mime mime_type? ?--? Data  pathname stop ?flags?  pathname save ?-data_dir data_dir? ?-mime mime_type? ?-flags flags? ?-pflags persist_flags? ?-col wrap_col? ?--? uri 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 17

TkGecko and the DOM tree  Extensive support for accessing the DOM tree is provided –nsIDOMHTMLCollection –nsIDOMNodeList –nsIDOMNamedNodeMap –nsIDOMNode –nsIDOMElement –nsIDOMHTMLElement –nsIDOMAttr –nsIDOMDocument –nsIDOMHTMLDocument –nsIWebBrowserPersist –nsIDocumentEncoder –nsIWebBrowserSetup –nsIWebNavigation 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 18

Example: retrieving HTML set dom [$browser document] set body [$dom GetBody] set content [$dom SerializeToString $body] $body –delete $dom -delete 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 19

Example: retrieving formatted text set dom [$browser document] set body [$dom GetBody] set encoder [$dom GetEncoder text/plain 0] if {$encoder ne "NULL"} { $encoder SetNode $body set content [$encoder EncodeToString] $encoder SetNode NULL } else { set content "NULL encoder!" } $body -delete $encoder –delete $dom -delete 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 20

Conclusions  TkGecko embeds Gecko under Tk –Supported platforms: Windows and Linux  Basic functionality already available –Displaying HTML –Manipulating DOM tree  Thread safety is an issue –Not tested at all  Some stability issues do exist –Random lockups after a number of pages 15 Oct 2010TkGecko: Another Attempt of an HTML Renderer for Tk 21

Thank you!