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

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

Issue 16896019: Replace RenderArena with PartitionAlloc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 13 matching lines...) Expand all
24 #include "core/page/Chrome.h" 24 #include "core/page/Chrome.h"
25 #include "core/page/ChromeClient.h" 25 #include "core/page/ChromeClient.h"
26 #include "core/page/Frame.h" 26 #include "core/page/Frame.h"
27 #include "core/page/Page.h" 27 #include "core/page/Page.h"
28 #include "core/platform/graphics/GraphicsContext.h" 28 #include "core/platform/graphics/GraphicsContext.h"
29 #include "core/platform/text/BidiResolver.h" 29 #include "core/platform/text/BidiResolver.h"
30 #include "core/rendering/EllipsisBox.h" 30 #include "core/rendering/EllipsisBox.h"
31 #include "core/rendering/HitTestResult.h" 31 #include "core/rendering/HitTestResult.h"
32 #include "core/rendering/InlineTextBox.h" 32 #include "core/rendering/InlineTextBox.h"
33 #include "core/rendering/PaintInfo.h" 33 #include "core/rendering/PaintInfo.h"
34 #include "core/rendering/RenderArena.h"
35 #include "core/rendering/RenderBlock.h" 34 #include "core/rendering/RenderBlock.h"
36 #include "core/rendering/RenderFlowThread.h" 35 #include "core/rendering/RenderFlowThread.h"
37 #include "core/rendering/RenderView.h" 36 #include "core/rendering/RenderView.h"
38 #include "core/rendering/VerticalPositionCache.h" 37 #include "core/rendering/VerticalPositionCache.h"
39 #include <wtf/unicode/Unicode.h> 38 #include <wtf/unicode/Unicode.h>
40 39
41 using namespace std; 40 using namespace std;
42 41
43 namespace WebCore { 42 namespace WebCore {
44 43
(...skipping 13 matching lines...) Expand all
58 , m_lineBreakObj(0) 57 , m_lineBreakObj(0)
59 , m_lineTop(0) 58 , m_lineTop(0)
60 , m_lineBottom(0) 59 , m_lineBottom(0)
61 , m_lineTopWithLeading(0) 60 , m_lineTopWithLeading(0)
62 , m_lineBottomWithLeading(0) 61 , m_lineBottomWithLeading(0)
63 { 62 {
64 setIsHorizontal(block->isHorizontalWritingMode()); 63 setIsHorizontal(block->isHorizontalWritingMode());
65 } 64 }
66 65
67 66
68 void RootInlineBox::destroy(RenderArena* arena) 67 void RootInlineBox::destroy()
69 { 68 {
70 detachEllipsisBox(arena); 69 detachEllipsisBox();
71 InlineFlowBox::destroy(arena); 70 InlineFlowBox::destroy();
72 } 71 }
73 72
74 void RootInlineBox::detachEllipsisBox(RenderArena* arena) 73 void RootInlineBox::detachEllipsisBox()
75 { 74 {
76 if (hasEllipsisBox()) { 75 if (hasEllipsisBox()) {
77 EllipsisBox* box = gEllipsisBoxMap->take(this); 76 EllipsisBox* box = gEllipsisBoxMap->take(this);
78 box->setParent(0); 77 box->setParent(0);
79 box->destroy(arena); 78 box->destroy();
80 setHasEllipsisBox(false); 79 setHasEllipsisBox(false);
81 } 80 }
82 } 81 }
83 82
84 RenderLineBoxList* RootInlineBox::rendererLineBoxes() const 83 RenderLineBoxList* RootInlineBox::rendererLineBoxes() const
85 { 84 {
86 return block()->lineBoxes(); 85 return block()->lineBoxes();
87 } 86 }
88 87
89 void RootInlineBox::clearTruncation() 88 void RootInlineBox::clearTruncation()
90 { 89 {
91 if (hasEllipsisBox()) { 90 if (hasEllipsisBox()) {
92 detachEllipsisBox(renderer()->renderArena()); 91 detachEllipsisBox();
93 InlineFlowBox::clearTruncation(); 92 InlineFlowBox::clearTruncation();
94 } 93 }
95 } 94 }
96 95
97 bool RootInlineBox::isHyphenated() const 96 bool RootInlineBox::isHyphenated() const
98 { 97 {
99 for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) { 98 for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) {
100 if (box->isInlineTextBox()) { 99 if (box->isInlineTextBox()) {
101 if (toInlineTextBox(box)->hasHyphen()) 100 if (toInlineTextBox(box)->hasHyphen())
102 return true; 101 return true;
(...skipping 22 matching lines...) Expand all
125 124
126 // Next iterate over all the line boxes on the line. If we find a replaced element that intersects 125 // Next iterate over all the line boxes on the line. If we find a replaced element that intersects
127 // then we refuse to accommodate the ellipsis. Otherwise we're ok. 126 // then we refuse to accommodate the ellipsis. Otherwise we're ok.
128 return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth); 127 return InlineFlowBox::canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth);
129 } 128 }
130 129
131 float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, f loat blockLeftEdge, float blockRightEdge, float ellipsisWidth, 130 float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr, bool ltr, f loat blockLeftEdge, float blockRightEdge, float ellipsisWidth,
132 InlineBox* markupBox) 131 InlineBox* markupBox)
133 { 132 {
134 // Create an ellipsis box. 133 // Create an ellipsis box.
135 EllipsisBox* ellipsisBox = new (renderer()->renderArena()) EllipsisBox(rende rer(), ellipsisStr, this, 134 EllipsisBox* ellipsisBox = new EllipsisBox(renderer(), ellipsisStr, this, el lipsisWidth - (markupBox ? markupBox->logicalWidth() : 0), logicalHeight(), y(), !prevRootBox(), isHorizontal(), markupBox);
136 ellipsisWidth - (m arkupBox ? markupBox->logicalWidth() : 0), logicalHeight(),
137 y(), !prevRootBox( ), isHorizontal(), markupBox);
138 135
139 if (!gEllipsisBoxMap) 136 if (!gEllipsisBoxMap)
140 gEllipsisBoxMap = new EllipsisBoxMap(); 137 gEllipsisBoxMap = new EllipsisBoxMap();
141 gEllipsisBoxMap->add(this, ellipsisBox); 138 gEllipsisBoxMap->add(this, ellipsisBox);
142 setHasEllipsisBox(true); 139 setHasEllipsisBox(true);
143 140
144 // FIXME: Do we need an RTL version of this? 141 // FIXME: Do we need an RTL version of this?
145 if (ltr && (x() + logicalWidth() + ellipsisWidth) <= blockRightEdge) { 142 if (ltr && (x() + logicalWidth() + ellipsisWidth) <= blockRightEdge) {
146 ellipsisBox->setX(x() + logicalWidth()); 143 ellipsisBox->setX(x() + logicalWidth());
147 return logicalWidth() + ellipsisWidth; 144 return logicalWidth() + ellipsisWidth;
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 } 987 }
991 988
992 #ifndef NDEBUG 989 #ifndef NDEBUG
993 const char* RootInlineBox::boxName() const 990 const char* RootInlineBox::boxName() const
994 { 991 {
995 return "RootInlineBox"; 992 return "RootInlineBox";
996 } 993 }
997 #endif 994 #endif
998 995
999 } // namespace WebCore 996 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698