Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 639863006: Revert of Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698