Clean up our detach model so that you can always get to a document, even for
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Oct 2003 20:58:56 +0000 (20:58 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Oct 2003 20:58:56 +0000 (20:58 +0000)
anonymous content.  Also stubbing out and adding the accessibility objects.

        Reviewed by darin, mjs, john

        * ChangeLog:
        * WebCore.pbproj/project.pbxproj:
        * khtml/rendering/render_block.cpp:
        * khtml/rendering/render_box.cpp:
        (RenderBox::detach):
        * khtml/rendering/render_box.h:
        * khtml/rendering/render_canvas.cpp:
        (RenderCanvas::RenderCanvas):
        * khtml/rendering/render_container.cpp:
        (RenderContainer::detach):
        (RenderContainer::addChild):
        (RenderContainer::updatePseudoChild):
        (RenderContainer::insertChildNode):
        (RenderContainer::removeLeftoverAnonymousBoxes):
        * khtml/rendering/render_container.h:
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::createAnonymousFlow):
        (RenderFlow::deleteLineBoxes):
        (RenderFlow::detach):
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_form.cpp:
        (RenderTextArea::detach):
        * khtml/rendering/render_form.h:
        * khtml/rendering/render_image.cpp:
        (RenderImage::RenderImage):
        (RenderImage::detach):
        * khtml/rendering/render_image.h:
        * khtml/rendering/render_inline.cpp:
        (RenderInline::addChildToFlow):
        (RenderInline::splitFlow):
        (RenderInline::renderName):
        * khtml/rendering/render_list.cpp:
        (RenderListItem::setStyle):
        (RenderListItem::detach):
        (RenderListItem::updateMarkerLocation):
        (RenderListMarker::RenderListMarker):
        * khtml/rendering/render_list.h:
        * khtml/rendering/render_object.cpp:
        (RenderObject::RenderObject):
        (RenderObject::information):
        (RenderObject::dump):
        (RenderObject::createAnonymousBlock):
        (RenderObject::remove):
        (RenderObject::detach):
        * khtml/rendering/render_object.h:
        * khtml/rendering/render_replaced.cpp:
        (RenderWidget::detach):
        * khtml/rendering/render_replaced.h:
        * khtml/rendering/render_table.cpp:
        (RenderTable::addChild):
        (RenderTableSection::detach):
        (RenderTableSection::addChild):
        (RenderTableRow::detach):
        (RenderTableRow::addChild):
        (RenderTableCell::detach):
        * khtml/rendering/render_table.h:
        * khtml/rendering/render_text.cpp:
        (RenderText::detach):
        (RenderText::deleteRuns):
        * khtml/rendering/render_text.h:
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::DocumentImpl):
        (DocumentImpl::~DocumentImpl):
        (DocumentImpl::detach):
        (DocumentImpl::getOrCreateAccObjectCache):
        * khtml/xml/dom_docimpl.h:
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::detach):
        * kwq/KWQAccObject.h: Added.
        * kwq/KWQAccObject.mm: Added.
        (-[KWQAccObject x]):
        (-[KWQAccObject y]):
        (-[KWQAccObject width]):
        (-[KWQAccObject height]):
        (-[KWQAccObject detached]):
        (-[KWQAccObject detach]):
        (-[KWQAccObject data]):
        (-[KWQAccObject setData:]):
        (-[KWQAccObject firstChild]):
        (-[KWQAccObject lastChild]):
        (-[KWQAccObject previousSibling]):
        (-[KWQAccObject nextSibling]):
        (-[KWQAccObject parentObject]):
        * kwq/KWQAccObjectCache.h: Added.
        * kwq/KWQAccObjectCache.mm: Added.
        (KWQAccObjectCache::KWQAccObjectCache):
        (KWQAccObjectCache::~KWQAccObjectCache):
        (KWQAccObjectCache::accObject):
        (KWQAccObjectCache::setAccObject):
        (KWQAccObjectCache::removeAccObject):
        (KWQAccObjectCache::detach):
        * layout-tests/css1/pseudo/firstletter-expected.txt:
        * layout-tests/css1/pseudo/multiple_pseudo_elements-expected.txt:
        * layout-tests/fast/css-generated-content/002-expected.txt:
        * layout-tests/fast/css-generated-content/004-expected.txt:
        * layout-tests/fast/css-generated-content/005-expected.txt:
        * layout-tests/fast/css-generated-content/006-expected.txt:
        * layout-tests/fast/selectors/039-expected.txt:
        * layout-tests/fast/selectors/039b-expected.txt:
        * layout-tests/fast/selectors/041-expected.txt:
        * layout-tests/fast/selectors/042-expected.txt:
        * layout-tests/fast/selectors/166a-expected.txt:
        * layout-tests/fast/selectors/168-expected.txt:
        * layout-tests/fast/selectors/168a-expected.txt:
        * layout-tests/fast/selectors/169-expected.txt:
        * layout-tests/fast/selectors/169a-expected.txt:
        * layout-tests/fast/text/firstline/002-expected.txt:
        * layout-tests/fast/text/firstline/003-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@5107 268f45cc-cd09-0410-ab3c-d52691b4dbfc

49 files changed:
LayoutTests/css1/pseudo/firstletter-expected.txt
LayoutTests/css1/pseudo/multiple_pseudo_elements-expected.txt
LayoutTests/fast/css-generated-content/002-expected.txt
LayoutTests/fast/css-generated-content/004-expected.txt
LayoutTests/fast/css-generated-content/005-expected.txt
LayoutTests/fast/selectors/039-expected.txt
LayoutTests/fast/selectors/039b-expected.txt
LayoutTests/fast/selectors/041-expected.txt
LayoutTests/fast/selectors/042-expected.txt
LayoutTests/fast/selectors/166a-expected.txt
LayoutTests/fast/selectors/168-expected.txt
LayoutTests/fast/selectors/168a-expected.txt
LayoutTests/fast/selectors/169-expected.txt
LayoutTests/fast/selectors/169a-expected.txt
LayoutTests/fast/text/firstline/002-expected.txt
LayoutTests/fast/text/firstline/003-expected.txt
WebCore/ChangeLog-2003-10-25
WebCore/ChangeLog-2005-08-23
WebCore/WebCore.pbproj/project.pbxproj
WebCore/khtml/rendering/render_block.cpp
WebCore/khtml/rendering/render_box.cpp
WebCore/khtml/rendering/render_box.h
WebCore/khtml/rendering/render_canvas.cpp
WebCore/khtml/rendering/render_container.cpp
WebCore/khtml/rendering/render_container.h
WebCore/khtml/rendering/render_flow.cpp
WebCore/khtml/rendering/render_flow.h
WebCore/khtml/rendering/render_form.cpp
WebCore/khtml/rendering/render_form.h
WebCore/khtml/rendering/render_image.cpp
WebCore/khtml/rendering/render_image.h
WebCore/khtml/rendering/render_inline.cpp
WebCore/khtml/rendering/render_list.cpp
WebCore/khtml/rendering/render_list.h
WebCore/khtml/rendering/render_object.cpp
WebCore/khtml/rendering/render_object.h
WebCore/khtml/rendering/render_replaced.cpp
WebCore/khtml/rendering/render_replaced.h
WebCore/khtml/rendering/render_table.cpp
WebCore/khtml/rendering/render_table.h
WebCore/khtml/rendering/render_text.cpp
WebCore/khtml/rendering/render_text.h
WebCore/khtml/xml/dom_docimpl.cpp
WebCore/khtml/xml/dom_docimpl.h
WebCore/khtml/xml/dom_nodeimpl.cpp
WebCore/kwq/KWQAccObject.h [new file with mode: 0644]
WebCore/kwq/KWQAccObject.mm [new file with mode: 0644]
WebCore/kwq/KWQAccObjectCache.h [new file with mode: 0644]
WebCore/kwq/KWQAccObjectCache.mm [new file with mode: 0644]

