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 30 matching lines...) Expand all Loading... |
41 #include "core/rendering/RenderView.h" | 41 #include "core/rendering/RenderView.h" |
42 #include "core/rendering/style/StyleInheritedData.h" | 42 #include "core/rendering/style/StyleInheritedData.h" |
43 #include "platform/geometry/FloatQuad.h" | 43 #include "platform/geometry/FloatQuad.h" |
44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
45 #include "platform/graphics/paint/DisplayItemList.h" | 45 #include "platform/graphics/paint/DisplayItemList.h" |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 struct SameSizeAsRenderInline : public RenderBoxModelObject { | 49 struct SameSizeAsRenderInline : public RenderBoxModelObject { |
50 virtual ~SameSizeAsRenderInline() { } | 50 virtual ~SameSizeAsRenderInline() { } |
51 RenderObjectChildList m_children; | 51 LayoutObjectChildList m_children; |
52 RenderLineBoxList m_lineBoxes; | 52 RenderLineBoxList m_lineBoxes; |
53 }; | 53 }; |
54 | 54 |
55 static_assert(sizeof(RenderInline) == sizeof(SameSizeAsRenderInline), "RenderInl
ine should stay small"); | 55 static_assert(sizeof(RenderInline) == sizeof(SameSizeAsRenderInline), "RenderInl
ine should stay small"); |
56 | 56 |
57 RenderInline::RenderInline(Element* element) | 57 RenderInline::RenderInline(Element* element) |
58 : RenderBoxModelObject(element) | 58 : RenderBoxModelObject(element) |
59 { | 59 { |
60 setChildrenInline(true); | 60 setChildrenInline(true); |
61 } | 61 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 RenderBoxModelObject::updateFromStyle(); | 135 RenderBoxModelObject::updateFromStyle(); |
136 | 136 |
137 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons
idered a block display type. | 137 // FIXME: Is this still needed. Was needed for run-ins, since run-in is cons
idered a block display type. |
138 setInline(true); | 138 setInline(true); |
139 | 139 |
140 // FIXME: Support transforms and reflections on inline flows someday. | 140 // FIXME: Support transforms and reflections on inline flows someday. |
141 setHasTransformRelatedProperty(false); | 141 setHasTransformRelatedProperty(false); |
142 setHasReflection(false); | 142 setHasReflection(false); |
143 } | 143 } |
144 | 144 |
145 static RenderObject* inFlowPositionedInlineAncestor(RenderObject* p) | 145 static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p) |
146 { | 146 { |
147 while (p && p->isRenderInline()) { | 147 while (p && p->isRenderInline()) { |
148 if (p->isRelPositioned()) | 148 if (p->isRelPositioned()) |
149 return p; | 149 return p; |
150 p = p->parent(); | 150 p = p->parent(); |
151 } | 151 } |
152 return 0; | 152 return 0; |
153 } | 153 } |
154 | 154 |
155 static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const
RenderStyle* newStyle, const RenderStyle* oldStyle) | 155 static void updateStyleOfAnonymousBlockContinuations(LayoutObject* block, const
RenderStyle* newStyle, const RenderStyle* oldStyle) |
156 { | 156 { |
157 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { | 157 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) { |
158 if (!toRenderBlock(block)->isAnonymousBlockContinuation()) | 158 if (!toRenderBlock(block)->isAnonymousBlockContinuation()) |
159 continue; | 159 continue; |
160 | 160 |
161 RefPtr<RenderStyle> newBlockStyle; | 161 RefPtr<RenderStyle> newBlockStyle; |
162 | 162 |
163 if (!block->style()->isOutlineEquivalent(newStyle)) { | 163 if (!block->style()->isOutlineEquivalent(newStyle)) { |
164 newBlockStyle = RenderStyle::clone(block->style()); | 164 newBlockStyle = RenderStyle::clone(block->style()); |
165 newBlockStyle->setOutlineFromStyle(*newStyle); | 165 newBlockStyle->setOutlineFromStyle(*newStyle); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 currCont->setStyle(newStyle); | 199 currCont->setStyle(newStyle); |
200 currCont->setContinuation(nextCont); | 200 currCont->setContinuation(nextCont); |
201 } | 201 } |
202 | 202 |
203 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. | 203 // If an inline's outline or in-flow positioning has changed then any descen
dant blocks will need to change their styles accordingly. |
204 // Do this by updating the styles of the descendant blocks' containing anony
mous blocks - there may be more than one. | 204 // Do this by updating the styles of the descendant blocks' containing anony
mous blocks - there may be more than one. |
205 if (continuation && oldStyle | 205 if (continuation && oldStyle |
206 && (!newStyle->isOutlineEquivalent(oldStyle) | 206 && (!newStyle->isOutlineEquivalent(oldStyle) |
207 || (newStyle->position() != oldStyle->position() && (newStyle->hasIn
FlowPosition() || oldStyle->hasInFlowPosition())))) { | 207 || (newStyle->position() != oldStyle->position() && (newStyle->hasIn
FlowPosition() || oldStyle->hasInFlowPosition())))) { |
208 // If any descendant blocks exist then they will be in the next anonymou
s block and its siblings. | 208 // If any descendant blocks exist then they will be in the next anonymou
s block and its siblings. |
209 RenderObject* block = containingBlock()->nextSibling(); | 209 LayoutObject* block = containingBlock()->nextSibling(); |
210 if (block && block->isAnonymousBlock()) | 210 if (block && block->isAnonymousBlock()) |
211 updateStyleOfAnonymousBlockContinuations(block, newStyle, oldStyle); | 211 updateStyleOfAnonymousBlockContinuations(block, newStyle, oldStyle); |
212 } | 212 } |
213 | 213 |
214 if (!alwaysCreateLineBoxes()) { | 214 if (!alwaysCreateLineBoxes()) { |
215 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati
onBackground() || newStyle->hasPadding() || newStyle->hasMargin() || newStyle->h
asOutline(); | 215 bool alwaysCreateLineBoxesNew = hasSelfPaintingLayer() || hasBoxDecorati
onBackground() || newStyle->hasPadding() || newStyle->hasMargin() || newStyle->h
asOutline(); |
216 if (oldStyle && alwaysCreateLineBoxesNew) { | 216 if (oldStyle && alwaysCreateLineBoxesNew) { |
217 dirtyLineBoxes(false); | 217 dirtyLineBoxes(false); |
218 setNeedsLayoutAndFullPaintInvalidation(); | 218 setNeedsLayoutAndFullPaintInvalidation(); |
219 } | 219 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 if (InlineBox* firstBox = firstLineBox()) { | 275 if (InlineBox* firstBox = firstLineBox()) { |
276 // FIXME: the call to roundedLayoutPoint() below is temporary and should
be removed once | 276 // FIXME: the call to roundedLayoutPoint() below is temporary and should
be removed once |
277 // the transition to LayoutUnit-based types is complete (crbug.com/32123
7) | 277 // the transition to LayoutUnit-based types is complete (crbug.com/32123
7) |
278 caretRect.moveBy(firstBox->topLeft().roundedLayoutPoint()); | 278 caretRect.moveBy(firstBox->topLeft().roundedLayoutPoint()); |
279 } | 279 } |
280 | 280 |
281 return caretRect; | 281 return caretRect; |
282 } | 282 } |
283 | 283 |
284 void RenderInline::addChild(RenderObject* newChild, RenderObject* beforeChild) | 284 void RenderInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
285 { | 285 { |
286 if (continuation()) | 286 if (continuation()) |
287 return addChildToContinuation(newChild, beforeChild); | 287 return addChildToContinuation(newChild, beforeChild); |
288 return addChildIgnoringContinuation(newChild, beforeChild); | 288 return addChildIgnoringContinuation(newChild, beforeChild); |
289 } | 289 } |
290 | 290 |
291 static RenderBoxModelObject* nextContinuation(RenderObject* renderer) | 291 static RenderBoxModelObject* nextContinuation(LayoutObject* renderer) |
292 { | 292 { |
293 if (renderer->isInline() && !renderer->isReplaced()) | 293 if (renderer->isInline() && !renderer->isReplaced()) |
294 return toRenderInline(renderer)->continuation(); | 294 return toRenderInline(renderer)->continuation(); |
295 return toRenderBlock(renderer)->inlineElementContinuation(); | 295 return toRenderBlock(renderer)->inlineElementContinuation(); |
296 } | 296 } |
297 | 297 |
298 RenderBoxModelObject* RenderInline::continuationBefore(RenderObject* beforeChild
) | 298 RenderBoxModelObject* RenderInline::continuationBefore(LayoutObject* beforeChild
) |
299 { | 299 { |
300 if (beforeChild && beforeChild->parent() == this) | 300 if (beforeChild && beforeChild->parent() == this) |
301 return this; | 301 return this; |
302 | 302 |
303 RenderBoxModelObject* curr = nextContinuation(this); | 303 RenderBoxModelObject* curr = nextContinuation(this); |
304 RenderBoxModelObject* nextToLast = this; | 304 RenderBoxModelObject* nextToLast = this; |
305 RenderBoxModelObject* last = this; | 305 RenderBoxModelObject* last = this; |
306 while (curr) { | 306 while (curr) { |
307 if (beforeChild && beforeChild->parent() == curr) { | 307 if (beforeChild && beforeChild->parent() == curr) { |
308 if (curr->slowFirstChild() == beforeChild) | 308 if (curr->slowFirstChild() == beforeChild) |
309 return last; | 309 return last; |
310 return curr; | 310 return curr; |
311 } | 311 } |
312 | 312 |
313 nextToLast = last; | 313 nextToLast = last; |
314 last = curr; | 314 last = curr; |
315 curr = nextContinuation(curr); | 315 curr = nextContinuation(curr); |
316 } | 316 } |
317 | 317 |
318 if (!beforeChild && !last->slowFirstChild()) | 318 if (!beforeChild && !last->slowFirstChild()) |
319 return nextToLast; | 319 return nextToLast; |
320 return last; | 320 return last; |
321 } | 321 } |
322 | 322 |
323 void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb
ject* beforeChild) | 323 void RenderInline::addChildIgnoringContinuation(LayoutObject* newChild, LayoutOb
ject* beforeChild) |
324 { | 324 { |
325 // Make sure we don't append things after :after-generated content if we hav
e it. | 325 // Make sure we don't append things after :after-generated content if we hav
e it. |
326 if (!beforeChild && isAfterContent(lastChild())) | 326 if (!beforeChild && isAfterContent(lastChild())) |
327 beforeChild = lastChild(); | 327 beforeChild = lastChild(); |
328 | 328 |
329 if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { | 329 if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { |
330 // We are placing a block inside an inline. We have to perform a split o
f this | 330 // We are placing a block inside an inline. We have to perform a split o
f this |
331 // inline into continuations. This involves creating an anonymous block
box to hold | 331 // inline into continuations. This involves creating an anonymous block
box to hold |
332 // |newChild|. We then make that block box a continuation of this inlin
e. We take all of | 332 // |newChild|. We then make that block box a continuation of this inlin
e. We take all of |
333 // the children after |beforeChild| and put them in a clone of this obje
ct. | 333 // the children after |beforeChild| and put them in a clone of this obje
ct. |
334 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp
lay(style(), BLOCK); | 334 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisp
lay(style(), BLOCK); |
335 | 335 |
336 // If inside an inline affected by in-flow positioning the block needs t
o be affected by it too. | 336 // If inside an inline affected by in-flow positioning the block needs t
o be affected by it too. |
337 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. | 337 // Giving the block a layer like this allows it to collect the x/y offse
ts from inline parents later. |
338 if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) | 338 if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(th
is)) |
339 newStyle->setPosition(positionedAncestor->style()->position()); | 339 newStyle->setPosition(positionedAncestor->style()->position()); |
340 | 340 |
341 // Push outline style to the block continuation. | 341 // Push outline style to the block continuation. |
342 if (!newStyle->isOutlineEquivalent(style())) | 342 if (!newStyle->isOutlineEquivalent(style())) |
343 newStyle->setOutlineFromStyle(*style()); | 343 newStyle->setOutlineFromStyle(*style()); |
344 | 344 |
345 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&document()); | 345 RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&document()); |
346 newBox->setStyle(newStyle.release()); | 346 newBox->setStyle(newStyle.release()); |
347 RenderBoxModelObject* oldContinuation = continuation(); | 347 RenderBoxModelObject* oldContinuation = continuation(); |
348 setContinuation(newBox); | 348 setContinuation(newBox); |
349 | 349 |
350 splitFlow(beforeChild, newBox, newChild, oldContinuation); | 350 splitFlow(beforeChild, newBox, newChild, oldContinuation); |
351 return; | 351 return; |
352 } | 352 } |
353 | 353 |
354 RenderBoxModelObject::addChild(newChild, beforeChild); | 354 RenderBoxModelObject::addChild(newChild, beforeChild); |
355 | 355 |
356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 356 newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
357 } | 357 } |
358 | 358 |
359 RenderInline* RenderInline::clone() const | 359 RenderInline* RenderInline::clone() const |
360 { | 360 { |
361 RenderInline* cloneInline = new RenderInline(node()); | 361 RenderInline* cloneInline = new RenderInline(node()); |
362 cloneInline->setStyle(style()); | 362 cloneInline->setStyle(style()); |
363 cloneInline->setFlowThreadState(flowThreadState()); | 363 cloneInline->setFlowThreadState(flowThreadState()); |
364 return cloneInline; | 364 return cloneInline; |
365 } | 365 } |
366 | 366 |
367 void RenderInline::moveChildrenToIgnoringContinuation(RenderInline* to, RenderOb
ject* startChild) | 367 void RenderInline::moveChildrenToIgnoringContinuation(RenderInline* to, LayoutOb
ject* startChild) |
368 { | 368 { |
369 RenderObject* child = startChild; | 369 LayoutObject* child = startChild; |
370 while (child) { | 370 while (child) { |
371 RenderObject* currentChild = child; | 371 LayoutObject* currentChild = child; |
372 child = currentChild->nextSibling(); | 372 child = currentChild->nextSibling(); |
373 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); | 373 to->addChildIgnoringContinuation(children()->removeChildNode(this, curre
ntChild), nullptr); |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, | 377 void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, |
378 RenderBlock* middleBlock, | 378 RenderBlock* middleBlock, |
379 RenderObject* beforeChild, RenderBoxModelObject*
oldCont) | 379 LayoutObject* beforeChild, RenderBoxModelObject*
oldCont) |
380 { | 380 { |
381 ASSERT(isDescendantOf(fromBlock)); | 381 ASSERT(isDescendantOf(fromBlock)); |
382 | 382 |
383 // If we're splitting the inline containing the fullscreened element, | 383 // If we're splitting the inline containing the fullscreened element, |
384 // |beforeChild| may be the renderer for the fullscreened element. However, | 384 // |beforeChild| may be the renderer for the fullscreened element. However, |
385 // that renderer is wrapped in a RenderFullScreen, so |this| is not its | 385 // that renderer is wrapped in a RenderFullScreen, so |this| is not its |
386 // parent. Since the splitting logic expects |this| to be the parent, set | 386 // parent. Since the splitting logic expects |this| to be the parent, set |
387 // |beforeChild| to be the RenderFullScreen. | 387 // |beforeChild| to be the RenderFullScreen. |
388 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { | 388 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) { |
389 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); | 389 const Element* fullScreenElement = fullscreen->webkitCurrentFullScreenEl
ement(); |
390 if (fullScreenElement && beforeChild && beforeChild->node() == fullScree
nElement) | 390 if (fullScreenElement && beforeChild && beforeChild->node() == fullScree
nElement) |
391 beforeChild = fullscreen->fullScreenRenderer(); | 391 beforeChild = fullscreen->fullScreenRenderer(); |
392 } | 392 } |
393 | 393 |
394 // FIXME: Because splitting is O(n^2) as tags nest pathologically, we cap th
e depth at which we're willing to clone. | 394 // FIXME: Because splitting is O(n^2) as tags nest pathologically, we cap th
e depth at which we're willing to clone. |
395 // There will eventually be a better approach to this problem that will let
us nest to a much | 395 // There will eventually be a better approach to this problem that will let
us nest to a much |
396 // greater depth (see bugzilla bug 13430) but for now we have a limit. This
*will* result in | 396 // greater depth (see bugzilla bug 13430) but for now we have a limit. This
*will* result in |
397 // incorrect rendering, but the alternative is to hang forever. | 397 // incorrect rendering, but the alternative is to hang forever. |
398 const unsigned cMaxSplitDepth = 200; | 398 const unsigned cMaxSplitDepth = 200; |
399 Vector<RenderInline*> inlinesToClone; | 399 Vector<RenderInline*> inlinesToClone; |
400 RenderInline* topMostInline = this; | 400 RenderInline* topMostInline = this; |
401 for (RenderObject* o = this; o != fromBlock; o = o->parent()) { | 401 for (LayoutObject* o = this; o != fromBlock; o = o->parent()) { |
402 topMostInline = toRenderInline(o); | 402 topMostInline = toRenderInline(o); |
403 if (inlinesToClone.size() < cMaxSplitDepth) | 403 if (inlinesToClone.size() < cMaxSplitDepth) |
404 inlinesToClone.append(topMostInline); | 404 inlinesToClone.append(topMostInline); |
405 // Keep walking up the chain to ensure |topMostInline| is a child of |fr
omBlock|, | 405 // Keep walking up the chain to ensure |topMostInline| is a child of |fr
omBlock|, |
406 // to avoid assertion failure when |fromBlock|'s children are moved to |
toBlock| below. | 406 // to avoid assertion failure when |fromBlock|'s children are moved to |
toBlock| below. |
407 } | 407 } |
408 | 408 |
409 // Create a new clone of the top-most inline in |inlinesToClone|. | 409 // Create a new clone of the top-most inline in |inlinesToClone|. |
410 RenderInline* topMostInlineToClone = inlinesToClone.last(); | 410 RenderInline* topMostInlineToClone = inlinesToClone.last(); |
411 RenderInline* cloneInline = topMostInlineToClone->clone(); | 411 RenderInline* cloneInline = topMostInlineToClone->clone(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 // Hook |cloneInline| up as the continuation of the middle block. | 450 // Hook |cloneInline| up as the continuation of the middle block. |
451 cloneInline->setContinuation(oldCont); | 451 cloneInline->setContinuation(oldCont); |
452 middleBlock->setContinuation(cloneInline); | 452 middleBlock->setContinuation(cloneInline); |
453 | 453 |
454 // Now take all of the children from |beforeChild| to the end and remove | 454 // Now take all of the children from |beforeChild| to the end and remove |
455 // them from |this| and place them in the clone. | 455 // them from |this| and place them in the clone. |
456 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); | 456 moveChildrenToIgnoringContinuation(cloneInline, beforeChild); |
457 } | 457 } |
458 | 458 |
459 void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox
, | 459 void RenderInline::splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox
, |
460 RenderObject* newChild, RenderBoxModelObject* oldCo
nt) | 460 LayoutObject* newChild, RenderBoxModelObject* oldCont) |
461 { | 461 { |
462 RenderBlock* pre = 0; | 462 RenderBlock* pre = 0; |
463 RenderBlock* block = containingBlock(); | 463 RenderBlock* block = containingBlock(); |
464 | 464 |
465 // Delete our line boxes before we do the inline split into continuations. | 465 // Delete our line boxes before we do the inline split into continuations. |
466 block->deleteLineBoxTree(); | 466 block->deleteLineBoxTree(); |
467 | 467 |
468 bool madeNewBeforeBlock = false; | 468 bool madeNewBeforeBlock = false; |
469 if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->crea
tesAnonymousWrapper())) { | 469 if (block->isAnonymousBlock() && (!block->parent() || !block->parent()->crea
tesAnonymousWrapper())) { |
470 // We can reuse this block and make it the preBlock of the next continua
tion. | 470 // We can reuse this block and make it the preBlock of the next continua
tion. |
471 pre = block; | 471 pre = block; |
472 pre->removePositionedObjects(0); | 472 pre->removePositionedObjects(0); |
473 if (pre->isRenderBlockFlow()) | 473 if (pre->isRenderBlockFlow()) |
474 toRenderBlockFlow(pre)->removeFloatingObjects(); | 474 toRenderBlockFlow(pre)->removeFloatingObjects(); |
475 block = block->containingBlock(); | 475 block = block->containingBlock(); |
476 } else { | 476 } else { |
477 // No anonymous block available for use. Make one. | 477 // No anonymous block available for use. Make one. |
478 pre = block->createAnonymousBlock(); | 478 pre = block->createAnonymousBlock(); |
479 madeNewBeforeBlock = true; | 479 madeNewBeforeBlock = true; |
480 } | 480 } |
481 | 481 |
482 RenderBlock* post = toRenderBlock(pre->createAnonymousBoxWithSameTypeAs(bloc
k)); | 482 RenderBlock* post = toRenderBlock(pre->createAnonymousBoxWithSameTypeAs(bloc
k)); |
483 | 483 |
484 RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nex
tSibling(); | 484 LayoutObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nex
tSibling(); |
485 if (madeNewBeforeBlock) | 485 if (madeNewBeforeBlock) |
486 block->children()->insertChildNode(block, pre, boxFirst); | 486 block->children()->insertChildNode(block, pre, boxFirst); |
487 block->children()->insertChildNode(block, newBlockBox, boxFirst); | 487 block->children()->insertChildNode(block, newBlockBox, boxFirst); |
488 block->children()->insertChildNode(block, post, boxFirst); | 488 block->children()->insertChildNode(block, post, boxFirst); |
489 block->setChildrenInline(false); | 489 block->setChildrenInline(false); |
490 | 490 |
491 if (madeNewBeforeBlock) { | 491 if (madeNewBeforeBlock) { |
492 RenderObject* o = boxFirst; | 492 LayoutObject* o = boxFirst; |
493 while (o) { | 493 while (o) { |
494 RenderObject* no = o; | 494 LayoutObject* no = o; |
495 o = no->nextSibling(); | 495 o = no->nextSibling(); |
496 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); | 496 pre->children()->appendChildNode(pre, block->children()->removeChild
Node(block, no)); |
497 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 497 no->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
501 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); | 501 splitInlines(pre, post, newBlockBox, beforeChild, oldCont); |
502 | 502 |
503 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting | 503 // We already know the newBlockBox isn't going to contain inline kids, so av
oid wasting |
504 // time in makeChildrenNonInline by just setting this explicitly up front. | 504 // time in makeChildrenNonInline by just setting this explicitly up front. |
505 newBlockBox->setChildrenInline(false); | 505 newBlockBox->setChildrenInline(false); |
506 | 506 |
507 newBlockBox->addChild(newChild); | 507 newBlockBox->addChild(newChild); |
508 | 508 |
509 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) | 509 // Always just do a full layout in order to ensure that line boxes (especial
ly wrappers for images) |
510 // get deleted properly. Because objects moves from the pre block into the
post block, we want to | 510 // get deleted properly. Because objects moves from the pre block into the
post block, we want to |
511 // make new line boxes instead of leaving the old line boxes around. | 511 // make new line boxes instead of leaving the old line boxes around. |
512 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 512 pre->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
513 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 513 block->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
514 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 514 post->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
515 } | 515 } |
516 | 516 |
517 void RenderInline::addChildToContinuation(RenderObject* newChild, RenderObject*
beforeChild) | 517 void RenderInline::addChildToContinuation(LayoutObject* newChild, LayoutObject*
beforeChild) |
518 { | 518 { |
519 RenderBoxModelObject* flow = continuationBefore(beforeChild); | 519 RenderBoxModelObject* flow = continuationBefore(beforeChild); |
520 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); | 520 ASSERT(!beforeChild || beforeChild->parent()->isRenderBlock() || beforeChild
->parent()->isRenderInline()); |
521 RenderBoxModelObject* beforeChildParent = 0; | 521 RenderBoxModelObject* beforeChildParent = 0; |
522 if (beforeChild) | 522 if (beforeChild) |
523 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); | 523 beforeChildParent = toRenderBoxModelObject(beforeChild->parent()); |
524 else { | 524 else { |
525 RenderBoxModelObject* cont = nextContinuation(flow); | 525 RenderBoxModelObject* cont = nextContinuation(flow); |
526 if (cont) | 526 if (cont) |
527 beforeChildParent = cont; | 527 beforeChildParent = cont; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 template<typename GeneratorContext> | 571 template<typename GeneratorContext> |
572 void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren
derInline* container) const | 572 void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const Ren
derInline* container) const |
573 { | 573 { |
574 if (!culledInlineFirstLineBox()) { | 574 if (!culledInlineFirstLineBox()) { |
575 yield(FloatRect()); | 575 yield(FloatRect()); |
576 return; | 576 return; |
577 } | 577 } |
578 | 578 |
579 bool isHorizontal = style()->isHorizontalWritingMode(); | 579 bool isHorizontal = style()->isHorizontalWritingMode(); |
580 | 580 |
581 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 581 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
582 if (curr->isFloatingOrOutOfFlowPositioned()) | 582 if (curr->isFloatingOrOutOfFlowPositioned()) |
583 continue; | 583 continue; |
584 | 584 |
585 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block | 585 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block |
586 // direction (aligned to the root box's baseline). | 586 // direction (aligned to the root box's baseline). |
587 if (curr->isBox()) { | 587 if (curr->isBox()) { |
588 RenderBox* currBox = toRenderBox(curr); | 588 RenderBox* currBox = toRenderBox(curr); |
589 if (currBox->inlineBoxWrapper()) { | 589 if (currBox->inlineBoxWrapper()) { |
590 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root(); | 590 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root(); |
591 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl
e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(
rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); | 591 int logicalTop = rootBox.logicalTop() + (rootBox.renderer().styl
e(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(
rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLi
neBox()->logicalBottom() - x; | 903 float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLi
neBox()->logicalBottom() - x; |
904 float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logic
alRightSide - logicalLeftSide; | 904 float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logic
alRightSide - logicalLeftSide; |
905 result = enclosingIntRect(FloatRect(x, y, width, height)); | 905 result = enclosingIntRect(FloatRect(x, y, width, height)); |
906 } | 906 } |
907 | 907 |
908 return result; | 908 return result; |
909 } | 909 } |
910 | 910 |
911 InlineBox* RenderInline::culledInlineFirstLineBox() const | 911 InlineBox* RenderInline::culledInlineFirstLineBox() const |
912 { | 912 { |
913 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 913 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
914 if (curr->isFloatingOrOutOfFlowPositioned()) | 914 if (curr->isFloatingOrOutOfFlowPositioned()) |
915 continue; | 915 continue; |
916 | 916 |
917 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block | 917 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block |
918 // direction (aligned to the root box's baseline). | 918 // direction (aligned to the root box's baseline). |
919 if (curr->isBox()) | 919 if (curr->isBox()) |
920 return toRenderBox(curr)->inlineBoxWrapper(); | 920 return toRenderBox(curr)->inlineBoxWrapper(); |
921 if (curr->isRenderInline()) { | 921 if (curr->isRenderInline()) { |
922 RenderInline* currInline = toRenderInline(curr); | 922 RenderInline* currInline = toRenderInline(curr); |
923 InlineBox* result = currInline->firstLineBoxIncludingCulling(); | 923 InlineBox* result = currInline->firstLineBoxIncludingCulling(); |
924 if (result) | 924 if (result) |
925 return result; | 925 return result; |
926 } else if (curr->isText()) { | 926 } else if (curr->isText()) { |
927 RenderText* currText = toRenderText(curr); | 927 RenderText* currText = toRenderText(curr); |
928 if (currText->firstTextBox()) | 928 if (currText->firstTextBox()) |
929 return currText->firstTextBox(); | 929 return currText->firstTextBox(); |
930 } | 930 } |
931 } | 931 } |
932 return 0; | 932 return 0; |
933 } | 933 } |
934 | 934 |
935 InlineBox* RenderInline::culledInlineLastLineBox() const | 935 InlineBox* RenderInline::culledInlineLastLineBox() const |
936 { | 936 { |
937 for (RenderObject* curr = lastChild(); curr; curr = curr->previousSibling())
{ | 937 for (LayoutObject* curr = lastChild(); curr; curr = curr->previousSibling())
{ |
938 if (curr->isFloatingOrOutOfFlowPositioned()) | 938 if (curr->isFloatingOrOutOfFlowPositioned()) |
939 continue; | 939 continue; |
940 | 940 |
941 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block | 941 // We want to get the margin box in the inline direction, and then use o
ur font ascent/descent in the block |
942 // direction (aligned to the root box's baseline). | 942 // direction (aligned to the root box's baseline). |
943 if (curr->isBox()) | 943 if (curr->isBox()) |
944 return toRenderBox(curr)->inlineBoxWrapper(); | 944 return toRenderBox(curr)->inlineBoxWrapper(); |
945 if (curr->isRenderInline()) { | 945 if (curr->isRenderInline()) { |
946 RenderInline* currInline = toRenderInline(curr); | 946 RenderInline* currInline = toRenderInline(curr); |
947 InlineBox* result = currInline->lastLineBoxIncludingCulling(); | 947 InlineBox* result = currInline->lastLineBoxIncludingCulling(); |
948 if (result) | 948 if (result) |
949 return result; | 949 return result; |
950 } else if (curr->isText()) { | 950 } else if (curr->isText()) { |
951 RenderText* currText = toRenderText(curr); | 951 RenderText* currText = toRenderText(curr); |
952 if (currText->lastTextBox()) | 952 if (currText->lastTextBox()) |
953 return currText->lastTextBox(); | 953 return currText->lastTextBox(); |
954 } | 954 } |
955 } | 955 } |
956 return 0; | 956 return 0; |
957 } | 957 } |
958 | 958 |
959 LayoutRect RenderInline::culledInlineVisualOverflowBoundingBox() const | 959 LayoutRect RenderInline::culledInlineVisualOverflowBoundingBox() const |
960 { | 960 { |
961 FloatRect floatResult; | 961 FloatRect floatResult; |
962 LinesBoundingBoxGeneratorContext context(floatResult); | 962 LinesBoundingBoxGeneratorContext context(floatResult); |
963 generateCulledLineBoxRects(context, this); | 963 generateCulledLineBoxRects(context, this); |
964 LayoutRect result(enclosingLayoutRect(floatResult)); | 964 LayoutRect result(enclosingLayoutRect(floatResult)); |
965 bool isHorizontal = style()->isHorizontalWritingMode(); | 965 bool isHorizontal = style()->isHorizontalWritingMode(); |
966 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 966 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
967 if (curr->isFloatingOrOutOfFlowPositioned()) | 967 if (curr->isFloatingOrOutOfFlowPositioned()) |
968 continue; | 968 continue; |
969 | 969 |
970 // For overflow we just have to propagate by hand and recompute it all. | 970 // For overflow we just have to propagate by hand and recompute it all. |
971 if (curr->isBox()) { | 971 if (curr->isBox()) { |
972 RenderBox* currBox = toRenderBox(curr); | 972 RenderBox* currBox = toRenderBox(curr); |
973 if (!currBox->hasSelfPaintingLayer() && currBox->inlineBoxWrapper())
{ | 973 if (!currBox->hasSelfPaintingLayer() && currBox->inlineBoxWrapper())
{ |
974 LayoutRect logicalRect = currBox->logicalVisualOverflowRectForPr
opagation(style()); | 974 LayoutRect logicalRect = currBox->logicalVisualOverflowRectForPr
opagation(style()); |
975 if (isHorizontal) { | 975 if (isHorizontal) { |
976 logicalRect.moveBy(currBox->location()); | 976 logicalRect.moveBy(currBox->location()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 return clippedOverflowRect(view()); | 1032 return clippedOverflowRect(view()); |
1033 | 1033 |
1034 FloatRect floatResult; | 1034 FloatRect floatResult; |
1035 LinesBoundingBoxGeneratorContext context(floatResult); | 1035 LinesBoundingBoxGeneratorContext context(floatResult); |
1036 | 1036 |
1037 RenderInline* endContinuation = inlineElementContinuation(); | 1037 RenderInline* endContinuation = inlineElementContinuation(); |
1038 while (endContinuation->inlineElementContinuation()) | 1038 while (endContinuation->inlineElementContinuation()) |
1039 endContinuation = endContinuation->inlineElementContinuation(); | 1039 endContinuation = endContinuation->inlineElementContinuation(); |
1040 | 1040 |
1041 for (RenderBlock* currBlock = containingBlock(); currBlock && currBlock->isA
nonymousBlock(); currBlock = toRenderBlock(currBlock->nextSibling())) { | 1041 for (RenderBlock* currBlock = containingBlock(); currBlock && currBlock->isA
nonymousBlock(); currBlock = toRenderBlock(currBlock->nextSibling())) { |
1042 for (RenderObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { | 1042 for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->ne
xtSibling()) { |
1043 LayoutRect rect = curr->clippedOverflowRectForPaintInvalidation(view
()); | 1043 LayoutRect rect = curr->clippedOverflowRectForPaintInvalidation(view
()); |
1044 context(rect); | 1044 context(rect); |
1045 if (curr == endContinuation) | 1045 if (curr == endContinuation) |
1046 return enclosingIntRect(floatResult); | 1046 return enclosingIntRect(floatResult); |
1047 } | 1047 } |
1048 } | 1048 } |
1049 return LayoutRect(); | 1049 return LayoutRect(); |
1050 } | 1050 } |
1051 | 1051 |
1052 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const LayoutLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const | 1052 LayoutRect RenderInline::clippedOverflowRectForPaintInvalidation(const LayoutLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const |
(...skipping 10 matching lines...) Expand all Loading... |
1063 return LayoutRect(); | 1063 return LayoutRect(); |
1064 | 1064 |
1065 LayoutRect overflowRect(linesVisualOverflowBoundingBox()); | 1065 LayoutRect overflowRect(linesVisualOverflowBoundingBox()); |
1066 | 1066 |
1067 LayoutUnit outlineSize = style()->outlineSize(); | 1067 LayoutUnit outlineSize = style()->outlineSize(); |
1068 overflowRect.inflate(outlineSize); | 1068 overflowRect.inflate(outlineSize); |
1069 | 1069 |
1070 mapRectToPaintInvalidationBacking(paintInvalidationContainer, overflowRect,
paintInvalidationState); | 1070 mapRectToPaintInvalidationBacking(paintInvalidationContainer, overflowRect,
paintInvalidationState); |
1071 | 1071 |
1072 if (outlineSize) { | 1072 if (outlineSize) { |
1073 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1073 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
1074 if (!curr->isText()) | 1074 if (!curr->isText()) |
1075 overflowRect.unite(curr->rectWithOutlineForPaintInvalidation(pai
ntInvalidationContainer, outlineSize)); | 1075 overflowRect.unite(curr->rectWithOutlineForPaintInvalidation(pai
ntInvalidationContainer, outlineSize)); |
1076 } | 1076 } |
1077 | 1077 |
1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) | 1078 if (continuation() && !continuation()->isInline() && continuation()->par
ent()) |
1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); | 1079 overflowRect.unite(continuation()->rectWithOutlineForPaintInvalidati
on(paintInvalidationContainer, outlineSize)); |
1080 } | 1080 } |
1081 | 1081 |
1082 return overflowRect; | 1082 return overflowRect; |
1083 } | 1083 } |
1084 | 1084 |
1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const | 1085 LayoutRect RenderInline::rectWithOutlineForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval
idationState* paintInvalidationState) const |
1086 { | 1086 { |
1087 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); | 1087 LayoutRect r(RenderBoxModelObject::rectWithOutlineForPaintInvalidation(paint
InvalidationContainer, outlineWidth, paintInvalidationState)); |
1088 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) { | 1088 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { |
1089 if (!curr->isText()) | 1089 if (!curr->isText()) |
1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); | 1090 r.unite(curr->rectWithOutlineForPaintInvalidation(paintInvalidationC
ontainer, outlineWidth, paintInvalidationState)); |
1091 } | 1091 } |
1092 return r; | 1092 return r; |
1093 } | 1093 } |
1094 | 1094 |
1095 void RenderInline::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const | 1095 void RenderInline::mapRectToPaintInvalidationBacking(const LayoutLayerModelObjec
t* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* p
aintInvalidationState) const |
1096 { | 1096 { |
1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1097 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1098 if (style()->hasInFlowPosition() && layer()) | 1098 if (style()->hasInFlowPosition() && layer()) |
1099 rect.move(layer()->offsetForInFlowPosition()); | 1099 rect.move(layer()->offsetForInFlowPosition()); |
1100 rect.move(paintInvalidationState->paintOffset()); | 1100 rect.move(paintInvalidationState->paintOffset()); |
1101 if (paintInvalidationState->isClipped()) | 1101 if (paintInvalidationState->isClipped()) |
1102 rect.intersect(paintInvalidationState->clipRect()); | 1102 rect.intersect(paintInvalidationState->clipRect()); |
1103 return; | 1103 return; |
1104 } | 1104 } |
1105 | 1105 |
1106 if (paintInvalidationContainer == this) | 1106 if (paintInvalidationContainer == this) |
1107 return; | 1107 return; |
1108 | 1108 |
1109 bool containerSkipped; | 1109 bool containerSkipped; |
1110 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1110 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); |
1111 if (!o) | 1111 if (!o) |
1112 return; | 1112 return; |
1113 | 1113 |
1114 LayoutPoint topLeft = rect.location(); | 1114 LayoutPoint topLeft = rect.location(); |
1115 | 1115 |
1116 if (o->isRenderBlockFlow() && !style()->hasOutOfFlowPosition()) { | 1116 if (o->isRenderBlockFlow() && !style()->hasOutOfFlowPosition()) { |
1117 RenderBlock* cb = toRenderBlock(o); | 1117 RenderBlock* cb = toRenderBlock(o); |
1118 if (cb->hasColumns()) { | 1118 if (cb->hasColumns()) { |
1119 LayoutRect paintInvalidationRect(topLeft, rect.size()); | 1119 LayoutRect paintInvalidationRect(topLeft, rect.size()); |
1120 cb->adjustRectForColumns(paintInvalidationRect); | 1120 cb->adjustRectForColumns(paintInvalidationRect); |
1121 topLeft = paintInvalidationRect.location(); | 1121 topLeft = paintInvalidationRect.location(); |
1122 rect = paintInvalidationRect; | 1122 rect = paintInvalidationRect; |
1123 } | 1123 } |
1124 } | 1124 } |
1125 | 1125 |
1126 if (style()->hasInFlowPosition() && layer()) { | 1126 if (style()->hasInFlowPosition() && layer()) { |
1127 // Apply the in-flow position offset when invalidating a rectangle. The
layer | 1127 // Apply the in-flow position offset when invalidating a rectangle. The
layer |
1128 // is translated, but the render box isn't, so we need to do this to get
the | 1128 // is translated, but the render box isn't, so we need to do this to get
the |
1129 // right dirty rect. Since this is called from RenderObject::setStyle, t
he relative position | 1129 // right dirty rect. Since this is called from LayoutObject::setStyle, t
he relative position |
1130 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 1130 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). |
1131 topLeft += layer()->offsetForInFlowPosition(); | 1131 topLeft += layer()->offsetForInFlowPosition(); |
1132 } | 1132 } |
1133 | 1133 |
1134 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1134 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1135 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1135 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1136 rect.setLocation(topLeft); | 1136 rect.setLocation(topLeft); |
1137 if (o->hasOverflowClip()) { | 1137 if (o->hasOverflowClip()) { |
1138 RenderBox* containerBox = toRenderBox(o); | 1138 RenderBox* containerBox = toRenderBox(o); |
1139 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); | 1139 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rect); |
1140 if (rect.isEmpty()) | 1140 if (rect.isEmpty()) |
1141 return; | 1141 return; |
1142 } | 1142 } |
1143 | 1143 |
1144 if (containerSkipped) { | 1144 if (containerSkipped) { |
1145 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1145 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
1146 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1146 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
1147 rect.move(-containerOffset); | 1147 rect.move(-containerOffset); |
1148 return; | 1148 return; |
1149 } | 1149 } |
1150 | 1150 |
1151 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paint
InvalidationState); | 1151 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paint
InvalidationState); |
1152 } | 1152 } |
1153 | 1153 |
1154 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons
t LayoutPoint& point, bool* offsetDependsOnPoint) const | 1154 LayoutSize RenderInline::offsetFromContainer(const LayoutObject* container, cons
t LayoutPoint& point, bool* offsetDependsOnPoint) const |
1155 { | 1155 { |
1156 ASSERT(container == this->container()); | 1156 ASSERT(container == this->container()); |
1157 | 1157 |
1158 LayoutSize offset; | 1158 LayoutSize offset; |
1159 if (isRelPositioned()) | 1159 if (isRelPositioned()) |
1160 offset += offsetForInFlowPosition(); | 1160 offset += offsetForInFlowPosition(); |
1161 | 1161 |
1162 offset += container->columnOffset(point); | 1162 offset += container->columnOffset(point); |
1163 | 1163 |
1164 if (container->hasOverflowClip()) | 1164 if (container->hasOverflowClip()) |
(...skipping 15 matching lines...) Expand all Loading... |
1180 | 1180 |
1181 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1181 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1182 LayoutSize offset = paintInvalidationState->paintOffset(); | 1182 LayoutSize offset = paintInvalidationState->paintOffset(); |
1183 if (style()->hasInFlowPosition() && layer()) | 1183 if (style()->hasInFlowPosition() && layer()) |
1184 offset += layer()->offsetForInFlowPosition(); | 1184 offset += layer()->offsetForInFlowPosition(); |
1185 transformState.move(offset); | 1185 transformState.move(offset); |
1186 return; | 1186 return; |
1187 } | 1187 } |
1188 | 1188 |
1189 bool containerSkipped; | 1189 bool containerSkipped; |
1190 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1190 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); |
1191 if (!o) | 1191 if (!o) |
1192 return; | 1192 return; |
1193 | 1193 |
1194 if (mode & ApplyContainerFlip && o->isBox()) { | 1194 if (mode & ApplyContainerFlip && o->isBox()) { |
1195 if (o->style()->isFlippedBlocksWritingMode()) { | 1195 if (o->style()->isFlippedBlocksWritingMode()) { |
1196 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; | 1196 IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint())
; |
1197 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(centerPoint) - centerPoint); | 1197 transformState.move(toRenderBox(o)->flipForWritingModeIncludingColum
ns(centerPoint) - centerPoint); |
1198 } | 1198 } |
1199 mode &= ~ApplyContainerFlip; | 1199 mode &= ~ApplyContainerFlip; |
1200 } | 1200 } |
(...skipping 19 matching lines...) Expand all Loading... |
1220 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed, paintInvalidationState); | 1220 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed, paintInvalidationState); |
1221 } | 1221 } |
1222 | 1222 |
1223 void RenderInline::updateDragState(bool dragOn) | 1223 void RenderInline::updateDragState(bool dragOn) |
1224 { | 1224 { |
1225 RenderBoxModelObject::updateDragState(dragOn); | 1225 RenderBoxModelObject::updateDragState(dragOn); |
1226 if (continuation()) | 1226 if (continuation()) |
1227 continuation()->updateDragState(dragOn); | 1227 continuation()->updateDragState(dragOn); |
1228 } | 1228 } |
1229 | 1229 |
1230 void RenderInline::childBecameNonInline(RenderObject* child) | 1230 void RenderInline::childBecameNonInline(LayoutObject* child) |
1231 { | 1231 { |
1232 // We have to split the parent flow. | 1232 // We have to split the parent flow. |
1233 RenderBlock* newBox = containingBlock()->createAnonymousBlock(); | 1233 RenderBlock* newBox = containingBlock()->createAnonymousBlock(); |
1234 RenderBoxModelObject* oldContinuation = continuation(); | 1234 RenderBoxModelObject* oldContinuation = continuation(); |
1235 setContinuation(newBox); | 1235 setContinuation(newBox); |
1236 RenderObject* beforeChild = child->nextSibling(); | 1236 LayoutObject* beforeChild = child->nextSibling(); |
1237 children()->removeChildNode(this, child); | 1237 children()->removeChildNode(this, child); |
1238 splitFlow(beforeChild, newBox, child, oldContinuation); | 1238 splitFlow(beforeChild, newBox, child, oldContinuation); |
1239 } | 1239 } |
1240 | 1240 |
1241 void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) | 1241 void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint&
point) |
1242 { | 1242 { |
1243 if (result.innerNode()) | 1243 if (result.innerNode()) |
1244 return; | 1244 return; |
1245 | 1245 |
1246 Node* n = node(); | 1246 Node* n = node(); |
(...skipping 18 matching lines...) Expand all Loading... |
1265 | 1265 |
1266 void RenderInline::dirtyLineBoxes(bool fullLayout) | 1266 void RenderInline::dirtyLineBoxes(bool fullLayout) |
1267 { | 1267 { |
1268 if (fullLayout) { | 1268 if (fullLayout) { |
1269 m_lineBoxes.deleteLineBoxes(); | 1269 m_lineBoxes.deleteLineBoxes(); |
1270 return; | 1270 return; |
1271 } | 1271 } |
1272 | 1272 |
1273 if (!alwaysCreateLineBoxes()) { | 1273 if (!alwaysCreateLineBoxes()) { |
1274 // We have to grovel into our children in order to dirty the appropriate
lines. | 1274 // We have to grovel into our children in order to dirty the appropriate
lines. |
1275 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { | 1275 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()
) { |
1276 if (curr->isFloatingOrOutOfFlowPositioned()) | 1276 if (curr->isFloatingOrOutOfFlowPositioned()) |
1277 continue; | 1277 continue; |
1278 if (curr->isBox() && !curr->needsLayout()) { | 1278 if (curr->isBox() && !curr->needsLayout()) { |
1279 RenderBox* currBox = toRenderBox(curr); | 1279 RenderBox* currBox = toRenderBox(curr); |
1280 if (currBox->inlineBoxWrapper()) | 1280 if (currBox->inlineBoxWrapper()) |
1281 currBox->inlineBoxWrapper()->root().markDirty(); | 1281 currBox->inlineBoxWrapper()->root().markDirty(); |
1282 } else if (!curr->selfNeedsLayout()) { | 1282 } else if (!curr->selfNeedsLayout()) { |
1283 if (curr->isRenderInline()) { | 1283 if (curr->isRenderInline()) { |
1284 RenderInline* currInline = toRenderInline(curr); | 1284 RenderInline* currInline = toRenderInline(curr); |
1285 for (InlineFlowBox* childLine = currInline->firstLineBox();
childLine; childLine = childLine->nextLineBox()) | 1285 for (InlineFlowBox* childLine = currInline->firstLineBox();
childLine; childLine = childLine->nextLineBox()) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 if (style()->visibility() != VISIBLE) | 1433 if (style()->visibility() != VISIBLE) |
1434 return; | 1434 return; |
1435 | 1435 |
1436 if (style()->getDraggableRegionMode() == DraggableRegionNone) | 1436 if (style()->getDraggableRegionMode() == DraggableRegionNone) |
1437 return; | 1437 return; |
1438 | 1438 |
1439 AnnotatedRegionValue region; | 1439 AnnotatedRegionValue region; |
1440 region.draggable = style()->getDraggableRegionMode() == DraggableRegionDrag; | 1440 region.draggable = style()->getDraggableRegionMode() == DraggableRegionDrag; |
1441 region.bounds = linesBoundingBox(); | 1441 region.bounds = linesBoundingBox(); |
1442 | 1442 |
1443 RenderObject* container = containingBlock(); | 1443 LayoutObject* container = containingBlock(); |
1444 if (!container) | 1444 if (!container) |
1445 container = this; | 1445 container = this; |
1446 | 1446 |
1447 FloatPoint absPos = container->localToAbsolute(); | 1447 FloatPoint absPos = container->localToAbsolute(); |
1448 region.bounds.setX(absPos.x() + region.bounds.x()); | 1448 region.bounds.setX(absPos.x() + region.bounds.x()); |
1449 region.bounds.setY(absPos.y() + region.bounds.y()); | 1449 region.bounds.setY(absPos.y() + region.bounds.y()); |
1450 | 1450 |
1451 regions.append(region); | 1451 regions.append(region); |
1452 } | 1452 } |
1453 | 1453 |
1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const | 1454 void RenderInline::invalidateDisplayItemClients(DisplayItemList* displayItemList
) const |
1455 { | 1455 { |
1456 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); | 1456 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); |
1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 1457 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
1458 displayItemList->invalidate(box->displayItemClient()); | 1458 displayItemList->invalidate(box->displayItemClient()); |
1459 } | 1459 } |
1460 | 1460 |
1461 } // namespace blink | 1461 } // namespace blink |
OLD | NEW |