OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 bool RenderObject::isLegend() const | 252 bool RenderObject::isLegend() const |
253 { | 253 { |
254 return node() && node()->hasTagName(legendTag); | 254 return node() && node()->hasTagName(legendTag); |
255 } | 255 } |
256 | 256 |
257 bool RenderObject::isHTMLMarquee() const | 257 bool RenderObject::isHTMLMarquee() const |
258 { | 258 { |
259 return node() && node()->renderer() == this && node()->hasTagName(marqueeTag
); | 259 return node() && node()->renderer() == this && node()->hasTagName(marqueeTag
); |
260 } | 260 } |
261 | 261 |
262 static bool isBeforeAfterContentGeneratedByAncestor(RenderObject* renderer, Rend
erObject* beforeAfterContent) | |
263 { | |
264 while (renderer) { | |
265 if (renderer->generatingNode() == beforeAfterContent->generatingNode()) | |
266 return true; | |
267 renderer = renderer->parent(); | |
268 } | |
269 return false; | |
270 } | |
271 | |
272 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) | 262 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) |
273 { | 263 { |
274 RenderObjectChildList* children = virtualChildren(); | 264 RenderObjectChildList* children = virtualChildren(); |
275 ASSERT(children); | 265 ASSERT(children); |
276 if (!children) | 266 if (!children) |
277 return; | 267 return; |
278 | 268 |
279 RenderObject* beforeContent = 0; | |
280 bool beforeChildHasBeforeAndAfterContent = false; | |
281 if (beforeChild && (beforeChild->isTable() || beforeChild->isTableSection()
|| beforeChild->isTableRow() || beforeChild->isTableCell())) { | |
282 beforeContent = beforeChild->beforePseudoElementRenderer(); | |
283 RenderObject* afterContent = beforeChild->afterPseudoElementRenderer(); | |
284 if (beforeContent && afterContent && isBeforeAfterContentGeneratedByAnce
stor(this, beforeContent)) { | |
285 beforeChildHasBeforeAndAfterContent = true; | |
286 beforeContent->destroy(); | |
287 } | |
288 } | |
289 | |
290 bool needsTable = false; | 269 bool needsTable = false; |
291 | 270 |
292 if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_G
ROUP) | 271 if (newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_G
ROUP) |
293 needsTable = !isTable(); | 272 needsTable = !isTable(); |
294 else if (newChild->isTableCaption()) | 273 else if (newChild->isTableCaption()) |
295 needsTable = !isTable(); | 274 needsTable = !isTable(); |
296 else if (newChild->isTableSection()) | 275 else if (newChild->isTableSection()) |
297 needsTable = !isTable(); | 276 needsTable = !isTable(); |
298 else if (newChild->isTableRow()) | 277 else if (newChild->isTableRow()) |
299 needsTable = !isTableSection(); | 278 needsTable = !isTableSection(); |
(...skipping 28 matching lines...) Expand all Loading... |
328 // SVG creates renderers for <g display="none">, as SVG requires children of
hidden | 307 // SVG creates renderers for <g display="none">, as SVG requires children of
hidden |
329 // <g>s to have renderers - at least that's how our implementation works. Co
nsider: | 308 // <g>s to have renderers - at least that's how our implementation works. Co
nsider: |
330 // <g display="none"><foreignObject><body style="position: relative">FOO... | 309 // <g display="none"><foreignObject><body style="position: relative">FOO... |
331 // - requiresLayer() would return true for the <body>, creating a new Render
Layer | 310 // - requiresLayer() would return true for the <body>, creating a new Render
Layer |
332 // - when the document is painted, both layers are painted. The <body> layer
doesn't | 311 // - when the document is painted, both layers are painted. The <body> layer
doesn't |
333 // know that it's inside a "hidden SVG subtree", and thus paints, even if
it shouldn't. | 312 // know that it's inside a "hidden SVG subtree", and thus paints, even if
it shouldn't. |
334 // To avoid the problem alltogether, detect early if we're inside a hidden S
VG subtree | 313 // To avoid the problem alltogether, detect early if we're inside a hidden S
VG subtree |
335 // and stop creating layers at all for these cases - they're not used anyway
s. | 314 // and stop creating layers at all for these cases - they're not used anyway
s. |
336 if (newChild->hasLayer() && !layerCreationAllowedForSubtree()) | 315 if (newChild->hasLayer() && !layerCreationAllowedForSubtree()) |
337 toRenderBoxModelObject(newChild)->layer()->removeOnlyThisLayer(); | 316 toRenderBoxModelObject(newChild)->layer()->removeOnlyThisLayer(); |
338 | |
339 if (beforeChildHasBeforeAndAfterContent) | |
340 children->updateBeforeAfterContent(this, BEFORE); | |
341 } | 317 } |
342 | 318 |
343 void RenderObject::removeChild(RenderObject* oldChild) | 319 void RenderObject::removeChild(RenderObject* oldChild) |
344 { | 320 { |
345 RenderObjectChildList* children = virtualChildren(); | 321 RenderObjectChildList* children = virtualChildren(); |
346 ASSERT(children); | 322 ASSERT(children); |
347 if (!children) | 323 if (!children) |
348 return; | 324 return; |
349 | 325 |
350 // We do this here instead of in removeChildNode, since the only extremely l
ow-level uses of remove/appendChildNode | 326 // We do this here instead of in removeChildNode, since the only extremely l
ow-level uses of remove/appendChildNode |
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 { | 2888 { |
2913 if (object1) { | 2889 if (object1) { |
2914 const WebCore::RenderObject* root = object1; | 2890 const WebCore::RenderObject* root = object1; |
2915 while (root->parent()) | 2891 while (root->parent()) |
2916 root = root->parent(); | 2892 root = root->parent(); |
2917 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 2893 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
2918 } | 2894 } |
2919 } | 2895 } |
2920 | 2896 |
2921 #endif | 2897 #endif |
OLD | NEW |