OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights reserved. |
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild) | 111 void RenderTable::addChild(RenderObject* child, RenderObject* beforeChild) |
112 { | 112 { |
113 // Make sure we don't append things after :after-generated content if we hav
e it. | 113 // Make sure we don't append things after :after-generated content if we hav
e it. |
114 if (!beforeChild) | 114 if (!beforeChild) |
115 beforeChild = afterPseudoElementRenderer(); | 115 beforeChild = afterPseudoElementRenderer(); |
116 | 116 |
117 bool wrapInAnonymousSection = !child->isPositioned(); | 117 bool wrapInAnonymousSection = !child->isPositioned(); |
118 | 118 |
119 if (child->isTableCaption()) { | 119 if (child->isTableCaption()) { |
120 m_captions.append(toRenderTableCaption(child)); | 120 m_captions.append(toRenderTableCaption(child)); |
121 setNeedsSectionRecalc(); | |
122 wrapInAnonymousSection = false; | 121 wrapInAnonymousSection = false; |
123 } else if (child->isTableCol()) { | 122 } else if (child->isTableCol()) { |
124 m_hasColElements = true; | 123 m_hasColElements = true; |
125 wrapInAnonymousSection = false; | 124 wrapInAnonymousSection = false; |
126 } else if (child->isTableSection()) { | 125 } else if (child->isTableSection()) { |
127 switch (child->style()->display()) { | 126 switch (child->style()->display()) { |
128 case TABLE_HEADER_GROUP: | 127 case TABLE_HEADER_GROUP: |
129 resetSectionPointerIfNotBefore(m_head, beforeChild); | 128 resetSectionPointerIfNotBefore(m_head, beforeChild); |
130 if (!m_head) { | 129 if (!m_head) { |
131 m_head = toRenderTableSection(child); | 130 m_head = toRenderTableSection(child); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 787 |
789 return 0; | 788 return 0; |
790 } | 789 } |
791 | 790 |
792 void RenderTable::recalcSections() const | 791 void RenderTable::recalcSections() const |
793 { | 792 { |
794 m_head = 0; | 793 m_head = 0; |
795 m_foot = 0; | 794 m_foot = 0; |
796 m_firstBody = 0; | 795 m_firstBody = 0; |
797 m_hasColElements = false; | 796 m_hasColElements = false; |
| 797 m_captions.clear(); |
798 | 798 |
799 // We need to get valid pointers to caption, head, foot and first body again | 799 // We need to get valid pointers to caption, head, foot and first body again |
800 RenderObject* nextSibling; | 800 RenderObject* nextSibling; |
801 for (RenderObject* child = firstChild(); child; child = nextSibling) { | 801 for (RenderObject* child = firstChild(); child; child = nextSibling) { |
802 nextSibling = child->nextSibling(); | 802 nextSibling = child->nextSibling(); |
803 switch (child->style()->display()) { | 803 switch (child->style()->display()) { |
804 case TABLE_COLUMN: | 804 case TABLE_CAPTION: |
805 case TABLE_COLUMN_GROUP: | 805 if (child->isTableCaption()) |
806 m_hasColElements = true; | 806 m_captions.append(toRenderTableCaption(child)); |
807 break; | 807 break; |
808 case TABLE_HEADER_GROUP: | 808 case TABLE_COLUMN: |
809 if (child->isTableSection()) { | 809 case TABLE_COLUMN_GROUP: |
810 RenderTableSection* section = toRenderTableSection(child); | 810 m_hasColElements = true; |
811 if (!m_head) | 811 break; |
812 m_head = section; | 812 case TABLE_HEADER_GROUP: |
813 else if (!m_firstBody) | 813 if (child->isTableSection()) { |
814 m_firstBody = section; | 814 RenderTableSection* section = toRenderTableSection(child); |
815 section->recalcCellsIfNeeded(); | 815 if (!m_head) |
816 } | 816 m_head = section; |
817 break; | 817 else if (!m_firstBody) |
818 case TABLE_FOOTER_GROUP: | 818 m_firstBody = section; |
819 if (child->isTableSection()) { | 819 section->recalcCellsIfNeeded(); |
820 RenderTableSection* section = toRenderTableSection(child); | 820 } |
821 if (!m_foot) | 821 break; |
822 m_foot = section; | 822 case TABLE_FOOTER_GROUP: |
823 else if (!m_firstBody) | 823 if (child->isTableSection()) { |
824 m_firstBody = section; | 824 RenderTableSection* section = toRenderTableSection(child); |
825 section->recalcCellsIfNeeded(); | 825 if (!m_foot) |
826 } | 826 m_foot = section; |
827 break; | 827 else if (!m_firstBody) |
828 case TABLE_ROW_GROUP: | 828 m_firstBody = section; |
829 if (child->isTableSection()) { | 829 section->recalcCellsIfNeeded(); |
830 RenderTableSection* section = toRenderTableSection(child); | 830 } |
831 if (!m_firstBody) | 831 break; |
832 m_firstBody = section; | 832 case TABLE_ROW_GROUP: |
833 section->recalcCellsIfNeeded(); | 833 if (child->isTableSection()) { |
834 } | 834 RenderTableSection* section = toRenderTableSection(child); |
835 break; | 835 if (!m_firstBody) |
836 default: | 836 m_firstBody = section; |
837 break; | 837 section->recalcCellsIfNeeded(); |
| 838 } |
| 839 break; |
| 840 default: |
| 841 break; |
838 } | 842 } |
839 } | 843 } |
840 | 844 |
841 // repair column count (addChild can grow it too much, because it always add
s elements to the last row of a section) | 845 // repair column count (addChild can grow it too much, because it always add
s elements to the last row of a section) |
842 unsigned maxCols = 0; | 846 unsigned maxCols = 0; |
843 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { | 847 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) { |
844 if (child->isTableSection()) { | 848 if (child->isTableSection()) { |
845 RenderTableSection* section = toRenderTableSection(child); | 849 RenderTableSection* section = toRenderTableSection(child); |
846 unsigned sectionCols = section->numColumns(); | 850 unsigned sectionCols = section->numColumns(); |
847 if (sectionCols > maxCols) | 851 if (sectionCols > maxCols) |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { | 1278 if (visibleToHitTesting() && (action == HitTestBlockBackground || action ==
HitTestChildBlockBackground) && boundsRect.intersects(result.rectForPoint(pointI
nContainer))) { |
1275 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); | 1279 updateHitTestResult(result, flipForWritingMode(pointInContainer - toLayo
utSize(adjustedLocation))); |
1276 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) | 1280 if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, bound
sRect)) |
1277 return true; | 1281 return true; |
1278 } | 1282 } |
1279 | 1283 |
1280 return false; | 1284 return false; |
1281 } | 1285 } |
1282 | 1286 |
1283 } | 1287 } |
OLD | NEW |