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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 namespace blink { | 51 namespace blink { |
52 | 52 |
53 // The HashMap for storing continuation pointers. | 53 // The HashMap for storing continuation pointers. |
54 // An inline can be split with blocks occuring in between the inline content. | 54 // An inline can be split with blocks occuring in between the inline content. |
55 // When this occurs we need a pointer to the next object. We can basically be | 55 // When this occurs we need a pointer to the next object. We can basically be |
56 // split into a sequence of inlines and blocks. The continuation will either be | 56 // split into a sequence of inlines and blocks. The continuation will either be |
57 // an anonymous block (that houses other blocks) or it will be an inline flow. | 57 // an anonymous block (that houses other blocks) or it will be an inline flow. |
58 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as | 58 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as |
59 // its continuation but the <b> will just have an inline as its continuation. | 59 // its continuation but the <b> will just have an inline as its continuation. |
60 typedef WillBeHeapHashMap<RawPtrWillBeMember<const RenderBoxModelObject>, RawPtr
WillBeMember<RenderBoxModelObject> > ContinuationMap; | 60 typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> Continuation
Map; |
61 static OwnPtrWillBePersistent<ContinuationMap>* continuationMap = 0; | 61 static ContinuationMap* continuationMap = nullptr; |
62 | 62 |
63 void RenderBoxModelObject::setSelectionState(SelectionState state) | 63 void RenderBoxModelObject::setSelectionState(SelectionState state) |
64 { | 64 { |
65 if (state == SelectionInside && selectionState() != SelectionNone) | 65 if (state == SelectionInside && selectionState() != SelectionNone) |
66 return; | 66 return; |
67 | 67 |
68 if ((state == SelectionStart && selectionState() == SelectionEnd) | 68 if ((state == SelectionStart && selectionState() == SelectionEnd) |
69 || (state == SelectionEnd && selectionState() == SelectionStart)) | 69 || (state == SelectionEnd && selectionState() == SelectionStart)) |
70 RenderObject::setSelectionState(SelectionBoth); | 70 RenderObject::setSelectionState(SelectionBoth); |
71 else | 71 else |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 459 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const |
460 { | 460 { |
461 return containingBlock()->availableLogicalWidth(); | 461 return containingBlock()->availableLogicalWidth(); |
462 } | 462 } |
463 | 463 |
464 RenderBoxModelObject* RenderBoxModelObject::continuation() const | 464 RenderBoxModelObject* RenderBoxModelObject::continuation() const |
465 { | 465 { |
466 if (!continuationMap) | 466 if (!continuationMap) |
467 return 0; | 467 return 0; |
468 return (*continuationMap)->get(this); | 468 return continuationMap->get(this); |
469 } | 469 } |
470 | 470 |
471 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) | 471 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) |
472 { | 472 { |
473 if (continuation) { | 473 if (continuation) { |
474 if (!continuationMap) | 474 if (!continuationMap) |
475 continuationMap = new OwnPtrWillBePersistent<ContinuationMap>(adoptP
trWillBeNoop(new ContinuationMap)); | 475 continuationMap = new ContinuationMap; |
476 (*continuationMap)->set(this, continuation); | 476 continuationMap->set(this, continuation); |
477 } else { | 477 } else { |
478 if (continuationMap) | 478 if (continuationMap) |
479 (*continuationMap)->remove(this); | 479 continuationMap->remove(this); |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 void RenderBoxModelObject::computeLayerHitTestRects(LayerHitTestRects& rects) co
nst | 483 void RenderBoxModelObject::computeLayerHitTestRects(LayerHitTestRects& rects) co
nst |
484 { | 484 { |
485 RenderLayerModelObject::computeLayerHitTestRects(rects); | 485 RenderLayerModelObject::computeLayerHitTestRects(rects); |
486 | 486 |
487 // If there is a continuation then we need to consult it here, since this is | 487 // If there is a continuation then we need to consult it here, since this is |
488 // the root of the tree walk and it wouldn't otherwise get picked up. | 488 // the root of the tree walk and it wouldn't otherwise get picked up. |
489 // Continuations should always be siblings in the tree, so any others should | 489 // Continuations should always be siblings in the tree, so any others should |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 655 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
656 for (RenderObject* child = startChild; child && child != endChild; ) { | 656 for (RenderObject* child = startChild; child && child != endChild; ) { |
657 // Save our next sibling as moveChildTo will clear it. | 657 // Save our next sibling as moveChildTo will clear it. |
658 RenderObject* nextSibling = child->nextSibling(); | 658 RenderObject* nextSibling = child->nextSibling(); |
659 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 659 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
660 child = nextSibling; | 660 child = nextSibling; |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 } // namespace blink | 664 } // namespace blink |
OLD | NEW |