| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #include "config.h" | 20 #include "config.h" |
| 21 #include "core/rendering/InlineBox.h" | 21 #include "core/rendering/InlineBox.h" |
| 22 | 22 |
| 23 #include "core/platform/Partitions.h" |
| 23 #include "core/platform/graphics/FontMetrics.h" | 24 #include "core/platform/graphics/FontMetrics.h" |
| 24 #include "core/rendering/InlineFlowBox.h" | 25 #include "core/rendering/InlineFlowBox.h" |
| 25 #include "core/rendering/PaintInfo.h" | 26 #include "core/rendering/PaintInfo.h" |
| 26 #include "core/rendering/RenderArena.h" | |
| 27 #include "core/rendering/RenderBlock.h" | 27 #include "core/rendering/RenderBlock.h" |
| 28 #include "core/rendering/RootInlineBox.h" | 28 #include "core/rendering/RootInlineBox.h" |
| 29 | 29 |
| 30 #ifndef NDEBUG | 30 #ifndef NDEBUG |
| 31 #include <stdio.h> | 31 #include <stdio.h> |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 using namespace std; | 34 using namespace std; |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 void InlineBox::remove() | 65 void InlineBox::remove() |
| 66 { | 66 { |
| 67 if (parent()) | 67 if (parent()) |
| 68 parent()->removeChild(this); | 68 parent()->removeChild(this); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void InlineBox::destroy(RenderArena* renderArena) | 71 void* InlineBox::operator new(size_t sz) |
| 72 { | 72 { |
| 73 #ifndef NDEBUG | 73 return partitionAlloc(Partitions::getRenderingPartition(), sz); |
| 74 inInlineBoxDetach = true; | |
| 75 #endif | |
| 76 delete this; | |
| 77 #ifndef NDEBUG | |
| 78 inInlineBoxDetach = false; | |
| 79 #endif | |
| 80 | |
| 81 // Recover the size left there for us by operator delete and free the memory
. | |
| 82 renderArena->free(*(size_t *)this, this); | |
| 83 } | 74 } |
| 84 | 75 |
| 85 void* InlineBox::operator new(size_t sz, RenderArena* renderArena) | 76 void InlineBox::operator delete(void* ptr) |
| 86 { | 77 { |
| 87 return renderArena->allocate(sz); | 78 partitionFree(ptr); |
| 88 } | |
| 89 | |
| 90 void InlineBox::operator delete(void* ptr, size_t sz) | |
| 91 { | |
| 92 ASSERT(inInlineBoxDetach); | |
| 93 | |
| 94 // Stash size where destroy can find it. | |
| 95 *(size_t *)ptr = sz; | |
| 96 } | 79 } |
| 97 | 80 |
| 98 #ifndef NDEBUG | 81 #ifndef NDEBUG |
| 99 const char* InlineBox::boxName() const | 82 const char* InlineBox::boxName() const |
| 100 { | 83 { |
| 101 return "InlineBox"; | 84 return "InlineBox"; |
| 102 } | 85 } |
| 103 | 86 |
| 104 void InlineBox::showTreeForThis() const | 87 void InlineBox::showTreeForThis() const |
| 105 { | 88 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return m_renderer->caretMaxOffset(); | 159 return m_renderer->caretMaxOffset(); |
| 177 } | 160 } |
| 178 | 161 |
| 179 void InlineBox::dirtyLineBoxes() | 162 void InlineBox::dirtyLineBoxes() |
| 180 { | 163 { |
| 181 markDirty(); | 164 markDirty(); |
| 182 for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr->
parent()) | 165 for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr->
parent()) |
| 183 curr->markDirty(); | 166 curr->markDirty(); |
| 184 } | 167 } |
| 185 | 168 |
| 186 void InlineBox::deleteLine(RenderArena* arena) | 169 void InlineBox::deleteLine() |
| 187 { | 170 { |
| 188 if (!m_bitfields.extracted() && m_renderer->isBox()) | 171 if (!m_bitfields.extracted() && m_renderer->isBox()) |
| 189 toRenderBox(m_renderer)->setInlineBoxWrapper(0); | 172 toRenderBox(m_renderer)->setInlineBoxWrapper(0); |
| 190 destroy(arena); | 173 destroy(); |
| 191 } | 174 } |
| 192 | 175 |
| 193 void InlineBox::extractLine() | 176 void InlineBox::extractLine() |
| 194 { | 177 { |
| 195 m_bitfields.setExtracted(true); | 178 m_bitfields.setExtracted(true); |
| 196 if (m_renderer->isBox()) | 179 if (m_renderer->isBox()) |
| 197 toRenderBox(m_renderer)->setInlineBoxWrapper(0); | 180 toRenderBox(m_renderer)->setInlineBoxWrapper(0); |
| 198 } | 181 } |
| 199 | 182 |
| 200 void InlineBox::attachLine() | 183 void InlineBox::attachLine() |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 b->showTreeForThis(); | 381 b->showTreeForThis(); |
| 399 } | 382 } |
| 400 | 383 |
| 401 void showLineTree(const WebCore::InlineBox* b) | 384 void showLineTree(const WebCore::InlineBox* b) |
| 402 { | 385 { |
| 403 if (b) | 386 if (b) |
| 404 b->showLineTreeForThis(); | 387 b->showLineTreeForThis(); |
| 405 } | 388 } |
| 406 | 389 |
| 407 #endif | 390 #endif |
| OLD | NEW |