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

Side by Side Diff: WebCore/rendering/RenderBlockLineLayout.cpp

Issue 3692003: Merge 69345 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 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
« no previous file with comments | « WebCore/rendering/InlineFlowBox.cpp ('k') | no next file » | 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r eserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r eserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 } while (true); 258 } while (true);
259 259
260 return result; 260 return result;
261 } 261 }
262 262
263 RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject) 263 RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject)
264 { 264 {
265 ASSERT(firstRun); 265 ASSERT(firstRun);
266 266
267 bool rootHasSelectedChildren = false;
267 InlineFlowBox* parentBox = 0; 268 InlineFlowBox* parentBox = 0;
268 for (BidiRun* r = firstRun; r; r = r->next()) { 269 for (BidiRun* r = firstRun; r; r = r->next()) {
269 // Create a box for our object. 270 // Create a box for our object.
270 bool isOnlyRun = (runCount == 1); 271 bool isOnlyRun = (runCount == 1);
271 if (runCount == 2 && !r->m_object->isListMarker()) 272 if (runCount == 2 && !r->m_object->isListMarker())
272 isOnlyRun = ((style()->direction() == RTL) ? lastRun : firstRun)->m_ object->isListMarker(); 273 isOnlyRun = ((style()->direction() == RTL) ? lastRun : firstRun)->m_ object->isListMarker();
273 274
274 InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRu n); 275 InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRu n);
275 r->m_box = box; 276 r->m_box = box;
276 277
277 ASSERT(box); 278 ASSERT(box);
278 if (!box) 279 if (!box)
279 continue; 280 continue;
280 281
282 if (!rootHasSelectedChildren && box->renderer()->selectionState() != Ren derObject::SelectionNone)
283 rootHasSelectedChildren = true;
284
281 // If we have no parent box yet, or if the run is not simply a sibling, 285 // If we have no parent box yet, or if the run is not simply a sibling,
282 // then we need to construct inline boxes as necessary to properly enclo se the 286 // then we need to construct inline boxes as necessary to properly enclo se the
283 // run's inline box. 287 // run's inline box.
284 if (!parentBox || parentBox->renderer() != r->m_object->parent()) 288 if (!parentBox || parentBox->renderer() != r->m_object->parent())
285 // Create new inline boxes all the way back to the appropriate inser tion point. 289 // Create new inline boxes all the way back to the appropriate inser tion point.
286 parentBox = createLineBoxes(r->m_object->parent(), firstLine); 290 parentBox = createLineBoxes(r->m_object->parent(), firstLine);
287 291
288 // Append the inline box to this line. 292 // Append the inline box to this line.
289 parentBox->addToLine(box); 293 parentBox->addToLine(box);
290 294
291 bool visuallyOrdered = r->m_object->style()->visuallyOrdered(); 295 bool visuallyOrdered = r->m_object->style()->visuallyOrdered();
292 box->setBidiLevel(visuallyOrdered ? 0 : r->level()); 296 box->setBidiLevel(visuallyOrdered ? 0 : r->level());
293 297
294 if (box->isInlineTextBox()) { 298 if (box->isInlineTextBox()) {
295 InlineTextBox* text = static_cast<InlineTextBox*>(box); 299 InlineTextBox* text = static_cast<InlineTextBox*>(box);
296 text->setStart(r->m_start); 300 text->setStart(r->m_start);
297 text->setLen(r->m_stop - r->m_start); 301 text->setLen(r->m_stop - r->m_start);
298 text->m_dirOverride = r->dirOverride(visuallyOrdered); 302 text->m_dirOverride = r->dirOverride(visuallyOrdered);
299 if (r->m_hasHyphen) 303 if (r->m_hasHyphen)
300 text->setHasHyphen(true); 304 text->setHasHyphen(true);
301 } 305 }
302 } 306 }
303 307
304 // We should have a root inline box. It should be unconstructed and 308 // We should have a root inline box. It should be unconstructed and
305 // be the last continuation of our line list. 309 // be the last continuation of our line list.
306 ASSERT(lastLineBox() && !lastLineBox()->isConstructed()); 310 ASSERT(lastLineBox() && !lastLineBox()->isConstructed());
307 311
312 // Set the m_selectedChildren flag on the root inline box if one of the leaf inline box
313 // from the bidi runs walk above has a selection state.
314 if (rootHasSelectedChildren)
315 lastLineBox()->root()->setHasSelectedChildren(true);
316
308 // Set bits on our inline flow boxes that indicate which sides should 317 // Set bits on our inline flow boxes that indicate which sides should
309 // paint borders/margins/padding. This knowledge will ultimately be used wh en 318 // paint borders/margins/padding. This knowledge will ultimately be used wh en
310 // we determine the horizontal positions and widths of all the inline boxes on 319 // we determine the horizontal positions and widths of all the inline boxes on
311 // the line. 320 // the line.
312 lastLineBox()->determineSpacingForFlowBoxes(lastLine, endObject); 321 lastLineBox()->determineSpacingForFlowBoxes(lastLine, endObject);
313 322
314 // Now mark the line boxes as being constructed. 323 // Now mark the line boxes as being constructed.
315 lastLineBox()->setConstructed(); 324 lastLineBox()->setConstructed();
316 325
317 // Return the last line. 326 // Return the last line.
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 // space. 2037 // space.
2029 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth; 2038 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth;
2030 int blockEdge = ltr ? blockRightEdge : blockLeftEdge; 2039 int blockEdge = ltr ? blockRightEdge : blockLeftEdge;
2031 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) ) 2040 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) )
2032 curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightE dge, width); 2041 curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightE dge, width);
2033 } 2042 }
2034 } 2043 }
2035 } 2044 }
2036 2045
2037 } 2046 }
OLDNEW
« no previous file with comments | « WebCore/rendering/InlineFlowBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698