| 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 |
| 63 void RenderBoxModelObject::setSelectionState(SelectionState state) | 68 void RenderBoxModelObject::setSelectionState(SelectionState state) |
| 64 { | 69 { |
| 65 if (state == SelectionInside && selectionState() != SelectionNone) | 70 if (state == SelectionInside && selectionState() != SelectionNone) |
| 66 return; | 71 return; |
| 67 | 72 |
| 68 if ((state == SelectionStart && selectionState() == SelectionEnd) | 73 if ((state == SelectionStart && selectionState() == SelectionEnd) |
| 69 || (state == SelectionEnd && selectionState() == SelectionStart)) | 74 || (state == SelectionEnd && selectionState() == SelectionStart)) |
| 70 RenderObject::setSelectionState(SelectionBoth); | 75 RenderObject::setSelectionState(SelectionBoth); |
| 71 else | 76 else |
| 72 RenderObject::setSelectionState(state); | 77 RenderObject::setSelectionState(state); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 { | 106 { |
| 102 } | 107 } |
| 103 | 108 |
| 104 void RenderBoxModelObject::willBeDestroyed() | 109 void RenderBoxModelObject::willBeDestroyed() |
| 105 { | 110 { |
| 106 ImageQualityController::remove(this); | 111 ImageQualityController::remove(this); |
| 107 | 112 |
| 108 // A continuation of this RenderObject should be destroyed at subclasses. | 113 // A continuation of this RenderObject should be destroyed at subclasses. |
| 109 ASSERT(!continuation()); | 114 ASSERT(!continuation()); |
| 110 | 115 |
| 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 |
| 111 RenderLayerModelObject::willBeDestroyed(); | 121 RenderLayerModelObject::willBeDestroyed(); |
| 112 } | 122 } |
| 113 | 123 |
| 114 bool RenderBoxModelObject::calculateHasBoxDecorations() const | 124 bool RenderBoxModelObject::calculateHasBoxDecorations() const |
| 115 { | 125 { |
| 116 RenderStyle* styleToUse = style(); | 126 RenderStyle* styleToUse = style(); |
| 117 ASSERT(styleToUse); | 127 ASSERT(styleToUse); |
| 118 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan
ce() || styleToUse->boxShadow(); | 128 return hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearan
ce() || styleToUse->boxShadow(); |
| 119 } | 129 } |
| 120 | 130 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 RenderLayerModelObject::computeLayerHitTestRects(rects); | 485 RenderLayerModelObject::computeLayerHitTestRects(rects); |
| 476 | 486 |
| 477 // 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 |
| 478 // 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. |
| 479 // 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 |
| 480 // get picked up already by the tree walk. | 490 // get picked up already by the tree walk. |
| 481 if (continuation()) | 491 if (continuation()) |
| 482 continuation()->computeLayerHitTestRects(rects); | 492 continuation()->computeLayerHitTestRects(rects); |
| 483 } | 493 } |
| 484 | 494 |
| 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 |
| 485 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) | 513 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) |
| 486 { | 514 { |
| 487 ASSERT(!slowFirstChild()); | 515 ASSERT(!slowFirstChild()); |
| 488 | 516 |
| 489 // FIXME: This does not take into account either :first-line or :first-lette
r | 517 // FIXME: This does not take into account either :first-line or :first-lette
r |
| 490 // However, as soon as some content is entered, the line boxes will be | 518 // However, as soon as some content is entered, the line boxes will be |
| 491 // constructed and this kludge is not called any more. So only the caret siz
e | 519 // constructed and this kludge is not called any more. So only the caret siz
e |
| 492 // of an empty :first-line'd block is wrong. I think we can live with that. | 520 // of an empty :first-line'd block is wrong. I think we can live with that. |
| 493 RenderStyle* currentStyle = firstLineStyle(); | 521 RenderStyle* currentStyle = firstLineStyle(); |
| 494 | 522 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 673 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 646 for (RenderObject* child = startChild; child && child != endChild; ) { | 674 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 647 // Save our next sibling as moveChildTo will clear it. | 675 // Save our next sibling as moveChildTo will clear it. |
| 648 RenderObject* nextSibling = child->nextSibling(); | 676 RenderObject* nextSibling = child->nextSibling(); |
| 649 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 677 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 650 child = nextSibling; | 678 child = nextSibling; |
| 651 } | 679 } |
| 652 } | 680 } |
| 653 | 681 |
| 654 } // namespace blink | 682 } // namespace blink |
| OLD | NEW |