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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // If any descendant blocks exist then they will be in the next anonymou
s block and its siblings. | 186 // If any descendant blocks exist then they will be in the next anonymou
s block and its siblings. |
187 RenderObject* block = containingBlock()->nextSibling(); | 187 RenderObject* block = containingBlock()->nextSibling(); |
188 ASSERT(block && block->isAnonymousBlock()); | 188 ASSERT(block && block->isAnonymousBlock()); |
189 updateStyleOfAnonymousBlockContinuations(block, newStyle, oldStyle); | 189 updateStyleOfAnonymousBlockContinuations(block, newStyle, oldStyle); |
190 } | 190 } |
191 | 191 |
192 if (!m_alwaysCreateLineBoxes) { | 192 if (!m_alwaysCreateLineBoxes) { |
193 bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations
() || newStyle->hasPadding() || newStyle->hasMargin() || hasOutline(); | 193 bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations
() || newStyle->hasPadding() || newStyle->hasMargin() || hasOutline(); |
194 if (oldStyle && alwaysCreateLineBoxes) { | 194 if (oldStyle && alwaysCreateLineBoxes) { |
195 dirtyLineBoxes(false); | 195 dirtyLineBoxes(false); |
196 setNeedsLayout(); | 196 setNeedsLayoutAndFullRepaint(); |
197 } | 197 } |
198 m_alwaysCreateLineBoxes = alwaysCreateLineBoxes; | 198 m_alwaysCreateLineBoxes = alwaysCreateLineBoxes; |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout) | 202 void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout) |
203 { | 203 { |
204 // Once we have been tainted once, just assume it will happen again. This wa
y effects like hover highlighting that change the | 204 // Once we have been tainted once, just assume it will happen again. This wa
y effects like hover highlighting that change the |
205 // background color will only cause a layout on the first rollover. | 205 // background color will only cause a layout on the first rollover. |
206 if (m_alwaysCreateLineBoxes) | 206 if (m_alwaysCreateLineBoxes) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 newBox->setStyle(newStyle.release()); | 317 newBox->setStyle(newStyle.release()); |
318 RenderBoxModelObject* oldContinuation = continuation(); | 318 RenderBoxModelObject* oldContinuation = continuation(); |
319 setContinuation(newBox); | 319 setContinuation(newBox); |
320 | 320 |
321 splitFlow(beforeChild, newBox, newChild, oldContinuation); | 321 splitFlow(beforeChild, newBox, newChild, oldContinuation); |
322 return; | 322 return; |
323 } | 323 } |
324 | 324 |
325 RenderBoxModelObject::addChild(newChild, beforeChild); | 325 RenderBoxModelObject::addChild(newChild, beforeChild); |
326 | 326 |
327 newChild->setNeedsLayoutAndPrefWidthsRecalc(); | 327 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
328 } | 328 } |
329 | 329 |
330 RenderInline* RenderInline::clone() const | 330 RenderInline* RenderInline::clone() const |
331 { | 331 { |
332 RenderInline* cloneInline = new RenderInline(node()); | 332 RenderInline* cloneInline = new RenderInline(node()); |
333 cloneInline->setStyle(style()); | 333 cloneInline->setStyle(style()); |
334 cloneInline->setFlowThreadState(flowThreadState()); | 334 cloneInline->setFlowThreadState(flowThreadState()); |
335 return cloneInline; | 335 return cloneInline; |
336 } | 336 } |
337 | 337 |
(...skipping 16 matching lines...) Expand all Loading... |
354 beforeChild = fullscreen->fullScreenRenderer(); | 354 beforeChild = fullscreen->fullScreenRenderer(); |
355 } | 355 } |
356 | 356 |
357 // Now take all of the children from beforeChild to the end and remove | 357 // Now take all of the children from beforeChild to the end and remove |
358 // them from |this| and place them in the clone. | 358 // them from |this| and place them in the clone. |
359 RenderObject* o = beforeChild; | 359 RenderObject* o = beforeChild; |
360 while (o) { | 360 while (o) { |
361 RenderObject* tmp = o; | 361 RenderObject* tmp = o; |
362 o = tmp->nextSibling(); | 362 o = tmp->nextSibling(); |
363 cloneInline->addChildIgnoringContinuation(children()->removeChildNode(th
is, tmp), 0); | 363 cloneInline->addChildIgnoringContinuation(children()->removeChildNode(th
is, tmp), 0); |
364 tmp->setNeedsLayoutAndPrefWidthsRecalc(); | 364 tmp->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
365 } | 365 } |
366 | 366 |
367 // Hook |clone| up as the continuation of the middle block. | 367 // Hook |clone| up as the continuation of the middle block. |
368 middleBlock->setContinuation(cloneInline); | 368 middleBlock->setContinuation(cloneInline); |
369 | 369 |
370 // We have been reparented and are now under the fromBlock. We need | 370 // We have been reparented and are now under the fromBlock. We need |
371 // to walk up our inline parent chain until we hit the containing block. | 371 // to walk up our inline parent chain until we hit the containing block. |
372 // Once we hit the containing block we're done. | 372 // Once we hit the containing block we're done. |
373 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); | 373 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); |
374 RenderBoxModelObject* currChild = this; | 374 RenderBoxModelObject* currChild = this; |
(...skipping 20 matching lines...) Expand all Loading... |
395 inlineCurr->setContinuation(cloneInline); | 395 inlineCurr->setContinuation(cloneInline); |
396 cloneInline->setContinuation(oldCont); | 396 cloneInline->setContinuation(oldCont); |
397 | 397 |
398 // Now we need to take all of the children starting from the first c
hild | 398 // Now we need to take all of the children starting from the first c
hild |
399 // *after* currChild and append them all to the clone. | 399 // *after* currChild and append them all to the clone. |
400 o = currChild->nextSibling(); | 400 o = currChild->nextSibling(); |
401 while (o) { | 401 while (o) { |
402 RenderObject* tmp = o; | 402 RenderObject* tmp = o; |
403 o = tmp->nextSibling(); | 403 o = tmp->nextSibling(); |
404 cloneInline->addChildIgnoringContinuation(inlineCurr->children()
->removeChildNode(curr, tmp), 0); | 404 cloneInline->addChildIgnoringContinuation(inlineCurr->children()
->removeChildNode(curr, tmp), 0); |
405 tmp->setNeedsLayoutAndPrefWidthsRecalc(); | 405 tmp->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 // Keep walking up the chain. | 409 // Keep walking up the chain. |
410 currChild = curr; | 410 currChild = curr; |
411 curr = toRenderBoxModelObject(curr->parent()); | 411 curr = toRenderBoxModelObject(curr->parent()); |
412 splitDepth++; | 412 splitDepth++; |
413 } | 413 } |
414 | 414 |
415 // Now we are at the block level. We need to put the clone into the toBlock. | 415 // Now we are at the block level. We need to put the clone into the toBlock. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 block->children()->insertChildNode(block, newBlockBox, boxFirst); | 456 block->children()->insertChildNode(block, newBlockBox, boxFirst); |
457 block->children()->insertChildNode(block, post, boxFirst); | 457 block->children()->insertChildNode(block, post, boxFirst); |
458 block->setChildrenInline(false); | 458 block->setChildrenInline(false); |
459 | 459 |
460 if (madeNewBeforeBlock) { | 460 if (madeNewBeforeBlock) { |
461 RenderObject* o = boxFirst; | 461 RenderObject* o = boxFirst; |
462 while (o) { | 462 while (o) { |
463 RenderObject* no = o; | 463 RenderObject* no = o; |
464 o = no->nextSibling(); | 464 o = no->nextSibling(); |
465 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); | 465 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); |
466 no->setNeedsLayoutAndPrefWidthsRecalc(); | 466 no->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); | 470 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); |
471 | 471 |
472 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 472 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
473 // time in makeChildrenNonInline by just setting this explicitly up front. | 473 // time in makeChildrenNonInline by just setting this explicitly up front. |
474 newBlockBox->setChildrenInline(false); | 474 newBlockBox->setChildrenInline(false); |
475 | 475 |
476 newBlockBox->addChild(newChild); | 476 newBlockBox->addChild(newChild); |
477 | 477 |
478 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 478 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
479 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 479 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
480 // make new line boxes instead of leaving the old line boxes around. | 480 // make new line boxes instead of leaving the old line boxes around. |
481 pre->setNeedsLayoutAndPrefWidthsRecalc(); | 481 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
482 block->setNeedsLayoutAndPrefWidthsRecalc(); | 482 block->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
483 post->setNeedsLayoutAndPrefWidthsRecalc(); | 483 post->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
484 } | 484 } |
485 | 485 |
486 void RenderInline::addChildToContinuation(RenderObject* newChild, RenderObject*
beforeChild) | 486 void RenderInline::addChildToContinuation(RenderObject* newChild, RenderObject*
beforeChild) |
487 { | 487 { |
488 RenderBoxModelObject* flow = continuationBefore(beforeChild); | 488 RenderBoxModelObject* flow = continuationBefore(beforeChild); |
489 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); | 489 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); |
490 RenderBoxModelObject* beforeChildParent = 0; | 490 RenderBoxModelObject* beforeChildParent = 0; |
491 if (beforeChild) | 491 if (beforeChild) |
492 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); | 492 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); |
493 else { | 493 else { |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 container = this; | 1573 container = this; |
1574 | 1574 |
1575 FloatPoint absPos = container->localToAbsolute(); | 1575 FloatPoint absPos = container->localToAbsolute(); |
1576 region.bounds.setX(absPos.x() + region.bounds.x()); | 1576 region.bounds.setX(absPos.x() + region.bounds.x()); |
1577 region.bounds.setY(absPos.y() + region.bounds.y()); | 1577 region.bounds.setY(absPos.y() + region.bounds.y()); |
1578 | 1578 |
1579 regions.append(region); | 1579 regions.append(region); |
1580 } | 1580 } |
1581 | 1581 |
1582 } // namespace WebCore | 1582 } // namespace WebCore |
OLD | NEW |