eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTMLDocumentPainter':

Home

everywhere
www.exept.de
for:
[back]

Class: HTMLDocumentPainter


Inheritance:

   Object
   |
   +--HTMLDocumentInterpreter
      |
      +--HTMLDocumentPainter

Package:
stx:libhtml
Category:
System-Documentation
Version:
rev: 1.291 date: 2009/11/02 16:58:52
user: cg
file: HTMLDocumentPainter.st directory: libhtml
module: stx stc-classLibrary: libhtml
Author:
Claus Gittinger

Description:


This one is responsible to paint a document (a linked list
of HTMLElements) into some drawable.

The major entry points are:
    format:for:resolver:style:
            to scan the list for applets, widgets
            and preformat it.

    reformatDocument
            to reformat the document after a size change of the            
            drawable.

    displayX:y:width:height:on:
            to redraw (part of) the document.


Related information:

    HTMLParser
    HTMLDocumentView

Class protocol:

initialization
o  initialize


Instance protocol:

accessing
o  applets
return a collection of my applets

o  arrayOfHeaderIndex
returns current header index

o  forms
return a collection of my forms

o  listOfHeaders
returns current list of headers

o  scriptObject
return my scriptObject - if any

accessing-private
o  currentBGColor

o  currentColIndex

o  currentColor

o  currentElement

o  currentFont

o  currentFontAscent

o  currentFontAvgHeight

o  currentFontHeight

o  currentForm

o  currentIndentOffset

o  currentLeftIndent

o  currentRightIndent

o  currentRowIndex

o  currentTable

o  document: aDocument

o  hBegin

o  haveSpace

o  inBLOCKQUOTE

o  inCenter

o  inDL

o  inKbd

o  inNoBreak

o  inOL

o  inPre

o  inRightAlign

o  inStrikeout

o  inSup

o  inUnderline

o  needSpace

o  previousIsEmpty

o  styleStack

o  ulLevel

o  xPosition

o  yNextLine

o  yPosition

o  yText

applets
o  createAppletFor: element

o  defineAppletParameterFor: element

o  destroyApplet: appletElement

o  setupAppletElement: element

checking
o  checkInitialStateAtEndOfDocument
check for correct closing TAGS.
Although, most HTML viewers can handle this case, its usually an
indication of some error and often leads to badly formatted documents

o  printCheckInfoMessage: msg

contents
o  contentsAddHeader: text
assign text to header and store in list of headers

o  headerAsString: anArray depht: depth
returns printable header assigned to array

o  printContents

o  printContents: aList pageNumber: initialPageNumber romanPageNumbers: romanPageNumbers
print contents to destination

displaying
o  displayX: xLeft y: yTop width: w height: h on: aGC

