Changeset 86927 in webkit
- Timestamp:
- May 20, 2011 12:56:57 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86926 r86927 1 2011-05-20 Leo Yang <leo.yang@torchmobile.com.cn> 2 3 Reviewed by Nikolas Zimmermann. 4 5 SVGRootInlineBox triggers calculateBoundaries twice in layout 6 https://bugs.webkit.org/show_bug.cgi?id=60979 7 8 SVGRootInlineBox was calculating boundaries for children twice 9 in computePerCharacterLayoutInformation(). The first time of 10 calculation was in layoutChildBoxes() which is called by 11 computePerCharacterLayoutInformation(), and the second time of 12 calculation was in layoutRootBox() following layoutChildBoxes(). 13 14 This patch calculates rectangle of children in layoutChildBoxes() 15 and then uses the rectange in layoutRootBox() to reduce a pass 16 of calculating child boundaries. 17 18 No functionality change, no new tests. 19 20 * rendering/svg/SVGRootInlineBox.cpp: 21 (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation): 22 (WebCore::SVGRootInlineBox::layoutChildBoxes): 23 (WebCore::SVGRootInlineBox::layoutRootBox): 24 * rendering/svg/SVGRootInlineBox.h: 25 1 26 2011-05-19 Naoki Takano <takano.naoki@gmail.com> 2 27 -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
r86395 r86927 4 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 5 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) 2011 Torch Mobile (Beijing) CO. Ltd. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 89 90 // Perform SVG text layout phase four 90 91 // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, resize the root box as well as the RenderSVGText parent block. 91 layoutChildBoxes(this); 92 layoutRootBox(); 92 IntRect childRect; 93 layoutChildBoxes(this, &childRect); 94 layoutRootBox(childRect); 93 95 } 94 96 … … 132 134 } 133 135 134 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start )136 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, IntRect* childRect) 135 137 { 136 138 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { 139 IntRect boxRect; 137 140 if (child->isSVGInlineTextBox()) { 138 141 ASSERT(child->renderer()); … … 140 143 141 144 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child); 142 IntRectboxRect = textBox->calculateBoundaries();145 boxRect = textBox->calculateBoundaries(); 143 146 textBox->setX(boxRect.x()); 144 147 textBox->setY(boxRect.y()); … … 155 158 layoutChildBoxes(flowBox); 156 159 157 IntRectboxRect = flowBox->calculateBoundaries();160 boxRect = flowBox->calculateBoundaries(); 158 161 flowBox->setX(boxRect.x()); 159 162 flowBox->setY(boxRect.y()); … … 161 164 flowBox->setLogicalHeight(boxRect.height()); 162 165 } 163 } 164 } 165 166 void SVGRootInlineBox::layoutRootBox() 166 if (childRect) 167 childRect->unite(boxRect); 168 } 169 } 170 171 void SVGRootInlineBox::layoutRootBox(const IntRect& childRect) 167 172 { 168 173 RenderBlock* parentBlock = block(); 169 174 ASSERT(parentBlock); 170 171 IntRect childRect;172 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {173 // Skip generated content.174 if (!child->renderer()->node())175 continue;176 childRect.unite(child->calculateBoundaries());177 }178 175 179 176 int widthBlock = childRect.width(); -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h
r82611 r86927 58 58 void reorderValueLists(Vector<SVGTextLayoutAttributes>&); 59 59 void layoutCharactersInTextBoxes(InlineFlowBox*, SVGTextLayoutEngine&); 60 void layoutChildBoxes(InlineFlowBox* );61 void layoutRootBox( );60 void layoutChildBoxes(InlineFlowBox*, IntRect* = 0); 61 void layoutRootBox(const IntRect&); 62 62 63 63 private:
Note: See TracChangeset
for help on using the changeset viewer.