index bf42d67..611280d 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x664
   RenderBlock {HTML} at (0,0) size 800x664
     RenderBody {BODY} at (8,8) size 784x648 [bgcolor=#CCCCCC]
       RenderBlock {P} at (0,0) size 784x17 [bgcolor=#000000]
-        RenderInline at (0,0) size 9x17 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
           RenderText {TEXT} at (0,0) size 9x17
             text run at (0,0) width 9: "T"
         RenderText {TEXT} at (9,0) size 376x17
@@ -16,7 +16,7 @@ layer at (0,0) size 800x664
           text run at (0,32) width 312: "P.three:first-letter {font-size: 350%;}"
       RenderBlock {HR} at (1,109) size 782x2 [bgcolor=#000000]
       RenderBlock {P} at (0,125) size 784x51 [bgcolor=#000000]
-        RenderInline at (0,0) size 9x17 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
           RenderText {TEXT} at (0,0) size 9x17
             text run at (0,0) width 9: "T"
         RenderText {TEXT} at (9,0) size 784x51
@@ -26,7 +26,7 @@ layer at (0,0) size 800x664
           text run at (273,17) width 504: "Remember that in order to ensure a complete test, the paragraph must be"
           text run at (0,34) width 226: "displayed on more than one line."
       RenderBlock {P} at (0,190) size 784x67 [bgcolor=#000000]
-        RenderInline at (0,0) size 18x33 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 18x33 [color=#800000]
           RenderText {TEXT} at (0,0) size 18x33
             text run at (0,0) width 18: "T"
         RenderText {TEXT} at (18,13) size 768x54
@@ -36,7 +36,7 @@ layer at (0,0) size 800x664
           text run at (526,33) width 242: "Remember that in order to ensure a"
           text run at (0,50) width 488: "complete test, the paragraph must be displayed on more than one line."
       RenderBlock {P} at (0,271) size 784x91 [bgcolor=#000000]
-        RenderInline at (0,0) size 61x57 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 61x57 [color=#800000]
           RenderText {TEXT} at (0,0) size 61x57
             text run at (0,0) width 61: "\"W"
         RenderText {TEXT} at (61,33) size 764x58
@@ -58,7 +58,7 @@ layer at (0,0) size 800x664
                 text run at (4,4) width 4: "\x{A0}"
             RenderTableCell {TD} at (12,25) size 770x245 [r=1 c=1 rs=1 cs=1]
               RenderBlock {P} at (4,4) size 762x51
-                RenderInline at (0,0) size 9x17 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
                   RenderText {TEXT} at (0,0) size 9x17
                     text run at (0,0) width 9: "T"
                 RenderText {TEXT} at (9,0) size 737x51
@@ -68,7 +68,7 @@ layer at (0,0) size 800x664
                   text run at (320,17) width 370: "Remember that in order to ensure a complete test, the"
                   text run at (0,34) width 360: "paragraph must be displayed on more than one line."
               RenderBlock {P} at (4,69) size 762x67
-                RenderInline at (0,0) size 18x33 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 18x33 [color=#800000]
                   RenderText {TEXT} at (0,0) size 18x33
                     text run at (0,0) width 18: "T"
                 RenderText {TEXT} at (18,13) size 756x54
@@ -78,7 +78,7 @@ layer at (0,0) size 800x664
                   text run at (526,33) width 230: "Remember that in order to ensure"
                   text run at (0,50) width 500: "a complete test, the paragraph must be displayed on more than one line."
               RenderBlock {P} at (4,150) size 762x91
-                RenderInline at (0,0) size 61x57 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 61x57 [color=#800000]
                   RenderText {TEXT} at (0,0) size 61x57
                     text run at (0,0) width 61: "\"W"
                 RenderText {TEXT} at (61,33) size 728x58
index 252cf07..7eecd99 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x862
   RenderBlock {HTML} at (0,0) size 800x862
     RenderBody {BODY} at (8,8) size 784x846 [bgcolor=#CCCCCC]
       RenderBlock {P} at (0,0) size 784x17 [bgcolor=#000000]
-        RenderInline at (0,0) size 9x17 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
           RenderText {TEXT} at (0,0) size 9x17
             text run at (0,0) width 9: "T"
         RenderText {TEXT} at (9,0) size 376x17
@@ -19,7 +19,7 @@ layer at (0,0) size 800x862
           text run at (0,80) width 368: "P.three:first-line {font-variant: small-caps;}"
       RenderBlock {HR} at (1,157) size 782x2 [bgcolor=#000000]
       RenderBlock {P} at (0,173) size 784x51 [bgcolor=#000000]
-        RenderInline at (0,0) size 9x17 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
           RenderText {TEXT} at (0,0) size 9x17
             text run at (0,0) width 9: "T"
         RenderText {TEXT} at (9,0) size 779x51
@@ -29,7 +29,7 @@ layer at (0,0) size 800x862
           text run at (639,17) width 121: "Remember that in"
           text run at (0,34) width 609: "order to ensure a complete test, the paragraph must be displayed on more than one line."
       RenderBlock {P} at (0,238) size 784x125 [bgcolor=#000000]
-        RenderInline at (0,0) size 31x57 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 31x57 [color=#800000]
           RenderText {TEXT} at (0,0) size 31x57
             text run at (0,0) width 31: "T"
         RenderText {TEXT} at (31,20) size 784x105
@@ -41,7 +41,7 @@ layer at (0,0) size 800x862
           text run at (135,91) width 635: "Remember that in order to ensure a complete test, the paragraph must be displayed on more"
           text run at (0,108) width 95: "than one line."
       RenderBlock {P} at (0,377) size 784x108 [bgcolor=#000000]
-        RenderInline at (0,0) size 61x57 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 61x57 [color=#800000]
           RenderText {TEXT} at (0,0) size 61x57
             text run at (0,0) width 61: "\"W"
         RenderText {TEXT} at (61,33) size 763x75
@@ -65,7 +65,7 @@ layer at (0,0) size 800x862
                 text run at (4,4) width 4: "\x{A0}"
             RenderTableCell {TD} at (12,25) size 770x320 [r=1 c=1 rs=1 cs=1]
               RenderBlock {P} at (4,4) size 762x51
-                RenderInline at (0,0) size 9x17 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 9x17 [color=#800000]
                   RenderText {TEXT} at (0,0) size 9x17
                     text run at (0,0) width 9: "T"
                 RenderText {TEXT} at (9,0) size 762x51
@@ -75,7 +75,7 @@ layer at (0,0) size 800x862
                   text run at (689,17) width 73: "Remember"
                   text run at (0,34) width 657: "that in order to ensure a complete test, the paragraph must be displayed on more than one line."
               RenderBlock {P} at (4,69) size 762x125
-                RenderInline at (0,0) size 31x57 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 31x57 [color=#800000]
                   RenderText {TEXT} at (0,0) size 31x57
                     text run at (0,0) width 31: "T"
                 RenderText {TEXT} at (31,20) size 746x105
@@ -87,7 +87,7 @@ layer at (0,0) size 800x862
                   text run at (212,91) width 504: "Remember that in order to ensure a complete test, the paragraph must be"
                   text run at (0,108) width 226: "displayed on more than one line."
               RenderBlock {P} at (4,208) size 762x108
-                RenderInline at (0,0) size 61x57 [color=#800000]
+                RenderInline (anonymous) at (0,0) size 61x57 [color=#800000]
                   RenderText {TEXT} at (0,0) size 61x57
                     text run at (0,0) width 61: "\"W"
                 RenderText {TEXT} at (61,33) size 759x75
index 8c89b0c..c540321 100644 (file)
@@ -4,8 +4,8 @@ layer at (0,0) size 800x39
   RenderBlock {HTML} at (0,0) size 800x39
     RenderBody {BODY} at (8,8) size 784x17
       RenderBlock {P} at (0,0) size 784x17
-        RenderInline at (0,0) size 57x17
-          RenderInline at (0,0) size 8x17 [color=#FFD800]
+        RenderInline (anonymous) at (0,0) size 57x17
+          RenderInline (anonymous) at (0,0) size 8x17 [color=#FFD800]
             RenderText at (0,0) size 8x17
               text run at (0,0) width 8: "S"
           RenderText at (8,0) size 49x17
@@ -13,6 +13,6 @@ layer at (0,0) size 800x39
         RenderText {TEXT} at (57,0) size 644x17
           text run at (57,0) width 234: "The \"S\" to the left should be gold. "
           text run at (291,0) width 410: "This is testing :before used in conjunction with :first-letter. "
-        RenderInline at (0,0) size 64x17
+        RenderInline (anonymous) at (0,0) size 64x17
           RenderText at (701,0) size 64x17
             text run at (701,0) width 64: "[The End]"
index 4c67673..68d12be 100644 (file)
@@ -4,6 +4,7 @@ layer at (0,0) size 800x45
   RenderBlock {HTML} at (0,0) size 800x45
     RenderBody {BODY} at (8,14) size 784x17 [color=#FF0000]
       RenderBlock {P} at (0,0) size 784x17 [color=#008000]
-        RenderInline at (0,0) size 179x17
+        RenderInline (anonymous) at (0,0) size 179x17
           RenderText at (0,0) size 179x17
             text run at (0,0) width 179: "This text should be green."
+        RenderInline (anonymous) at (0,0) size 0x17
index 3e459ea..dc9fe27 100644 (file)
@@ -5,7 +5,7 @@ layer at (0,0) size 800x64
     RenderBody {BODY} at (8,8) size 784x48
       RenderBlock (anonymous) at (0,0) size 784x17
         RenderInline {Q} at (0,0) size 172x17
-          RenderInline at (0,0) size 6x17
+          RenderInline (anonymous) at (0,0) size 6x17
             RenderText at (0,0) size 6x17
               text run at (0,0) width 6: "\""
           RenderText {TEXT} at (6,0) size 166x17
@@ -16,7 +16,7 @@ layer at (0,0) size 800x64
         RenderInline {Q} at (0,0) size 68x17
           RenderText {TEXT} at (0,0) size 62x17
             text run at (0,0) width 62: "this text."
-          RenderInline at (0,0) size 6x17
+          RenderInline (anonymous) at (0,0) size 6x17
             RenderText at (62,0) size 6x17
               text run at (62,0) width 6: "\""
         RenderText {TEXT} at (0,0) size 0x0
index eba42c3..923545f 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x56
   RenderBlock {HTML} at (0,0) size 800x56
     RenderBody {BODY} at (8,14) size 784x28
       RenderBlock {P} at (0,0) size 784x28
-        RenderInline at (0,0) size 16x28 [bgcolor=#00FF00]
+        RenderInline (anonymous) at (0,0) size 16x28 [bgcolor=#00FF00]
           RenderText {TEXT} at (0,0) size 16x28 [bgcolor=#000000]
             text run at (0,0) width 16: "T"
         RenderText {TEXT} at (16,9) size 525x17
index eba42c3..923545f 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x56
   RenderBlock {HTML} at (0,0) size 800x56
     RenderBody {BODY} at (8,14) size 784x28
       RenderBlock {P} at (0,0) size 784x28
-        RenderInline at (0,0) size 16x28 [bgcolor=#00FF00]
+        RenderInline (anonymous) at (0,0) size 16x28 [bgcolor=#00FF00]
           RenderText {TEXT} at (0,0) size 16x28 [bgcolor=#000000]
             text run at (0,0) width 16: "T"
         RenderText {TEXT} at (16,9) size 525x17
index f21f822..a2da958 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x62
   RenderBlock {HTML} at (0,0) size 800x62
     RenderBody {BODY} at (8,14) size 784x34
       RenderBlock {P} at (0,0) size 784x34
-        RenderInline at (0,0) size 157x17 [bgcolor=#00FF00]
+        RenderInline (anonymous) at (0,0) size 157x17 [bgcolor=#00FF00]
           RenderText at (0,0) size 157x17
             text run at (0,0) width 157: "GENERATED CONTENT "
         RenderText {TEXT} at (157,0) size 719x34
index dfcd5da..47fa6c1 100644 (file)
@@ -6,7 +6,7 @@ layer at (0,0) size 800x62
       RenderBlock {P} at (0,0) size 784x34
         RenderText {TEXT} at (0,0) size 636x17
           text run at (0,0) width 636: "You should see after this paragraph the words GENERATED CONTENT over green background"
-        RenderInline at (0,0) size 718x34 [bgcolor=#00FF00]
+        RenderInline (anonymous) at (0,0) size 718x34 [bgcolor=#00FF00]
           RenderText at (636,0) size 718x34
             text run at (636,0) width 82: "GENERATED"
             text run at (0,17) width 67: "CONTENT"
index 05da7b7..e33f98b 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x45
   RenderBlock {HTML} at (0,0) size 800x45
     RenderBody {BODY} at (8,14) size 784x17
       RenderBlock {P} at (0,0) size 784x17
-        RenderInline at (0,0) size 9x17 [bgcolor=#00FF00]
+        RenderInline (anonymous) at (0,0) size 9x17 [bgcolor=#00FF00]
           RenderText {TEXT} at (0,0) size 9x17 [bgcolor=#000000]
             text run at (0,0) width 9: "T"
         RenderText {TEXT} at (9,0) size 443x17
index 2e63bc4..2529fb3 100644 (file)
@@ -7,7 +7,7 @@ layer at (0,0) size 800x76
         RenderText {TEXT} at (0,0) size 91x17
           text run at (0,0) width 91: "This test has "
         RenderInline {SPAN} at (0,0) size 51x17
-          RenderInline at (0,0) size 51x17 [bgcolor=#00FF00]
+          RenderInline (anonymous) at (0,0) size 51x17 [bgcolor=#00FF00]
             RenderText at (91,0) size 51x17
               text run at (91,0) width 51: "PASSED"
         RenderText {TEXT} at (142,0) size 5x17
index 2e63bc4..2529fb3 100644 (file)
@@ -7,7 +7,7 @@ layer at (0,0) size 800x76
         RenderText {TEXT} at (0,0) size 91x17
           text run at (0,0) width 91: "This test has "
         RenderInline {SPAN} at (0,0) size 51x17
-          RenderInline at (0,0) size 51x17 [bgcolor=#00FF00]
+          RenderInline (anonymous) at (0,0) size 51x17 [bgcolor=#00FF00]
             RenderText at (91,0) size 51x17
               text run at (91,0) width 51: "PASSED"
         RenderText {TEXT} at (142,0) size 5x17
index 2e63bc4..2529fb3 100644 (file)
@@ -7,7 +7,7 @@ layer at (0,0) size 800x76
         RenderText {TEXT} at (0,0) size 91x17
           text run at (0,0) width 91: "This test has "
         RenderInline {SPAN} at (0,0) size 51x17
-          RenderInline at (0,0) size 51x17 [bgcolor=#00FF00]
+          RenderInline (anonymous) at (0,0) size 51x17 [bgcolor=#00FF00]
             RenderText at (91,0) size 51x17
               text run at (91,0) width 51: "PASSED"
         RenderText {TEXT} at (142,0) size 5x17
index 2e63bc4..2529fb3 100644 (file)
@@ -7,7 +7,7 @@ layer at (0,0) size 800x76
         RenderText {TEXT} at (0,0) size 91x17
           text run at (0,0) width 91: "This test has "
         RenderInline {SPAN} at (0,0) size 51x17
-          RenderInline at (0,0) size 51x17 [bgcolor=#00FF00]
+          RenderInline (anonymous) at (0,0) size 51x17 [bgcolor=#00FF00]
             RenderText at (91,0) size 51x17
               text run at (91,0) width 51: "PASSED"
         RenderText {TEXT} at (142,0) size 5x17
index ed7b973..16d3a02 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x69
   RenderBlock {HTML} at (0,0) size 800x69
     RenderBody {BODY} at (8,8) size 784x47
       RenderBlock {P} at (0,0) size 784x47
-        RenderInline at (0,0) size 32x43 [color=#800000]
+        RenderInline (anonymous) at (0,0) size 32x43 [color=#800000]
           RenderText {TEXT} at (2,2) size 32x43
             text run at (2,2) width 32: "M"
         RenderText {TEXT} at (34,23) size 198x17
index c0c7100..60245f7 100644 (file)
@@ -4,7 +4,7 @@ layer at (0,0) size 800x50
   RenderBlock {HTML} at (0,0) size 800x50
     RenderBody {BODY} at (8,8) size 784x28
       RenderBlock {P} at (0,0) size 784x28
-        RenderInline at (0,0) size 17x28 [color=#FF0000]
+        RenderInline (anonymous) at (0,0) size 17x28 [color=#FF0000]
           RenderText {TEXT} at (0,0) size 17x28
             text run at (0,0) width 17: "A"
         RenderText {TEXT} at (17,9) size 437x17
index 10655b6..ddab3d6 100644 (file)
@@ -1,5 +1,121 @@
 2003-10-01  David Hyatt  <hyatt@apple.com>
 
+       Clean up our detach model so that you can always get to a document, even for
+       anonymous content.  Also stubbing out and adding the accessibility objects.
+       
+        Reviewed by darin, mjs, john
+
+        * ChangeLog:
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::detach):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_canvas.cpp:
+        (RenderCanvas::RenderCanvas):
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::detach):
+        (RenderContainer::addChild):
+        (RenderContainer::updatePseudoChild):
+        (RenderContainer::insertChildNode):
+        (RenderContainer::removeLeftoverAnonymousBoxes):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::createAnonymousFlow):
+        (RenderFlow::deleteLineBoxes):
+        (RenderFlow::detach):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderTextArea::detach):
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::RenderImage):
+        (RenderImage::detach):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::addChildToFlow):
+        (RenderInline::splitFlow):
+        (RenderInline::renderName):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::setStyle):
+        (RenderListItem::detach):
+        (RenderListItem::updateMarkerLocation):
+        (RenderListMarker::RenderListMarker):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::RenderObject):
+        (RenderObject::information):
+        (RenderObject::dump):
+        (RenderObject::createAnonymousBlock):
+        (RenderObject::remove):
+        (RenderObject::detach):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderWidget::detach):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::addChild):
+        (RenderTableSection::detach):
+        (RenderTableSection::addChild):
+        (RenderTableRow::detach):
+        (RenderTableRow::addChild):
+        (RenderTableCell::detach):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::detach):
+        (RenderText::deleteRuns):
+        * khtml/rendering/render_text.h:
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::DocumentImpl):
+        (DocumentImpl::~DocumentImpl):
+        (DocumentImpl::detach):
+        (DocumentImpl::getOrCreateAccObjectCache):
+        * khtml/xml/dom_docimpl.h:
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::detach):
+        * kwq/KWQAccObject.h: Added.
+        * kwq/KWQAccObject.mm: Added.
+        (-[KWQAccObject x]):
+        (-[KWQAccObject y]):
+        (-[KWQAccObject width]):
+        (-[KWQAccObject height]):
+        (-[KWQAccObject detached]):
+        (-[KWQAccObject detach]):
+        (-[KWQAccObject data]):
+        (-[KWQAccObject setData:]):
+        (-[KWQAccObject firstChild]):
+        (-[KWQAccObject lastChild]):
+        (-[KWQAccObject previousSibling]):
+        (-[KWQAccObject nextSibling]):
+        (-[KWQAccObject parentObject]):
+        * kwq/KWQAccObjectCache.h: Added.
+        * kwq/KWQAccObjectCache.mm: Added.
+        (KWQAccObjectCache::KWQAccObjectCache):
+        (KWQAccObjectCache::~KWQAccObjectCache):
+        (KWQAccObjectCache::accObject):
+        (KWQAccObjectCache::setAccObject):
+        (KWQAccObjectCache::removeAccObject):
+        (KWQAccObjectCache::detach):
+        * layout-tests/css1/pseudo/firstletter-expected.txt:
+        * layout-tests/css1/pseudo/multiple_pseudo_elements-expected.txt:
+        * layout-tests/fast/css-generated-content/002-expected.txt:
+        * layout-tests/fast/css-generated-content/004-expected.txt:
+        * layout-tests/fast/css-generated-content/005-expected.txt:
+        * layout-tests/fast/css-generated-content/006-expected.txt:
+        * layout-tests/fast/selectors/039-expected.txt:
+        * layout-tests/fast/selectors/039b-expected.txt:
+        * layout-tests/fast/selectors/041-expected.txt:
+        * layout-tests/fast/selectors/042-expected.txt:
+        * layout-tests/fast/selectors/166a-expected.txt:
+        * layout-tests/fast/selectors/168-expected.txt:
+        * layout-tests/fast/selectors/168a-expected.txt:
+        * layout-tests/fast/selectors/169-expected.txt:
+        * layout-tests/fast/selectors/169a-expected.txt:
+        * layout-tests/fast/text/firstline/002-expected.txt:
+        * layout-tests/fast/text/firstline/003-expected.txt:
+
+2003-10-01  David Hyatt  <hyatt@apple.com>
+
        Fix for 3163840, the images are mispositioned on the DHTML menus at the top of
        www.aa.com (and in many other places).  We needed to support returning the right
        value from hasProperty and tryGet for 'cssFloat'.  
index 10655b6..ddab3d6 100644 (file)
@@ -1,5 +1,121 @@
 2003-10-01  David Hyatt  <hyatt@apple.com>
 
+       Clean up our detach model so that you can always get to a document, even for
+       anonymous content.  Also stubbing out and adding the accessibility objects.
+       
+        Reviewed by darin, mjs, john
+
+        * ChangeLog:
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::detach):
+        * khtml/rendering/render_box.h:
+        * khtml/rendering/render_canvas.cpp:
+        (RenderCanvas::RenderCanvas):
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::detach):
+        (RenderContainer::addChild):
+        (RenderContainer::updatePseudoChild):
+        (RenderContainer::insertChildNode):
+        (RenderContainer::removeLeftoverAnonymousBoxes):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::createAnonymousFlow):
+        (RenderFlow::deleteLineBoxes):
+        (RenderFlow::detach):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderTextArea::detach):
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_image.cpp:
+        (RenderImage::RenderImage):
+        (RenderImage::detach):
+        * khtml/rendering/render_image.h:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::addChildToFlow):
+        (RenderInline::splitFlow):
+        (RenderInline::renderName):
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::setStyle):
+        (RenderListItem::detach):
+        (RenderListItem::updateMarkerLocation):
+        (RenderListMarker::RenderListMarker):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::RenderObject):
+        (RenderObject::information):
+        (RenderObject::dump):
+        (RenderObject::createAnonymousBlock):
+        (RenderObject::remove):
+        (RenderObject::detach):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderWidget::detach):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::addChild):
+        (RenderTableSection::detach):
+        (RenderTableSection::addChild):
+        (RenderTableRow::detach):
+        (RenderTableRow::addChild):
+        (RenderTableCell::detach):
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::detach):
+        (RenderText::deleteRuns):
+        * khtml/rendering/render_text.h:
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::DocumentImpl):
+        (DocumentImpl::~DocumentImpl):
+        (DocumentImpl::detach):
+        (DocumentImpl::getOrCreateAccObjectCache):
+        * khtml/xml/dom_docimpl.h:
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::detach):
+        * kwq/KWQAccObject.h: Added.
+        * kwq/KWQAccObject.mm: Added.
+        (-[KWQAccObject x]):
+        (-[KWQAccObject y]):
+        (-[KWQAccObject width]):
+        (-[KWQAccObject height]):
+        (-[KWQAccObject detached]):
+        (-[KWQAccObject detach]):
+        (-[KWQAccObject data]):
+        (-[KWQAccObject setData:]):
+        (-[KWQAccObject firstChild]):
+        (-[KWQAccObject lastChild]):
+        (-[KWQAccObject previousSibling]):
+        (-[KWQAccObject nextSibling]):
+        (-[KWQAccObject parentObject]):
+        * kwq/KWQAccObjectCache.h: Added.
+        * kwq/KWQAccObjectCache.mm: Added.
+        (KWQAccObjectCache::KWQAccObjectCache):
+        (KWQAccObjectCache::~KWQAccObjectCache):
+        (KWQAccObjectCache::accObject):
+        (KWQAccObjectCache::setAccObject):
+        (KWQAccObjectCache::removeAccObject):
+        (KWQAccObjectCache::detach):
+        * layout-tests/css1/pseudo/firstletter-expected.txt:
+        * layout-tests/css1/pseudo/multiple_pseudo_elements-expected.txt:
+        * layout-tests/fast/css-generated-content/002-expected.txt:
+        * layout-tests/fast/css-generated-content/004-expected.txt:
+        * layout-tests/fast/css-generated-content/005-expected.txt:
+        * layout-tests/fast/css-generated-content/006-expected.txt:
+        * layout-tests/fast/selectors/039-expected.txt:
+        * layout-tests/fast/selectors/039b-expected.txt:
+        * layout-tests/fast/selectors/041-expected.txt:
+        * layout-tests/fast/selectors/042-expected.txt:
+        * layout-tests/fast/selectors/166a-expected.txt:
+        * layout-tests/fast/selectors/168-expected.txt:
+        * layout-tests/fast/selectors/168a-expected.txt:
+        * layout-tests/fast/selectors/169-expected.txt:
+        * layout-tests/fast/selectors/169a-expected.txt:
+        * layout-tests/fast/text/firstline/002-expected.txt:
+        * layout-tests/fast/text/firstline/003-expected.txt:
+
+2003-10-01  David Hyatt  <hyatt@apple.com>
+
        Fix for 3163840, the images are mispositioned on the DHTML menus at the top of
        www.aa.com (and in many other places).  We needed to support returning the right
        value from hasProperty and tryGet for 'cssFloat'.  
index 65b3256..a3dd2d9 100644 (file)
                                BC80A6960468B78100DBCC9C,
                                BC32C2EF048BF95C00A8000B,
                                BE983D96052A2E0A00892D85,
+                               55998A5E052B59CC0017A6C1,
+                               55998A60052B59CC0017A6C1,
                        );
                        isa = PBXHeadersBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
                                BC7B2AFB0450824100A8000F,
                                BC80A6950468B78100DBCC9C,
                                BC32C2EE048BF95C00A8000B,
+                               55998A5F052B59CC0017A6C1,
+                               55998A61052B59CC0017A6C1,
                        );
                        isa = PBXSourcesBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
 //512
 //513
 //514
+//550
+//551
+//552
+//553
+//554
+               55998A57052B598F0017A6C1 = {
+                       children = (
+                               55998A5A052B59CC0017A6C1,
+                               55998A5B052B59CC0017A6C1,
+                               55998A5C052B59CC0017A6C1,
+                               55998A5D052B59CC0017A6C1,
+                       );
+                       isa = PBXGroup;
+                       name = Accessibility;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               55998A5A052B59CC0017A6C1 = {
+                       expectedFileType = sourcecode.c.h;
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       path = KWQAccObject.h;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               55998A5B052B59CC0017A6C1 = {
+                       expectedFileType = sourcecode.cpp.objcpp;
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       path = KWQAccObject.mm;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               55998A5C052B59CC0017A6C1 = {
+                       expectedFileType = sourcecode.c.h;
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       path = KWQAccObjectCache.h;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               55998A5D052B59CC0017A6C1 = {
+                       expectedFileType = sourcecode.cpp.objcpp;
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       path = KWQAccObjectCache.mm;
+                       refType = 4;
+                       sourceTree = "<group>";
+               };
+               55998A5E052B59CC0017A6C1 = {
+                       fileRef = 55998A5A052B59CC0017A6C1;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               55998A5F052B59CC0017A6C1 = {
+                       fileRef = 55998A5B052B59CC0017A6C1;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               55998A60052B59CC0017A6C1 = {
+                       fileRef = 55998A5C052B59CC0017A6C1;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+               55998A61052B59CC0017A6C1 = {
+                       fileRef = 55998A5D052B59CC0017A6C1;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
+//550
+//551
+//552
+//553
+//554
 //930
 //931
 //932
                };
                F58785E802DE377601EA4122 = {
                        children = (
+                               55998A57052B598F0017A6C1,
                                F565A2700352410501A80180,
                                F587871802DE3B8801EA4122,
                                F587861C02DE382201EA4122,
index 1d943ac..fb8c366 100644 (file)
@@ -78,13 +78,12 @@ void RenderBlock::setStyle(RenderStyle* _style)
     RenderObject *child = firstChild();
     while (child != 0)
     {
-        if (child->isAnonymousBox())
+        if (child->isAnonymous())
         {
             RenderStyle* newStyle = new RenderStyle();
             newStyle->inheritFrom(style());
             newStyle->setDisplay(BLOCK);
             child->setStyle(newStyle);
-            child->setIsAnonymousBox(true);
         }
         child = child->nextSibling();
     }
@@ -124,7 +123,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
             pseudoStyle->setDisplay( pseudoStyle->isFloating() ? BLOCK : INLINE);
             pseudoStyle->setPosition( STATIC ); // CSS2 says first-letter can't be positioned.
             
-            RenderObject* firstLetter = RenderFlow::createFlow(0, pseudoStyle, renderArena()); // anonymous box
+            RenderObject* firstLetter = RenderFlow::createAnonymousFlow(document(), pseudoStyle); // anonymous box
             firstLetterContainer->addChild(firstLetter, firstLetterContainer->firstChild());
 
             DOMStringImpl* oldText = newTextChild->string();
@@ -138,7 +137,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
                 //kdDebug( 6040 ) << "letter= '" << DOMString(oldText->substring(0,length)).string() << "'" << endl;
                 newTextChild->setText(oldText->substring(length,oldText->l-length));
 
-                RenderText* letter = new (renderArena()) RenderText(newTextChild->element(), oldText->substring(0,length));
+                RenderText* letter = new (renderArena()) RenderText(newTextChild->node(), oldText->substring(0,length));
                 RenderStyle* newStyle = new RenderStyle();
                 newStyle->inheritFrom(pseudoStyle);
                 letter->setStyle(newStyle);
@@ -154,7 +153,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
     if (beforeChild && beforeChild->parent() != this) {
 
         KHTMLAssert(beforeChild->parent());
-        KHTMLAssert(beforeChild->parent()->isAnonymousBox());
+        KHTMLAssert(beforeChild->parent()->isAnonymous());
 
         if (newChild->isInline()) {
             beforeChild->parent()->addChild(newChild,beforeChild);
@@ -186,7 +185,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
         
         if (beforeChild && beforeChild->parent() != this) {
             beforeChild = beforeChild->parent();
-            KHTMLAssert(beforeChild->isAnonymousBox());
+            KHTMLAssert(beforeChild->isAnonymous());
             KHTMLAssert(beforeChild->parent() == this);
         }
     }
@@ -197,14 +196,14 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
         // a new one is created and inserted into our list of children in the appropriate position.
         if (newChild->isInline()) {
             if (beforeChild) {
-                if (beforeChild->previousSibling() && beforeChild->previousSibling()->isAnonymousBox()) {
+                if (beforeChild->previousSibling() && beforeChild->previousSibling()->isAnonymous()) {
                     beforeChild->previousSibling()->addChild(newChild);
                     newChild->setNeedsLayoutAndMinMaxRecalc();
                     return;
                 }
             }
             else {
-                if (m_last && m_last->isAnonymousBox()) {
+                if (m_last && m_last->isAnonymous()) {
                     m_last->addChild(newChild);
                     newChild->setNeedsLayoutAndMinMaxRecalc();
                     return;
@@ -223,7 +222,7 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
             // We are adding another block child... if the current last child is an anonymous box
             // then it needs to be closed.
             // ### get rid of the closing thing altogether this will only work during initial parsing
-            if (lastChild() && lastChild()->isAnonymousBox()) {
+            if (lastChild() && lastChild()->isAnonymous()) {
                 lastChild()->close();
             }
         }
@@ -321,8 +320,8 @@ void RenderBlock::removeChild(RenderObject *oldChild)
     RenderObject* next = oldChild->nextSibling();
     bool mergedBlocks = false;
     if (!isInline() && !oldChild->isInline() && !oldChild->continuation() &&
-        prev && prev->isAnonymousBox() && prev->childrenInline() &&
-        next && next->isAnonymousBox() && next->childrenInline()) {
+        prev && prev->isAnonymous() && prev->childrenInline() &&
+        next && next->isAnonymous() && next->childrenInline()) {
         // Take all the children out of the |next| block and put them in
         // the |prev| block.
         RenderObject* o = next->firstChild();
@@ -335,7 +334,7 @@ void RenderBlock::removeChild(RenderObject *oldChild)
         prev->setNeedsLayoutAndMinMaxRecalc();
 
         // Nuke the now-empty block.
-        next->detach(renderArena());
+        next->detach();
 
         mergedBlocks = true;
     }
@@ -357,7 +356,7 @@ void RenderBlock::removeChild(RenderObject *oldChild)
         }
         
         // Nuke the now-empty block.
-        anonBlock->detach(renderArena());
+        anonBlock->detach();
     }
 }
 
@@ -445,7 +444,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
         relayoutChildren = true;
 
     //     kdDebug( 6040 ) << floatingObjects << "," << oldWidth << ","
-    //                     << m_width << ","<< needsLayout() << "," << isAnonymousBox() << ","
+    //                     << m_width << ","<< needsLayout() << "," << isAnonymous() << ","
     //                     << overhangingContents() << "," << isPositioned() << endl;
 
 #ifdef DEBUG_LAYOUT
@@ -725,7 +724,7 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
             RenderObject* curr = next;
             while (curr && curr->isFloatingOrPositioned())
                 curr = curr->nextSibling();
-            if (curr && curr->isRenderBlock() && !curr->isAnonymousBox() &&
+            if (curr && curr->isRenderBlock() && !curr->isAnonymous() &&
                 !curr->isCompact() && !curr->isRunIn()) {
                 curr->calcWidth(); // So that horizontal margins are correct.
                 // Need to compute margins for the child as though it is a block.
@@ -768,7 +767,7 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
             RenderObject* curr = child->nextSibling();
             while (curr && curr->isFloatingOrPositioned())
                 curr = curr->nextSibling();
-            if (curr && (curr->isRenderBlock() && !curr->isAnonymousBox() && curr->childrenInline() &&
+            if (curr && (curr->isRenderBlock() && !curr->isAnonymous() && curr->childrenInline() &&
                          !curr->isCompact() && !curr->isRunIn())) {
                 // The block acts like an inline, so just null out its
                 // position.
@@ -1283,7 +1282,7 @@ void RenderBlock::paintObject(QPainter *p, int _x, int _y,
 
 #ifdef BOX_DEBUG
     if ( style() && style()->visibility() == VISIBLE ) {
-        if(isAnonymousBox())
+        if(isAnonymous())
             outlineBox(p, _tx, _ty, "green");
         if(isFloating())
             outlineBox(p, _tx, _ty, "yellow");
@@ -2503,7 +2502,7 @@ const char *RenderBlock::renderName() const
         return "RenderBlock (floating)";
     if (isPositioned())
         return "RenderBlock (positioned)";
-    if (isAnonymousBox())
+    if (isAnonymous())
         return "RenderBlock (anonymous)";
     if (isRelPositioned())
         return "RenderBlock (relative positioned)";
index b26a319..f14e972 100644 (file)
@@ -118,14 +118,16 @@ RenderBox::~RenderBox()
     //kdDebug( 6040 ) << "Element destructor: this=" << nodeName().string() << endl;
 }
 
-void RenderBox::detach(RenderArena* renderArena)
+void RenderBox::detach()
 {
     RenderLayer* layer = m_layer;
+
+    RenderArena* arena = renderArena();
     
-    RenderContainer::detach(renderArena);
+    RenderContainer::detach();
     
     if (layer)
-        layer->detach(renderArena);
+        layer->detach(arena);
 }
 
 short RenderBox::contentWidth() const
index b9bfa30..fbdf67e 100644 (file)
@@ -50,7 +50,7 @@ public:
     virtual void paint(QPainter *p, int _x, int _y, int _w, int _h,
                        int _tx, int _ty, PaintAction paintAction);
 
-    virtual void detach(RenderArena* renderArena);
+    virtual void detach();
     
     virtual short minWidth() const { return m_minWidth; }
     virtual short maxWidth() const { return m_maxWidth; }
index 1846120..c1e6912 100644 (file)
@@ -38,6 +38,9 @@ using namespace khtml;
 RenderCanvas::RenderCanvas(DOM::NodeImpl* node, KHTMLView *view)
     : RenderBlock(node)
 {
+    // Clear our anonymous bit.
+    setIsAnonymous(false);
+        
     // init RenderObject attributes
     setInline(false);
 
index b1018ca..b2d4423 100644 (file)
@@ -30,6 +30,7 @@
 #include "render_text.h"
 #include "render_image.h"
 #include "render_canvas.h"
+#include "xml/dom_docimpl.h"
 
 #include <kdebug.h>
 #include <assert.h>
@@ -48,22 +49,22 @@ RenderContainer::~RenderContainer()
 {
 }
 
-void RenderContainer::detach(RenderArena* renderArena)
+void RenderContainer::detach()
 {
     if (continuation())
-        continuation()->detach(renderArena);
+        continuation()->detach();
     
     RenderObject* next;
     for(RenderObject* n = m_first; n; n = next ) {
         n->removeFromObjectLists();
         n->setParent(0);
         next = n->nextSibling();
-        n->detach(renderArena);
+        n->detach();
     }
     m_first = 0;
     m_last = 0;
 
-    RenderObject::detach(renderArena);
+    RenderObject::detach();
 }
 
 bool RenderContainer::canHaveChildren() const
@@ -132,16 +133,15 @@ void RenderContainer::addChild(RenderObject *newChild, RenderObject *beforeChild
         RenderTable *table;
         if( !beforeChild )
             beforeChild = lastChild();
-        if( beforeChild && beforeChild->isAnonymousBox() && beforeChild->isTable() )
+        if( beforeChild && beforeChild->isAnonymous() && beforeChild->isTable() )
             table = static_cast<RenderTable *>(beforeChild);
         else {
             //kdDebug( 6040 ) << "creating anonymous table" << endl;
-            table = new (renderArena()) RenderTable(0 /* is anonymous */);
+            table = new (renderArena()) RenderTable(document() /* is anonymous */);
             RenderStyle *newStyle = new RenderStyle();
             newStyle->inheritFrom(style());
             newStyle->setDisplay(TABLE);
             table->setStyle(newStyle);
-            table->setIsAnonymousBox(true);
             addChild(table, beforeChild);
         }
         table->addChild(newChild);
@@ -302,18 +302,18 @@ void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject
     for (ContentData* contentData = pseudo->contentData();
          contentData; contentData = contentData->_nextContent) {
         if (!pseudoContainer)
-            pseudoContainer = RenderFlow::createFlow(0, pseudo, renderArena()); /* anonymous box */
+            pseudoContainer = RenderFlow::createAnonymousFlow(document(), pseudo); /* anonymous box */
         
         if (contentData->contentType() == CONTENT_TEXT)
         {
-            RenderText* t = new (renderArena()) RenderText(0 /*anonymous object */, contentData->contentText());
+            RenderText* t = new (renderArena()) RenderText(document() /*anonymous object */, contentData->contentText());
             t->setStyle(pseudo);
             pseudoContainer->addChild(t);
             t->close();
         }
         else if (contentData->contentType() == CONTENT_OBJECT)
         {
-            RenderImage* img = new (renderArena()) RenderImage(0);
+            RenderImage* img = new (renderArena()) RenderImage(document()); /* Anonymous object */
             RenderStyle* style = new RenderStyle();
             style->inheritFrom(pseudo);
             img->setStyle(style);
@@ -365,7 +365,7 @@ void RenderContainer::insertChildNode(RenderObject* child, RenderObject* beforeC
     }
 
     KHTMLAssert(!child->parent());
-    while ( beforeChild->parent() != this && beforeChild->parent()->isAnonymousBox() )
+    while ( beforeChild->parent() != this && beforeChild->parent()->isAnonymous() )
        beforeChild = beforeChild->parent();
     KHTMLAssert(beforeChild->parent() == this);
 
@@ -410,7 +410,7 @@ void RenderContainer::removeLeftoverAnonymousBoxes()
     while( child ) {
        RenderObject *next = child->nextSibling();
        
-       if ( child->isRenderBlock() && child->isAnonymousBox() && !child->continuation() && !child->childrenInline() && !child->isTableCell() ) {
+       if ( child->isRenderBlock() && child->isAnonymous() && !child->continuation() && !child->childrenInline() && !child->isTableCell() ) {
            RenderObject *firstAnChild = child->firstChild();
            RenderObject *lastAnChild = child->lastChild();
            if ( firstAnChild ) {
@@ -444,7 +444,7 @@ void RenderContainer::removeLeftoverAnonymousBoxes()
                c->m_first = 0;
                c->m_next = 0;
            }
-           child->detach(renderArena());
+           child->detach();
        }
        child = next;
     }
index a2d1184..c254007 100644 (file)
@@ -44,7 +44,7 @@ public:
     virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
     virtual void removeChild(RenderObject *oldChild);
 
-    virtual void detach(RenderArena* renderArena);
+    virtual void detach();
     
     virtual RenderObject* removeChildNode(RenderObject* child);
     virtual void appendChildNode(RenderObject* child);
index b4233d6..951f9d5 100644 (file)
 using namespace DOM;
 using namespace khtml;
 
-RenderFlow* RenderFlow::createFlow(DOM::NodeImpl* node, RenderStyle* style, RenderArena* arena)
+RenderFlow* RenderFlow::createAnonymousFlow(DOM::DocumentImpl* doc, RenderStyle* style)
 {
     RenderFlow* result;
     if (style->display() == INLINE)
-        result = new (arena) RenderInline(node);
+        result = new (doc->renderArena()) RenderInline(doc);
     else
-        result = new (arena) RenderBlock(node);
+        result = new (doc->renderArena()) RenderBlock(doc);
     result->setStyle(style);
     return result;
 }
@@ -125,11 +125,10 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     return addChildToFlow(newChild, beforeChild);
 }
 
-void RenderFlow::deleteLineBoxes(RenderArena* arena)
+void RenderFlow::deleteLineBoxes()
 {
     if (m_firstLineBox) {
-        if (!arena)
-            arena = renderArena();
+        RenderArena* arena = renderArena();
         InlineRunBox *curr=m_firstLineBox, *next=0;
         while (curr) {
             next = curr->nextLineBox();
@@ -141,10 +140,10 @@ void RenderFlow::deleteLineBoxes(RenderArena* arena)
     }
 }
 
-void RenderFlow::detach(RenderArena* renderArena)
+void RenderFlow::detach()
 {
-    deleteLineBoxes(renderArena);
-    RenderBox::detach(renderArena);
+    deleteLineBoxes();
+    RenderBox::detach();
 }
 
 InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox, bool isRootLineBox)
index 4c9b6aa..985add1 100644 (file)
@@ -54,10 +54,10 @@ public:
     virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
     virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
 
-    static RenderFlow* createFlow(DOM::NodeImpl* node, RenderStyle* style, RenderArena* arena);
+    static RenderFlow* createAnonymousFlow(DOM::DocumentImpl* doc, RenderStyle* style);
 
-    void deleteLineBoxes(RenderArena* arena=0);
-    virtual void detach(RenderArena* arena);
+    void deleteLineBoxes();
+    virtual void detach();
 
     InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
     InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
index a189900..b21d392 100644 (file)
@@ -1325,13 +1325,13 @@ RenderTextArea::RenderTextArea(HTMLTextAreaElementImpl *element)
     connect(edit,SIGNAL(clicked()),this,SLOT(slotClicked()));
 }
 
-void RenderTextArea::detach(RenderArena *arena)
+void RenderTextArea::detach()
 {
     if ( element()->m_dirtyvalue ) {
         element()->m_value = text();
         element()->m_dirtyvalue = false;
     }
-    RenderFormElement::detach(arena);
+    RenderFormElement::detach();
 }
 
 void RenderTextArea::handleFocusOut()
index 3b8a579..63c306d 100644 (file)
@@ -437,7 +437,7 @@ class RenderTextArea : public RenderFormElement
 public:
     RenderTextArea(DOM::HTMLTextAreaElementImpl *element);
 
-    virtual void detach(RenderArena *arena);
+    virtual void detach();
 
     virtual const char *renderName() const { return "RenderTextArea"; }
     virtual void calcMinMaxWidth();
index c287cbd..eabdbfb 100644 (file)
@@ -49,8 +49,8 @@ using namespace khtml;
 
 // -------------------------------------------------------------------------
 
-RenderImage::RenderImage(HTMLElementImpl *_element)
-    : RenderReplaced(_element)
+RenderImage::RenderImage(NodeImpl *_node)
+    : RenderReplaced(_node)
 {
     image = 0;
     berrorPic = false;
@@ -432,7 +432,7 @@ void RenderImage::reload()
 }
 #endif
 
-void RenderImage::detach(RenderArena *arena)
+void RenderImage::detach()
 {
     NodeImpl *node = element();
     if (node) {
@@ -441,7 +441,7 @@ void RenderImage::detach(RenderArena *arena)
             document->removeImage(this);
         }
     }
-    RenderReplaced::detach(arena);
+    RenderReplaced::detach();
 }
 
 bool RenderImage::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
index c8083c2..c83ed9e 100644 (file)
@@ -38,7 +38,7 @@ class DocLoader;
 class RenderImage : public RenderReplaced
 {
 public:
-    RenderImage(DOM::HTMLElementImpl *_element);
+    RenderImage(DOM::NodeImpl*);
     virtual ~RenderImage();
 
     virtual const char *renderName() const { return "RenderImage"; }
@@ -70,7 +70,7 @@ public:
     virtual short calcReplacedWidth() const;
     virtual int calcReplacedHeight() const;
 
-    virtual void detach(RenderArena *);
+    virtual void detach();
 
     // Called to set generated content images (e.g., :before/:after generated images).
     void setContentObject(CachedObject* co);
index d6b0f85..828f790 100644 (file)
@@ -26,7 +26,7 @@
 #include "render_arena.h"
 #include "render_inline.h"
 #include "render_block.h"
-#include "xml/dom_nodeimpl.h"
+#include "xml/dom_docimpl.h"
 
 using namespace khtml;
 
@@ -88,9 +88,8 @@ void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeCh
         newStyle->inheritFrom(style());
         newStyle->setDisplay(BLOCK);
 
-        RenderBlock *newBox = new (renderArena()) RenderBlock(0 /* anonymous box */);
+        RenderBlock *newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
         newBox->setStyle(newStyle);
-        newBox->setIsAnonymousBox(true);
         RenderFlow* oldContinuation = continuation();
         setContinuation(newBox);
 
@@ -198,7 +197,7 @@ void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox
     RenderBlock* pre = 0;
     RenderBlock* block = containingBlock();
     bool madeNewBeforeBlock = false;
-    if (block->isAnonymousBox()) {
+    if (block->isAnonymous()) {
         // We can reuse this block and make it the preBlock of the next continuation.
         pre = block;
         block = block->containingBlock();
@@ -359,7 +358,7 @@ const char *RenderInline::renderName() const
 {
     if (isRelPositioned())
         return "RenderInline (relative positioned)";
-    if (isAnonymousBox())
+    if (isAnonymous())
         return "RenderInline (anonymous)";
     return "RenderInline";
 }
index 0857b51..087bddb 100644 (file)
@@ -140,7 +140,7 @@ void RenderListItem::setStyle(RenderStyle *_style)
         newStyle->ref();
         newStyle->inheritFrom(style());
         if (!m_marker) {
-            m_marker = new (renderArena()) RenderListMarker();
+            m_marker = new (renderArena()) RenderListMarker(document());
             m_marker->setStyle(newStyle);
             m_marker->setListItem(this);
             _markerInstalledInParent = false;
@@ -149,7 +149,7 @@ void RenderListItem::setStyle(RenderStyle *_style)
             m_marker->setStyle(newStyle);
         newStyle->deref();
     } else if (m_marker) {
-        m_marker->detach(renderArena());
+        m_marker->detach();
         m_marker = 0;
     }
 }
@@ -158,13 +158,13 @@ RenderListItem::~RenderListItem()
 {
 }
 
-void RenderListItem::detach(RenderArena* renderArena)
+void RenderListItem::detach()
 {    
     if (m_marker && !_markerInstalledInParent) {
-        m_marker->detach(renderArena);
+        m_marker->detach();
         m_marker = 0;
     }
-    RenderBlock::detach(renderArena);
+    RenderBlock::detach();
 }
 
 void RenderListItem::calcListValue()
@@ -232,7 +232,7 @@ void RenderListItem::updateMarkerLocation()
             // then we are the only item in that anonymous box (since no line box
             // parent was found).  It's ok to just leave the marker where it is
             // in this case.
-            if (markerPar && markerPar->isAnonymousBox())
+            if (markerPar && markerPar->isAnonymous())
                 lineBoxParent = markerPar;
             else
                 lineBoxParent = this;
@@ -291,8 +291,8 @@ void RenderListItem::paintObject(QPainter *p, int _x, int _y,
 
 // -----------------------------------------------------------
 
-RenderListMarker::RenderListMarker()
-    : RenderBox(0), m_listImage(0), m_value(-1)
+RenderListMarker::RenderListMarker(DocumentImpl* document)
+    : RenderBox(document), m_listImage(0), m_value(-1)
 {
     // init RenderObject attributes
     setInline(true);   // our object is Inline
index 9ea9d42..7d80fc5 100644 (file)
@@ -39,7 +39,7 @@ class RenderListItem;
 class RenderListMarker : public RenderBox
 {
 public:
-    RenderListMarker();
+    RenderListMarker(DOM::DocumentImpl* document);
     ~RenderListMarker();
 
     virtual void setStyle(RenderStyle *style);
@@ -84,7 +84,7 @@ public:
     RenderListItem(DOM::NodeImpl*);
     virtual ~RenderListItem();
     
-    virtual void detach(RenderArena *);
+    virtual void detach();
 
     virtual const char *renderName() const { return "RenderListItem"; }
 
index b37908e..2ffbf95 100644 (file)
 #include "render_block.h"
 #include "render_flexbox.h"
 
+#if APPLE_CHANGES
+// For accessibility
+#include "KWQAccObjectCache.h" 
+#endif
+
 #include <assert.h>
 using namespace DOM;
 using namespace khtml;
@@ -133,7 +138,7 @@ m_overhangingContents( false ),
 m_relPositioned( false ),
 m_paintBackground( false ),
 
-m_isAnonymous( false ),
+m_isAnonymous( node == node->getDocument() ),
 m_recalcMinMax( false ),
 m_isText( false ),
 m_inline( true ),
@@ -982,7 +987,7 @@ QString RenderObject::information() const
     if (isInline()) ts << "il ";
     if (childrenInline()) ts << "ci ";
     if (isFloating()) ts << "fl ";
-    if (isAnonymousBox()) ts << "an ";
+    if (isAnonymous()) ts << "an ";
     if (isRelPositioned()) ts << "rp ";
     if (isPositioned()) ts << "ps ";
     if (overhangingContents()) ts << "oc ";
@@ -1025,7 +1030,7 @@ void RenderObject::printTree(int indent) const
 
 void RenderObject::dump(QTextStream *stream, QString ind) const
 {
-    if (isAnonymousBox()) { *stream << " anonymousBox"; }
+    if (isAnonymous()) { *stream << " anonymous"; }
     if (isFloating()) { *stream << " floating"; }
     if (isPositioned()) { *stream << " positioned"; }
     if (isRelPositioned()) { *stream << " relPositioned"; }
@@ -1061,9 +1066,8 @@ RenderBlock* RenderObject::createAnonymousBlock()
     newStyle->inheritFrom(m_style);
     newStyle->setDisplay(BLOCK);
 
-    RenderBlock *newBox = new (renderArena()) RenderBlock(0 /* anonymous box */);
+    RenderBlock *newBox = new (renderArena()) RenderBlock(document() /* anonymous box */);
     newBox->setStyle(newStyle);
-    newBox->setIsAnonymousBox(true);
     return newBox;
 }
 
@@ -1368,25 +1372,29 @@ void RenderObject::removeFromObjectLists()
     }
 }
 
-DOM::DocumentImpl* RenderObject::document() const
-{
-    DOM::NodeImpl* elt = element();
-    RenderObject* current = parent();
-    while (!elt && current) {
-        elt = current->element();
-        current = current->parent();
-    }
-    return elt ? elt->getDocument() : 0;
-}
-
 RenderArena* RenderObject::renderArena() const
 {
     DOM::DocumentImpl* doc = document();
     return doc ? doc->renderArena() : 0;
 }
 
+void RenderObject::remove()
+{
+#if APPLE_CHANGES
+    // Delete our accessibility object if we have one.
+    KWQAccObjectCache* cache = document()->getExistingAccObjectCache();
+    if (cache)
+        cache->detach(this);
+#endif
 
-void RenderObject::detach(RenderArena* renderArena)
+    removeFromObjectLists();
+
+    if (parent())
+        //have parent, take care of the tree integrity
+        parent()->removeChild(this);
+}
+
+void RenderObject::detach()
 {
 #ifndef INCREMENTAL_REPAINTING
     // If we're an overflow:hidden object that currently needs layout, we need
@@ -1400,10 +1408,8 @@ void RenderObject::detach(RenderArena* renderArena)
 
     remove();
     
-    m_next = m_previous = 0;
-    
     // by default no refcounting
-    arenaDelete(renderArena, this);
+    arenaDelete(document()->renderArena(), this);
 }
 
 void RenderObject::arenaDelete(RenderArena *arena, void *base)
index f443266..b41470d 100644 (file)
@@ -34,6 +34,7 @@
 #include "misc/helper.h"
 #include "rendering/render_style.h"
 #include "khtml_events.h"
+#include "xml/dom_nodeimpl.h"
 
 // Uncomment to turn on incremental repainting.
 // #define INCREMENTAL_REPAINTING 1
@@ -82,7 +83,6 @@ typedef enum {
 namespace DOM {
     class HTMLAreaElementImpl;
     class DOMString;
-    class NodeImpl;
     class DocumentImpl;
     class ElementImpl;
     class EventImpl;
@@ -107,7 +107,8 @@ namespace khtml {
 class RenderObject : public CachedObjectClient
 {
 public:
-
+    // Anonymous objects should pass the document as their node, and they will then automatically be
+    // marked as anonymous in the constructor.
     RenderObject(DOM::NodeImpl* node);
     virtual ~RenderObject();
 
@@ -227,9 +228,9 @@ public:
     virtual bool isFrameSet() const { return false; }
     virtual bool isApplet() const { return false; }
 
-    bool isAnonymousBox() const { return m_isAnonymous; }
-    void setIsAnonymousBox(bool b) { m_isAnonymous = b; }
-
+    bool isAnonymous() const { return m_isAnonymous; }
+    void setIsAnonymous(bool b) { m_isAnonymous = b; }
+    
     bool isFloating() const { return m_floating; }
     bool isPositioned() const { return m_positioned; } // absolute or fixed positioning
     bool isRelPositioned() const { return m_relPositioned; } // relative positioning
@@ -253,8 +254,10 @@ public:
     RenderCanvas* canvas() const;
 
     // don't even think about making this method virtual!
-    DOM::NodeImpl* element() const { return m_node; }
-    DOM::DocumentImpl* document() const;
+    DOM::NodeImpl* element() const { return m_isAnonymous ? 0 : m_node; }
+    DOM::DocumentImpl* document() const { return m_node->getDocument(); }
+    void setNode(DOM::NodeImpl* node) { m_node = node; }
+    DOM::NodeImpl* node() const { return m_node; }
     
    /**
      * returns the object containing this one. can be different from parent for
@@ -633,7 +636,7 @@ public:
     virtual void calcVerticalMargins() {}
     void removeFromObjectLists();
 
-    virtual void detach(RenderArena* renderArena);
+    virtual void detach();
 
     const QFont &font(bool firstLine) const {
        return style( firstLine )->font();
@@ -658,13 +661,8 @@ protected:
                                      int /*_w*/, int /*_h*/, int /*_tx*/, int /*_ty*/) {}
 
     virtual QRect viewRect() const;
-    void remove() {
-        removeFromObjectLists();
 
-        if ( parent() )
-            //have parent, take care of the tree integrity
-            parent()->removeChild(this);
-    }
+    void remove();
 
     void invalidateVerticalPositions();
     short getVerticalPosition( bool firstLine ) const;
@@ -675,9 +673,9 @@ protected:
 
 private:
     RenderStyle* m_style;
-protected:
+
     DOM::NodeImpl* m_node;
-private:
+
     RenderObject *m_parent;
     RenderObject *m_previous;
     RenderObject *m_next;
index a762633..8a101d4 100644 (file)
@@ -130,7 +130,7 @@ RenderWidget::RenderWidget(DOM::NodeImpl* node)
     ref();
 }
 
-void RenderWidget::detach(RenderArena* renderArena)
+void RenderWidget::detach()
 {
     remove();
 
@@ -141,10 +141,10 @@ void RenderWidget::detach(RenderArena* renderArena)
         m_widget->removeEventFilter( this );
         m_widget->setMouseTracking( false );
     }
-    
-    m_node = 0;
-    
-    deref(renderArena);
+
+    RenderArena* arena = renderArena();
+    setNode(0);
+    deref(arena);
 }
 
 RenderWidget::~RenderWidget()
index de438a5..db18fcf 100644 (file)
@@ -74,7 +74,7 @@ public:
 
     virtual bool isWidget() const { return true; };
 
-    virtual void detach(RenderArena* renderArena);
+    virtual void detach();
     virtual void layout( );
 
     QWidget *widget() const { return m_widget; }
index cb33b76..407dc09 100644 (file)
@@ -33,6 +33,7 @@
 #include "html/html_tableimpl.h"
 #include "misc/htmltags.h"
 #include "misc/htmlattrs.h"
+#include "xml/dom_docimpl.h"
 
 #include <kglobal.h>
 
@@ -143,26 +144,25 @@ void RenderTable::addChild(RenderObject *child, RenderObject *beforeChild)
         break;
     default:
         if ( !beforeChild && lastChild() &&
-            lastChild()->isTableSection() && lastChild()->isAnonymousBox() ) {
+            lastChild()->isTableSection() && lastChild()->isAnonymous() ) {
             o = lastChild();
         } else {
            RenderObject *lastBox = beforeChild;
-           while ( lastBox && lastBox->parent()->isAnonymousBox() &&
+           while ( lastBox && lastBox->parent()->isAnonymous() &&
                    !lastBox->isTableSection() && lastBox->style()->display() != TABLE_CAPTION )
                lastBox = lastBox->parent();
-           if ( lastBox && lastBox->isAnonymousBox() ) {
+           if ( lastBox && lastBox->isAnonymous() ) {
                lastBox->addChild( child, beforeChild );
                return;
            } else {
                if ( beforeChild && !beforeChild->isTableSection() )
                    beforeChild = 0;
                //kdDebug( 6040 ) << this <<" creating anonymous table section beforeChild="<< beforeChild << endl;
-               o = new (renderArena()) RenderTableSection(0 /* anonymous */);
+               o = new (renderArena()) RenderTableSection(document() /* anonymous */);
                RenderStyle *newStyle = new RenderStyle();
                newStyle->inheritFrom(style());
                 newStyle->setDisplay(TABLE_ROW_GROUP);
                o->setStyle(newStyle);
-               o->setIsAnonymousBox(true);
                addChild(o, beforeChild);
            }
         }
@@ -711,14 +711,14 @@ RenderTableSection::~RenderTableSection()
     clearGrid();
 }
 
-void RenderTableSection::detach(RenderArena* arena)
+void RenderTableSection::detach()
 {
     // recalc cell info because RenderTable has unguarded pointers
     // stored that point to this RenderTableSection.
     if (table())
         table()->setNeedSectionRecalc();
 
-    RenderBox::detach(arena);
+    RenderBox::detach();
 }
 
 void RenderTableSection::setStyle(RenderStyle* _style)
@@ -750,23 +750,22 @@ void RenderTableSection::addChild(RenderObject *child, RenderObject *beforeChild
         if( !beforeChild )
             beforeChild = lastChild();
 
-        if( beforeChild && beforeChild->isAnonymousBox() )
+        if( beforeChild && beforeChild->isAnonymous() )
             row = beforeChild;
         else {
            RenderObject *lastBox = beforeChild;
-           while ( lastBox && lastBox->parent()->isAnonymousBox() && !lastBox->isTableRow() )
+           while ( lastBox && lastBox->parent()->isAnonymous() && !lastBox->isTableRow() )
                lastBox = lastBox->parent();
-           if ( lastBox && lastBox->isAnonymousBox() ) {
+           if ( lastBox && lastBox->isAnonymous() ) {
                lastBox->addChild( child, beforeChild );
                return;
            } else {
                //kdDebug( 6040 ) << "creating anonymous table row" << endl;
-               row = new (renderArena()) RenderTableRow(0 /* anonymous table */);
+               row = new (renderArena()) RenderTableRow(document() /* anonymous table */);
                RenderStyle *newStyle = new RenderStyle();
                newStyle->inheritFrom(style());
                newStyle->setDisplay( TABLE_ROW );
                row->setStyle(newStyle);
-               row->setIsAnonymousBox(true);
                addChild(row, beforeChild);
            }
         }
@@ -1319,13 +1318,13 @@ RenderTableRow::RenderTableRow(DOM::NodeImpl* node)
     setInline(false);   // our object is not Inline
 }
 
-void RenderTableRow::detach(RenderArena* arena)
+void RenderTableRow::detach()
 {
     RenderTableSection *s = section();
     if (s) {
         s->setNeedCellRecalc();
     }
-    RenderContainer::detach(arena);
+    RenderContainer::detach();
 }
 
 void RenderTableRow::setStyle(RenderStyle* style)
@@ -1352,15 +1351,14 @@ void RenderTableRow::addChild(RenderObject *child, RenderObject *beforeChild)
         if ( !last )
             last = lastChild();
         RenderTableCell *cell = 0;
-        if( last && last->isAnonymousBox() && last->isTableCell() )
+        if( last && last->isAnonymous() && last->isTableCell() )
             cell = static_cast<RenderTableCell *>(last);
         else {
-           cell = new (renderArena()) RenderTableCell(0 /* anonymous object */);
+           cell = new (renderArena()) RenderTableCell(document() /* anonymous object */);
            RenderStyle *newStyle = new RenderStyle();
            newStyle->inheritFrom(style());
            newStyle->setDisplay( TABLE_CELL );
            cell->setStyle(newStyle);
-           cell->setIsAnonymousBox(true);
            addChild(cell, beforeChild);
         }
         cell->addChild(child);
@@ -1443,12 +1441,12 @@ RenderTableCell::RenderTableCell(DOM::NodeImpl* _node)
   m_percentageHeight = 0;
 }
 
-void RenderTableCell::detach(RenderArena* arena)
+void RenderTableCell::detach()
 {
     if (parent() && section())
         section()->setNeedCellRecalc();
 
-    RenderBlock::detach(arena);
+    RenderBlock::detach();
 }
 
 void RenderTableCell::updateFromElement()
index 82f3b3c..d840f55 100644 (file)
@@ -191,7 +191,7 @@ class RenderTableSection : public RenderBox
 public:
     RenderTableSection(DOM::NodeImpl* node);
     ~RenderTableSection();
-    virtual void detach(RenderArena* arena);
+    virtual void detach();
 
     virtual void setStyle(RenderStyle *style);
 
@@ -265,7 +265,7 @@ class RenderTableRow : public RenderContainer
 public:
     RenderTableRow(DOM::NodeImpl* node);
 
-    virtual void detach(RenderArena* arena);
+    virtual void detach();
 
     virtual void setStyle( RenderStyle* );
     virtual const char *renderName() const { return "RenderTableRow"; }
@@ -297,7 +297,7 @@ class RenderTableCell : public RenderBlock
 public:
     RenderTableCell(DOM::NodeImpl* node);
 
-    virtual void detach(RenderArena* arena);
+    virtual void detach();
 
     virtual const char *renderName() const { return "RenderTableCell"; }
     virtual bool isTableCell() const { return true; }
index c8e468d..f083da7 100644 (file)
@@ -329,13 +329,13 @@ RenderText::~RenderText()
     if(str) str->deref();
 }
 
-void RenderText::detach(RenderArena* renderArena)
+void RenderText::detach()
 {
-    deleteRuns(renderArena);
-    RenderObject::detach(renderArena);
+    deleteRuns();
+    RenderObject::detach();
 }
 
-void RenderText::deleteRuns(RenderArena *arena)
+void RenderText::deleteRuns()
 {
     // this is a slight variant of QArray::clear().
     // We don't delete the array itself here because its
@@ -343,8 +343,7 @@ void RenderText::deleteRuns(RenderArena *arena)
     // us resize() calls
     unsigned int len = m_lines.size();
     if (len) {
-        if (!arena)
-            arena = renderArena();
+        RenderArena* arena = renderArena();
         for(unsigned int i=0; i < len; i++) {
             InlineTextBox* s = m_lines.at(i);
             if (s)
index c63f269..d082616 100644 (file)
@@ -53,7 +53,7 @@ public:
         m_toAdd = 0;
     }
     
-    void detach(RenderArena* renderArena);
+    void detach(RenderArena* arena);
     
     // Overloaded new operator.  Derived classes must override operator new
     // in order to allocate out of the RenderArena.
@@ -131,8 +131,8 @@ public:
     virtual void paintObject(QPainter *, int x, int y, int w, int h,
                              int tx, int ty, PaintAction paintAction);
 
-    void deleteRuns(RenderArena *renderArena = 0);
-    virtual void detach(RenderArena* renderArena);
+    void deleteRuns();
+    virtual void detach();
     
     DOM::DOMString data() const { return str; }
     DOM::DOMStringImpl *string() const { return str; }
index 4b2f857..8c828ec 100644 (file)
 
 #include <kio/job.h>
 
+#if APPLE_CHANGES
+#include "KWQAccObjectCache.h"
+#endif
+
 using namespace DOM;
 using namespace khtml;
 
@@ -242,6 +246,10 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
 
     m_view = v;
     m_renderArena = 0;
+
+#if APPLE_CHANGES
+    m_accCache = 0;
+#endif
     
     if ( v ) {
         m_docLoader = new DocLoader(v->part(), this );
@@ -347,6 +355,13 @@ DocumentImpl::~DocumentImpl()
         delete m_renderArena;
         m_renderArena = 0;
     }
+
+#if APPLE_CHANGES
+    if (m_accCache){
+        delete m_accCache;
+        m_accCache = 0;
+    }
+#endif
     
     if (m_decoder){
         m_decoder->deref();
@@ -1080,7 +1095,7 @@ void DocumentImpl::detach()
     NodeBaseImpl::detach();
 
     if ( render )
-        render->detach(m_renderArena);
+        render->detach();
 
     if (m_paintDevice == m_view)
         setPaintDevice(0);
@@ -1092,6 +1107,15 @@ void DocumentImpl::detach()
     }
 }
 
+#if APPLE_CHANGES
+KWQAccObjectCache* DocumentImpl::getOrCreateAccObjectCache()
+{
+    if (!m_accCache)
+        m_accCache = new KWQAccObjectCache;
+    return m_accCache;
+}
+#endif
+
 void DocumentImpl::setVisuallyOrdered()
 {
     visuallyOrdered = true;
index 12ef226..111ca10 100644 (file)
@@ -48,6 +48,10 @@ class KHTMLView;
 class Tokenizer;
 class RenderArena;
 
+#if APPLE_CHANGES
+class KWQAccObjectCache;
+#endif
+
 namespace khtml {
     class CSSStyleSelector;
     class DocLoader;
@@ -236,6 +240,11 @@ public:
     virtual void detach();
 
     RenderArena* renderArena() { return m_renderArena; }
+
+#if APPLE_CHANGES
+    KWQAccObjectCache* getExistingAccObjectCache() { return m_accCache; }
+    KWQAccObjectCache* getOrCreateAccObjectCache();
+#endif
     
     // to get visually ordered hebrew and arabic pages right
     void setVisuallyOrdered();
@@ -527,6 +536,10 @@ protected:
     DOMString m_title;
     
     RenderArena* m_renderArena;
+
+#if APPLE_CHANGES
+    KWQAccObjectCache* m_accCache;
+#endif
     
     QPtrList<khtml::RenderImage> m_imageLoadEventDispatchSoonList;
     QPtrList<khtml::RenderImage> m_imageLoadEventDispatchingList;
index e395f20..5dd0aa4 100644 (file)
@@ -996,8 +996,8 @@ void NodeImpl::detach()
 {
 //    assert(m_attached);
 
-    if ( m_render )
-        m_render->detach(getDocument()->renderArena());
+    if (m_render)
+        m_render->detach();
 
     m_render = 0;
     m_attached = false;
diff --git a/WebCore/kwq/KWQAccObject.h b/WebCore/kwq/KWQAccObject.h
new file mode 100644 (file)
index 0000000..90da091
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+                                        * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+                                        * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+namespace khtml {
+    class RenderObject;
+}
+
+@interface KWQAccObject : NSObject
+{
+    khtml::RenderObject* m_renderer;
+    id m_data;
+}
+
+-(long)x;
+-(long)y;
+-(long)width;
+-(long)height;
+
+-(BOOL)detached;
+-(void)detach;
+
+-(id)data;
+-(void)setData:(id)data;
+
+-(KWQAccObject*)firstChild;
+-(KWQAccObject*)lastChild;
+-(KWQAccObject*)previousSibling;
+-(KWQAccObject*)nextSibling;
+-(KWQAccObject*)parentObject;
+
+@end
diff --git a/WebCore/kwq/KWQAccObject.mm b/WebCore/kwq/KWQAccObject.mm
new file mode 100644 (file)
index 0000000..3bfb829
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+                                        * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+                                        * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "KWQAccObject.h"
+#import "KWQAccObjectCache.h"
+
+#import "render_object.h"
+#import "dom_docimpl.h"
+
+@implementation KWQAccObject
+-(long)x
+{
+    if (!m_renderer)
+        return 0;
+    int x, y;
+    m_renderer->absolutePosition(x,y);
+    return x;
+}
+
+-(long)y
+{
+    if (!m_renderer)
+        return 0;
+    int x, y;
+    m_renderer->absolutePosition(x,y);
+    return y;
+}
+
+-(long)width
+{
+    if (!m_renderer)
+        return 0;
+    return m_renderer->width();
+}
+
+-(long)height
+{
+    if (!m_renderer)
+        return 0;
+    return m_renderer->height();
+}
+
+-(BOOL)detached
+{
+    return !m_renderer;
+}
+
+-(void)detach
+{
+    [m_data release];
+    m_data = 0;
+    m_renderer = 0;
+}
+
+-(id)data
+{
+    return m_data;
+}
+
+-(void)setData:(id)data
+{
+    if (!m_renderer)
+        return;
+
+    [data retain];
+    [m_data release];
+    m_data = data;
+}
+
+-(KWQAccObject*)firstChild
+{
+    if (!m_renderer || !m_renderer->firstChild())
+        return nil;
+    return m_renderer->document()->getOrCreateAccObjectCache()->accObject(m_renderer->firstChild());
+}
+
+-(KWQAccObject*)lastChild
+{
+    if (!m_renderer || !m_renderer->lastChild())
+        return nil;
+    return m_renderer->document()->getOrCreateAccObjectCache()->accObject(m_renderer->lastChild());
+}
+
+-(KWQAccObject*)previousSibling
+{
+    if (!m_renderer || !m_renderer->previousSibling())
+        return nil;
+    return m_renderer->document()->getOrCreateAccObjectCache()->accObject(m_renderer->previousSibling());
+}
+
+-(KWQAccObject*)nextSibling
+{
+    if (!m_renderer || !m_renderer->nextSibling())
+        return nil;
+    return m_renderer->document()->getOrCreateAccObjectCache()->accObject(m_renderer->nextSibling());
+}
+
+-(KWQAccObject*)parentObject
+{
+    if (!m_renderer || !m_renderer->parent())
+        return nil;
+    return m_renderer->document()->getOrCreateAccObjectCache()->accObject(m_renderer->parent());
+}
+@end
diff --git a/WebCore/kwq/KWQAccObjectCache.h b/WebCore/kwq/KWQAccObjectCache.h
new file mode 100644 (file)
index 0000000..7320ad7
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+                                        * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+                                        * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#ifdef __OBJC__
+@class KWQAccObject;
+#else
+class KWQAccObject;
+#endif
+
+namespace khtml {
+    class RenderObject;
+}
+
+class KWQAccObjectCache
+{
+public:
+    KWQAccObjectCache();
+    ~KWQAccObjectCache();
+    
+    KWQAccObject* accObject(khtml::RenderObject* renderer);
+    void setAccObject(khtml::RenderObject* renderer, KWQAccObject* obj);
+    void removeAccObject(khtml::RenderObject* renderer);
+    
+    void detach(khtml::RenderObject* renderer);
+        
+private:
+    CFMutableDictionaryRef accCache;
+};
diff --git a/WebCore/kwq/KWQAccObjectCache.mm b/WebCore/kwq/KWQAccObjectCache.mm
new file mode 100644 (file)
index 0000000..4e05341
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "KWQAccObjectCache.h"
+#include "KWQAccObject.h"
+
+KWQAccObjectCache::KWQAccObjectCache()
+{
+    accCache = NULL;
+}
+
+KWQAccObjectCache::~KWQAccObjectCache()
+{
+    // Destroy the dictionary.
+    CFRelease(accCache);
+}
+
+KWQAccObject* KWQAccObjectCache::accObject(khtml::RenderObject* renderer)
+{
+    if (!accCache)
+        return NULL;
+    
+    return (KWQAccObject*)CFDictionaryGetValue(accCache, renderer);
+}
+
+void KWQAccObjectCache::setAccObject(khtml::RenderObject* impl, KWQAccObject* accObject)
+{
+    if (!accCache)
+        // No need to retain/free either impl key, or id value.  Items will be removed
+        // from the cache in the object's dealloc method.
+        accCache = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
+    
+    CFDictionarySetValue(accCache, (const void *)impl, accObject);
+}
+
+void KWQAccObjectCache::removeAccObject(khtml::RenderObject* impl)
+{
+    [accObject(impl) detach];
+    CFDictionaryRemoveValue(accCache, impl);
+}
+
+void KWQAccObjectCache::detach(khtml::RenderObject* renderer)
+{
+    removeAccObject(renderer);
+}