o  pageBreak
(y > self pageBreakLimit and:[self atLeft and:[destination isView not]]) ifTrue:[

o  pageBreakLimit

o  redrawDocument

elements-document
o  body

o  head

o  headEnd

o  meta

o  title

o  titleEnd

elements-forms
o  anyFormElement: element

o  form

o  formEnd

o  input

o  prescanForm: aFormElement
prescan a form, for its widgets max height.
a kludge - we need the form elements' heights BEFORE
formatting (since the text-elements have no origin knowledge,
which could be backpatched (also, we needed a way to break
MarkupText into multiple individual text items

o  prescanForms
a kludge - we need the form elements' heights BEFORE
formatting - since the text-elements have no origin knowledge,
which could be backpatched (also, we needed a way to break
MarkupText into multiple individual text items)

o  textarea

o  textareaEnd

elements-lists
o  blockquote

o  blockquoteEnd

o  dd
self conditionalBreak.

o  dir

o  dirEnd

o  dl

o  dlEnd

o  dt

o  li

o  li_ol

o  li_ul
in <ul> ... </ul> - draw a bullet

o  listTypeOElement: anElement

o  menu

o  menuEnd

o  ol

o  olEnd

o  ul

o  ulEnd

elements-pseudoTags
o  internalMathFont

o  internalMathFontEnd

elements-special
o  a

o  aEnd

o  app
backward compatible (now obsolete) applet tag

o  appEnd
backward compatible (now obsolete) applet end-tag

o  applet

o  appletEnd

o  area

o  img
<IMG
SRC='image-url'
ALT='alternative-text'
WIDTH=w
HEIGHT=h
HSPACE=hSpc
VSPACE=vSpc
BORDER=bw
NOPRINT // deprecated
PRINT=yesOrNo // deprecated
LOWSRC='lowRes-image-url' // not implemented
>

o  map

o  mapEnd

o  param
done in preparse - see #defineAppletParameterFor: ...

o  script
the script is now loaded and evaluated by the parser
(to allow it to generate the HTML text ...)
However, we need to remember it, for startup & cleanup message
sends.

o  specialMarkup

elements-structure
o  br

o  center

o  centerEnd

o  div

o  h1

o  h1End

o  h2

o  h2End

o  h3

o  h3End

o  h4

o  h4End

o  h5

o  h5End

o  h6

o  h6End

o  h7

o  h7End

o  h8

o  h8End

o  h9

o  h9End

o  hr

o  nobr

o  nobrEnd

o  p

o  pEnd

o  pre

o  preEnd

o  tab

o  wbr

o  xmp

o  xmpEnd

elements-style
o  acronym

o  acronymEnd

o  address

o  addressEnd

o  b

o  bEnd

o  cite

o  citeEnd

o  code
(element hasParameterFor:'FOO') ifTrue:[self halt].

o  codeEnd

o  dfn

o  dfnEnd
self handlePendingSpaceNeed.

o  em

o  emEnd

o  font

o  fontEnd

o  i

o  iEnd

o  kbd

o  kbdEnd

o  s

o  sEnd

o  samp

o  sampEnd

o  strike

o  strikeEnd

o  strong

o  strongEnd

o  sub

o  subEnd

o  sup

o  supEnd

o  tt

o  ttEnd

o  u

o  uEnd
self handlePendingSpaceNeed.

o  var

o  varEnd

elements-tables
o  caption

o  drawTable

o  drawTableRow: row
draw one row

o  finishPreviousTableColumn

o  finishPreviousTableRow: final

o  table

o  tableEnd

o  td

o  th

o  th_td_common

o  tr

elements-text
o  addText: txtIn fromElement: element

o  privateDrawString: aString atX: xS y: yS to: xE

formatting
o  flushAnchorColors

o  format: docAnchor for: aGC resolver: aResolver style: aStyle

o  process: aDocumentAnchor

o  reformatDocument

helpers
o  atLeft

o  atOrLeftOfLeft

o  atTop

o  break

o  conditionalBreak
break line if not already at the beginning

o  conditionalEmpty
add vertical space, but only if there is not already some

o  currentElementHasHREF

o  do_needAndNewPage
handle any NEWPAGE and NEED= attributes of the current element,
put only if painting to paper (i.e. ignore if displaying)

o  do_starOfficeStyleBefore
handle
STYLE='page-break-before: always'

o  empty

o  empty: height

o  fontFor: aFont onDevice: aDevice

o  getFontsFor: aGC

o  handlePendingSpaceNeed

o  header: index font: aFont space: space

o  headerEnd

o  initialHeaderNumbers

o  needSpace: nPixel

o  relativeValueFrom: aString with: aNumericValue

o  romanStringFor: aNumber

initialization & release
o  release
sent from docView, to release stuff

o  terminateMetaCommands
sent from docView, to release stuff

meta commands
o  processMetaCommands

o  refreshDocument: url

private
o  addSyncPoint

o  forkImageSequencePlayerFor: entry

o  handleColorAttribute

o  handleColorChange

o  playImageSequence: entry

o  processFrom: firstElement while: aBlock
process elements starting with firstElement, while aBlock
returns true. Should be called from a saveExcursion block.

o  resyncFrom: syncPoint
fetch the state found there

o  saveExcursion: aBlock
save the current state, perform aBlock and restore the state afterwards

o  saveExcursionFrom: firstElement while: testBlock
remember the current state, process elements starting with firstElement,
while testBlock returns true, finally restore the state

o  setupInitialState
setup some initial state, such as margins, indents,
colors, fonts etc.

o  startImageDisplayProcess
handle two queues in the background; the first
contains images which are to be loaded (i.e. which are
contained in the current document) and have to be
rendered for the device.
The second contains those which are to be displayed.
The displayList is always served first.

o  syncPoint
save my state in a sync point

queries
o  anchorAt: aPoint
given a (click-) point, search for and return the corresponding
anchorElement. Return nil, if there is none

o  height

o  imageAt: aPoint
given a (click-) point, search for and return the corresponding
imageElement. Return nil, if there is none

o  positionOfAnchor: aLocalAnchor

o  width

style changes
o  currentStyle

o  defaultStyle

o  normalStyle

o  popStyle

o  pushStyle

o  setBGColor: aColor

o  setColor: aColor

o  setFont: aFont

o  setStyle: aStyle

widget-actions
o  buttonWidgetPressed: aWidgetElement

o  formResetted: aFormElement from: aWidgetElement
reset forms contents to their original values

o  formSubmitted: aFormElement from: aWidgetElement

o  mouseOverAnchor: anElement

widgets
o  createWidgetFor: element inForm: aForm

o  destroyWidgets

o  fixupForm: aForm

o  hideAllWidgets
hide any widget

o  hideWidgets
hide any widget which became invisible

o  prescanForm: aForm atIndex: startIndex
prescan a form, for its widgets max height.
a kludge - we need the form elements' heights BEFORE
formatting (since the text-elements have no origin knowledge,
which could be backpatched (also, we needed a way to break
MarkupText into multiple individual text items

o  showWidgets
show any widget which became visible


Private classes:

    PainterState
    TextStyle
    WidgetQuery


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 09:46:00 GMT