aboutsummaryrefslogtreecommitdiff
path: root/devdoc/dw-out-of-flow-2.doc
blob: d9d705655060c072073e18d75176a472275b06d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/** \page dw-out-of-flow-2 Handling Elements Out Of Flow (notes 2)

This has to be integrated into \ref dw-out-of-flow.

Constructing a page with floats
-------------------------------
When a page is constructed (dw::Textblock::addWord), the *generating*
block tells the positions of floats (or, generally, widgets out of
flow) via dw::OutOfFlowMgr::tellPosition. This method considers
already collisions with other floats (only previous floats; floats
following this float are not considered); after the call,
dw::OutOfFlowMgr::getBorder will return correct values.

dw::OutOfFlowMgr::tellPosition also checks for overlaps of this float
with other textblocks, except this textblock (the *generator*, which
is just constructed, so nothing has to be done). The fact that the
position of the float is the top, and so the float has only an
allocation below this position, leads to the effect that only the
textblocks following the generator are affected. (**Check:** Can the
search be limited here?) When a page is constructed, no textblocks
should be following the generating block, so no textblocks are
affected.

**Todo:** Clarify details of line breaking (\ref dw-line-breaking).

Float changes its size
----------------------
The float itself will call queueResize, which will result in a call of
markSizeChange for the *containing* block, which will then call
dw::OutOfFlowMgr::markSizeChange. Here, the vloat is only *marked* as
dirty; the size will be calculated later (in
dw::OutOfFlowMgr::ensureFloatSize).

This will trigger the resize idle function, so sizeRequest and
sizeAllocate for all floats and textblocks. In this run,
dw::OutOfFlowMgr::hasRelationChanged will return *true*, and so result
in a call of dw::Textblock::borderChanged, and trigger a second run of
the resize idle function, dealing correctly with the new size.

(This case is handles in a not perfectly optimal way, since two runs
of the resize idle function are neccessary; but size changes of floats
is not a very common case.

When a page is constructed (see above), a changing size of a float
currently constructed typically only affects the most bottom
textblock; the other textblocks are not covered by this float.)

**Error:** In this case, new collisions are not yet considered.


Changing the width of the page
------------------------------

When the page width is changed, this will result in a reconstruction
of the page; see *Constructing a page with floats*. Anyway, checking
for overlaps will play a more important role. This is handled in an
optimal way by dw::OutOfFlowMgr::hasRelationChanged.

**Check:** Are "cascades" avoided, like this:

1. All textblocks are constructed. A float in textblock 1 overlaps
   with textblock 2, so dw::Textblock::borderChanged is called for
   textblock 2.
2. In another resize idle run, textblock 2 is constructed again. A
   float in textblock 2 overlaps with textblock 3, so that
   dw::Textblock::borderChanged is called for textblock 3.
3. Etc.

*/