| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 WillBeHeapHashMap<RawPtrWillBeMember<const RenderBoxModelObject>, RawPtr
WillBeMember<RenderBoxModelObject> > ContinuationMap; |
| 61 static OwnPtrWillBePersistent<ContinuationMap>* continuationMap = 0; | 61 static OwnPtrWillBePersistent<ContinuationMap>* continuationMap = 0; |
| 62 | 62 |
| 63 // This HashMap is similar to the continuation map, but connects first-letter | |
| 64 // renderers to their remaining text fragments. | |
| 65 typedef WillBeHeapHashMap<RawPtrWillBeMember<const RenderBoxModelObject>, RawPtr
WillBeMember<RenderTextFragment> > FirstLetterRemainingTextMap; | |
| 66 static OwnPtrWillBePersistent<FirstLetterRemainingTextMap>* firstLetterRemaining
TextMap = 0; | |
| 67 | |
| 68 void RenderBoxModelObject::setSelectionState(SelectionState state) | 63 void RenderBoxModelObject::setSelectionState(SelectionState state) |
| 69 { | 64 { |
| 70 if (state == SelectionInside && selectionState() != SelectionNone) | 65 if (state == SelectionInside && selectionState() != SelectionNone) |
| 71 return; | 66 return; |
| 72 | 67 |
| 73 if ((state == SelectionStart && selectionState() == SelectionEnd) | 68 if ((state == SelectionStart && selectionState() == SelectionEnd) |
| 74 || (state == SelectionEnd && selectionState() == SelectionStart)) | 69 || (state == SelectionEnd && selectionState() == SelectionStart)) |
| 75 RenderObject::setSelectionState(SelectionBoth); | 70 RenderObject::setSelectionState(SelectionBoth); |
| 76 else | 71 else |
| 77 RenderObject::setSelectionState(state); | 72 RenderObject::setSelectionState(state); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 106 { | 101 { |
| 107 } | 102 } |
| 108 | 103 |
| 109 void RenderBoxModelObject::willBeDestroyed() | 104 void RenderBoxModelObject::willBeDestroyed() |
| 110 { | 105 { |
| 111 ImageQualityController::remove(this); | 106 ImageQualityController::remove(this); |
| 112 | 107 |
| 113 // A continuation of this RenderObject should be destroyed at subclasses. | 108 // A continuation of this RenderObject should be destroyed at subclasses. |
| 114 ASSERT(!continuation()); | 109 ASSERT(!continuation()); |
| 115 | 110 |
| 116 // If this is a first-letter object with a remaining text fragment then the | |
| 117 // entry needs to be cleared from the map. | |
| 118 if (firstLetterRemainingText()) | |
| 119 setFirstLetterRemainingText(0); | |
| 120 | |
| 121 RenderLayerModelObject::willBeDestroyed(); | 111 RenderLayerModelObject::willBeDestroyed(); |
| 122 } | 112 } |
| 123 | 113 |
| 124 bool RenderBoxModelObject::calculateHasBoxDecorations() const | 114 bool RenderBoxModelObject::calculateHasBoxDecorations() const |
| 125 { | 115 { |
| 126 RenderStyle* styleToUse = style(); | 116 RenderStyle* styleToUse = style(); |
| 127 ASSERT(styleToUse); | 117 ASSERT(styleToUse); |
| 128 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan
ce() || styleToUse->boxShadow(); | 118 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan
ce() || styleToUse->boxShadow(); |
| 129 } | 119 } |
| 130 | 120 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 RenderLayerModelObject::computeLayerHitTestRects(rects); | 475 RenderLayerModelObject::computeLayerHitTestRects(rects); |
| 486 | 476 |
| 487 // If there is a continuation then we need to consult it here, since this is | 477 // 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. | 478 // 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 | 479 // Continuations should always be siblings in the tree, so any others should |
| 490 // get picked up already by the tree walk. | 480 // get picked up already by the tree walk. |
| 491 if (continuation()) | 481 if (continuation()) |
| 492 continuation()->computeLayerHitTestRects(rects); | 482 continuation()->computeLayerHitTestRects(rects); |
| 493 } | 483 } |
| 494 | 484 |
| 495 RenderTextFragment* RenderBoxModelObject::firstLetterRemainingText() const | |
| 496 { | |
| 497 if (!firstLetterRemainingTextMap) | |
| 498 return 0; | |
| 499 return (*firstLetterRemainingTextMap)->get(this); | |
| 500 } | |
| 501 | |
| 502 void RenderBoxModelObject::setFirstLetterRemainingText(RenderTextFragment* remai
ningText) | |
| 503 { | |
| 504 if (remainingText) { | |
| 505 if (!firstLetterRemainingTextMap) | |
| 506 firstLetterRemainingTextMap = new OwnPtrWillBePersistent<FirstLetter
RemainingTextMap>(adoptPtrWillBeNoop(new FirstLetterRemainingTextMap)); | |
| 507 (*firstLetterRemainingTextMap)->set(this, remainingText); | |
| 508 } else if (firstLetterRemainingTextMap) { | |
| 509 (*firstLetterRemainingTextMap)->remove(this); | |
| 510 } | |
| 511 } | |
| 512 | |
| 513 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) | 485 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) |
| 514 { | 486 { |
| 515 ASSERT(!slowFirstChild()); | 487 ASSERT(!slowFirstChild()); |
| 516 | 488 |
| 517 // FIXME: This does not take into account either :first-line or :first-lette
r | 489 // FIXME: This does not take into account either :first-line or :first-lette
r |
| 518 // However, as soon as some content is entered, the line boxes will be | 490 // However, as soon as some content is entered, the line boxes will be |
| 519 // constructed and this kludge is not called any more. So only the caret siz
e | 491 // constructed and this kludge is not called any more. So only the caret siz
e |
| 520 // of an empty :first-line'd block is wrong. I think we can live with that. | 492 // of an empty :first-line'd block is wrong. I think we can live with that. |
| 521 RenderStyle* currentStyle = firstLineStyle(); | 493 RenderStyle* currentStyle = firstLineStyle(); |
| 522 | 494 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 645 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 674 for (RenderObject* child = startChild; child && child != endChild; ) { | 646 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 675 // Save our next sibling as moveChildTo will clear it. | 647 // Save our next sibling as moveChildTo will clear it. |
| 676 RenderObject* nextSibling = child->nextSibling(); | 648 RenderObject* nextSibling = child->nextSibling(); |
| 677 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 649 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 678 child = nextSibling; | 650 child = nextSibling; |
| 679 } | 651 } |
| 680 } | 652 } |
| 681 | 653 |
| 682 } // namespace blink | 654 } // namespace blink |
| OLD | NEW |