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

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

Issue 295923002: Use tighter typing for RenderTextFragment::firstLetter() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/inspector/InspectorCSSAgent.cpp ('k') | Source/core/rendering/RenderTextFragment.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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 4023 matching lines...) Expand 10 before | Expand all | Expand 10 after
4034 // FIXME: If textLength is 0, length may still be 1! 4034 // FIXME: If textLength is 0, length may still be 1!
4035 return length; 4035 return length;
4036 } 4036 }
4037 4037
4038 void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend erObject* currentChild, unsigned length) 4038 void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend erObject* currentChild, unsigned length)
4039 { 4039 {
4040 ASSERT(length && currentChild->isText()); 4040 ASSERT(length && currentChild->isText());
4041 4041
4042 RenderObject* firstLetterContainer = currentChild->parent(); 4042 RenderObject* firstLetterContainer = currentChild->parent();
4043 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter Container); 4043 RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetter Container);
4044 RenderObject* firstLetter = 0; 4044 RenderBoxModelObject* firstLetter = 0;
4045 if (pseudoStyle->display() == INLINE) 4045 if (pseudoStyle->display() == INLINE)
4046 firstLetter = RenderInline::createAnonymous(&document()); 4046 firstLetter = RenderInline::createAnonymous(&document());
4047 else 4047 else
4048 firstLetter = RenderBlockFlow::createAnonymous(&document()); 4048 firstLetter = RenderBlockFlow::createAnonymous(&document());
4049 firstLetter->setStyle(pseudoStyle); 4049 firstLetter->setStyle(pseudoStyle);
4050 4050
4051 // FIXME: The first letter code should not modify the render tree during 4051 // FIXME: The first letter code should not modify the render tree during
4052 // layout. crbug.com/370458 4052 // layout. crbug.com/370458
4053 DeprecatedDisableModifyRenderTreeStructureAsserts disabler; 4053 DeprecatedDisableModifyRenderTreeStructureAsserts disabler;
4054 4054
(...skipping 10 matching lines...) Expand all
4065 // This text fragment might be empty. 4065 // This text fragment might be empty.
4066 RenderTextFragment* remainingText = 4066 RenderTextFragment* remainingText =
4067 new RenderTextFragment(textObj->node() ? textObj->node() : &textObj->doc ument(), oldText.impl(), length, oldText.length() - length); 4067 new RenderTextFragment(textObj->node() ? textObj->node() : &textObj->doc ument(), oldText.impl(), length, oldText.length() - length);
4068 remainingText->setStyle(textObj->style()); 4068 remainingText->setStyle(textObj->style());
4069 if (remainingText->node()) 4069 if (remainingText->node())
4070 remainingText->node()->setRenderer(remainingText); 4070 remainingText->node()->setRenderer(remainingText);
4071 4071
4072 firstLetterContainer->addChild(remainingText, textObj); 4072 firstLetterContainer->addChild(remainingText, textObj);
4073 firstLetterContainer->removeChild(textObj); 4073 firstLetterContainer->removeChild(textObj);
4074 remainingText->setFirstLetter(firstLetter); 4074 remainingText->setFirstLetter(firstLetter);
4075 toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remainingTe xt); 4075 firstLetter->setFirstLetterRemainingText(remainingText);
4076 4076
4077 // construct text fragment for the first letter 4077 // construct text fragment for the first letter
4078 RenderTextFragment* letter = 4078 RenderTextFragment* letter =
4079 new RenderTextFragment(remainingText->node() ? remainingText->node() : & remainingText->document(), oldText.impl(), 0, length); 4079 new RenderTextFragment(remainingText->node() ? remainingText->node() : & remainingText->document(), oldText.impl(), 0, length);
4080 letter->setStyle(pseudoStyle); 4080 letter->setStyle(pseudoStyle);
4081 firstLetter->addChild(letter); 4081 firstLetter->addChild(letter);
4082 4082
4083 textObj->destroy(); 4083 textObj->destroy();
4084 } 4084 }
4085 4085
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
4992 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 4992 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
4993 { 4993 {
4994 showRenderObject(); 4994 showRenderObject();
4995 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 4995 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
4996 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 4996 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
4997 } 4997 }
4998 4998
4999 #endif 4999 #endif
5000 5000
5001 } // namespace WebCore 5001 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/core/rendering/RenderTextFragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698