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

Side by Side Diff: third_party/WebKit/WebCore/rendering/bidi.cpp

Issue 21152: WebKit merge 40668:40722 part 1. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All right reserved. 3 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All right reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (smidpoints->size() <= sNumMidpoints) 380 if (smidpoints->size() <= sNumMidpoints)
381 smidpoints->grow(sNumMidpoints + 10); 381 smidpoints->grow(sNumMidpoints + 10);
382 382
383 InlineIterator* midpoints = smidpoints->data(); 383 InlineIterator* midpoints = smidpoints->data();
384 midpoints[sNumMidpoints++] = midpoint; 384 midpoints[sNumMidpoints++] = midpoint;
385 } 385 }
386 386
387 static void appendRunsForObject(int start, int end, RenderObject* obj, InlineBid iResolver& resolver) 387 static void appendRunsForObject(int start, int end, RenderObject* obj, InlineBid iResolver& resolver)
388 { 388 {
389 if (start > end || obj->isFloating() || 389 if (start > end || obj->isFloating() ||
390 (obj->isPositioned() && !obj->hasStaticX() && !obj->hasStaticY() && !obj ->container()->isRenderInline())) 390 (obj->isPositioned() && !obj->style()->hasStaticX() && !obj->style()->ha sStaticY() && !obj->container()->isRenderInline()))
391 return; 391 return;
392 392
393 bool haveNextMidpoint = (sCurrMidpoint < sNumMidpoints); 393 bool haveNextMidpoint = (sCurrMidpoint < sNumMidpoints);
394 InlineIterator nextMidpoint; 394 InlineIterator nextMidpoint;
395 if (haveNextMidpoint) 395 if (haveNextMidpoint)
396 nextMidpoint = smidpoints->at(sCurrMidpoint); 396 nextMidpoint = smidpoints->at(sCurrMidpoint);
397 if (betweenMidpoints) { 397 if (betweenMidpoints) {
398 if (!(haveNextMidpoint && nextMidpoint.obj == obj)) 398 if (!(haveNextMidpoint && nextMidpoint.obj == obj))
399 return; 399 return;
400 // This is a new start point. Stop ignoring objects and 400 // This is a new start point. Stop ignoring objects and
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 // We want to skip ahead to the first dirty line 834 // We want to skip ahead to the first dirty line
835 InlineBidiResolver resolver; 835 InlineBidiResolver resolver;
836 unsigned floatIndex; 836 unsigned floatIndex;
837 bool firstLine = true; 837 bool firstLine = true;
838 RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, resolver, floats, floatIndex); 838 RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, resolver, floats, floatIndex);
839 839
840 if (fullLayout && !selfNeedsLayout()) { 840 if (fullLayout && !selfNeedsLayout()) {
841 setNeedsLayout(true, false); // Mark ourselves as needing a full la yout. This way we'll repaint like 841 setNeedsLayout(true, false); // Mark ourselves as needing a full la yout. This way we'll repaint like
842 // we're supposed to. 842 // we're supposed to.
843 RenderView* v = view(); 843 RenderView* v = view();
844 if (v && !v->doingFullRepaint() && m_layer) { 844 if (v && !v->doingFullRepaint() && hasLayer()) {
845 // Because we waited until we were already inside layout to disc over 845 // Because we waited until we were already inside layout to disc over
846 // that the block really needed a full layout, we missed our cha nce to repaint the layer 846 // that the block really needed a full layout, we missed our cha nce to repaint the layer
847 // before layout started. Luckily the layer has cached the repa int rect for its original 847 // before layout started. Luckily the layer has cached the repa int rect for its original
848 // position and size, and so we can use that to make a repaint h appen now. 848 // position and size, and so we can use that to make a repaint h appen now.
849 repaintUsingContainer(containerForRepaint(), m_layer->repaintRec t()); 849 repaintUsingContainer(containerForRepaint(), layer()->repaintRec t());
850 } 850 }
851 } 851 }
852 852
853 FloatingObject* lastFloat = m_floatingObjects ? m_floatingObjects->last( ) : 0; 853 FloatingObject* lastFloat = m_floatingObjects ? m_floatingObjects->last( ) : 0;
854 854
855 if (!smidpoints) 855 if (!smidpoints)
856 smidpoints = new Vector<InlineIterator>(); 856 smidpoints = new Vector<InlineIterator>();
857 857
858 sNumMidpoints = 0; 858 sNumMidpoints = 0;
859 sCurrMidpoint = 0; 859 sCurrMidpoint = 0;
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 if (object->isFloating()) { 1431 if (object->isFloating()) {
1432 insertFloatingObject(toRenderBox(object)); 1432 insertFloatingObject(toRenderBox(object));
1433 } else if (object->isPositioned()) { 1433 } else if (object->isPositioned()) {
1434 // FIXME: The math here is actually not really right. It's a best-g uess approximation that 1434 // FIXME: The math here is actually not really right. It's a best-g uess approximation that
1435 // will work for the common cases 1435 // will work for the common cases
1436 RenderObject* c = object->container(); 1436 RenderObject* c = object->container();
1437 if (c->isRenderInline()) { 1437 if (c->isRenderInline()) {
1438 // A relative positioned inline encloses us. In this case, we a lso have to determine our 1438 // A relative positioned inline encloses us. In this case, we a lso have to determine our
1439 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned 1439 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned
1440 // inline so that we can obtain the value later. 1440 // inline so that we can obtain the value later.
1441 c->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false)); 1441 toRenderInline(c)->layer()->setStaticX(style()->direction() == L TR ? leftOffset(height(), false) : rightOffset(height(), false));
1442 c->setStaticY(height()); 1442 toRenderInline(c)->layer()->setStaticY(height());
1443 } 1443 }
1444 1444
1445 if (object->hasStaticX()) { 1445 RenderBox* box = toRenderBox(object);
1446 if (object->style()->isOriginalDisplayInlineType()) 1446 if (box->style()->hasStaticX()) {
1447 object->setStaticX(style()->direction() == LTR ? leftOffset( height(), false) : width() - rightOffset(height(), false)); 1447 if (box->style()->isOriginalDisplayInlineType())
1448 box->layer()->setStaticX(style()->direction() == LTR ? leftO ffset(height(), false) : width() - rightOffset(height(), false));
1448 else 1449 else
1449 object->setStaticX(style()->direction() == LTR ? borderLeft( ) + paddingLeft() : borderRight() + paddingRight()); 1450 box->layer()->setStaticX(style()->direction() == LTR ? borde rLeft() + paddingLeft() : borderRight() + paddingRight());
1450 } 1451 }
1451 1452
1452 if (object->hasStaticY()) 1453 if (box->style()->hasStaticY())
1453 object->setStaticY(height()); 1454 box->layer()->setStaticY(height());
1454 } 1455 }
1455 iterator.increment(); 1456 iterator.increment();
1456 } 1457 }
1457 } 1458 }
1458 1459
1459 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL ine) 1460 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL ine)
1460 { 1461 {
1461 int availableWidth = lineWidth(height(), firstLine); 1462 int availableWidth = lineWidth(height(), firstLine);
1462 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position()) ) { 1463 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position()) ) {
1463 RenderObject* object = resolver.position().obj; 1464 RenderObject* object = resolver.position().obj;
1464 if (object->isFloating()) { 1465 if (object->isFloating()) {
1465 insertFloatingObject(toRenderBox(object)); 1466 insertFloatingObject(toRenderBox(object));
1466 positionNewFloats(); 1467 positionNewFloats();
1467 availableWidth = lineWidth(height(), firstLine); 1468 availableWidth = lineWidth(height(), firstLine);
1468 } else if (object->isPositioned()) { 1469 } else if (object->isPositioned()) {
1469 // FIXME: The math here is actually not really right. It's a best-g uess approximation that 1470 // FIXME: The math here is actually not really right. It's a best-g uess approximation that
1470 // will work for the common cases 1471 // will work for the common cases
1471 RenderObject* c = object->container(); 1472 RenderObject* c = object->container();
1472 if (c->isRenderInline()) { 1473 if (c->isRenderInline()) {
1473 // A relative positioned inline encloses us. In this case, we a lso have to determine our 1474 // A relative positioned inline encloses us. In this case, we a lso have to determine our
1474 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned 1475 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned
1475 // inline so that we can obtain the value later. 1476 // inline so that we can obtain the value later.
1476 c->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine)); 1477 toRenderInline(c)->layer()->setStaticX(style()->direction() == L TR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine));
1477 c->setStaticY(height()); 1478 toRenderInline(c)->layer()->setStaticY(height());
1478 } 1479 }
1479 1480
1480 if (object->hasStaticX()) { 1481 RenderBox* box = toRenderBox(object);
1482 if (box->style()->hasStaticX()) {
1481 if (object->style()->isOriginalDisplayInlineType()) 1483 if (object->style()->isOriginalDisplayInlineType())
1482 object->setStaticX(style()->direction() == LTR ? leftOffset( height(), firstLine) : width() - rightOffset(height(), firstLine)); 1484 box->layer()->setStaticX(style()->direction() == LTR ? leftO ffset(height(), firstLine) : width() - rightOffset(height(), firstLine));
1483 else 1485 else
1484 object->setStaticX(style()->direction() == LTR ? borderLeft( ) + paddingLeft() : borderRight() + paddingRight()); 1486 box->layer()->setStaticX(style()->direction() == LTR ? borde rLeft() + paddingLeft() : borderRight() + paddingRight());
1485 } 1487 }
1486 1488
1487 if (object->hasStaticY()) 1489 if (box->style()->hasStaticY())
1488 object->setStaticY(height()); 1490 box->layer()->setStaticY(height());
1489 } 1491 }
1490 resolver.increment(); 1492 resolver.increment();
1491 } 1493 }
1492 resolver.commitExplicitEmbedding(); 1494 resolver.commitExplicitEmbedding();
1493 return availableWidth; 1495 return availableWidth;
1494 } 1496 }
1495 1497
1496 // This is currently just used for list markers and inline flows that have line boxes. Neither should 1498 // This is currently just used for list markers and inline flows that have line boxes. Neither should
1497 // have an effect on whitespace at the start of the line. 1499 // have an effect on whitespace at the start of the line.
1498 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObjec t* o) 1500 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObjec t* o)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 // If it does, position it now, otherwise, position 1637 // If it does, position it now, otherwise, position
1636 // it after moving to next line (in newLine() func) 1638 // it after moving to next line (in newLine() func)
1637 if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft( ) + floatBox->marginRight() + w + tmpW <= width) { 1639 if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft( ) + floatBox->marginRight() + w + tmpW <= width) {
1638 positionNewFloats(); 1640 positionNewFloats();
1639 width = lineWidth(height(), firstLine); 1641 width = lineWidth(height(), firstLine);
1640 } else 1642 } else
1641 floatsFitOnLine = false; 1643 floatsFitOnLine = false;
1642 } else if (o->isPositioned()) { 1644 } else if (o->isPositioned()) {
1643 // If our original display wasn't an inline type, then we can 1645 // If our original display wasn't an inline type, then we can
1644 // go ahead and determine our static x position now. 1646 // go ahead and determine our static x position now.
1645 bool isInlineType = o->style()->isOriginalDisplayInlineType(); 1647 RenderBox* box = toRenderBox(o);
1646 bool needToSetStaticX = o->hasStaticX(); 1648 bool isInlineType = box->style()->isOriginalDisplayInlineType();
1647 if (o->hasStaticX() && !isInlineType) { 1649 bool needToSetStaticX = box->style()->hasStaticX();
1648 o->setStaticX(o->parent()->style()->direction() == LTR ? 1650 if (box->style()->hasStaticX() && !isInlineType) {
1651 box->layer()->setStaticX(o->parent()->style()->direction() = = LTR ?
1649 borderLeft() + paddingLeft() : 1652 borderLeft() + paddingLeft() :
1650 borderRight() + paddingRight()); 1653 borderRight() + paddingRight());
1651 needToSetStaticX = false; 1654 needToSetStaticX = false;
1652 } 1655 }
1653 1656
1654 // If our original display was an INLINE type, then we can go ah ead 1657 // If our original display was an INLINE type, then we can go ah ead
1655 // and determine our static y position now. 1658 // and determine our static y position now.
1656 bool needToSetStaticY = o->hasStaticY(); 1659 bool needToSetStaticY = box->style()->hasStaticY();
1657 if (o->hasStaticY() && isInlineType) { 1660 if (box->style()->hasStaticY() && isInlineType) {
1658 o->setStaticY(height()); 1661 box->layer()->setStaticY(height());
1659 needToSetStaticY = false; 1662 needToSetStaticY = false;
1660 } 1663 }
1661 1664
1662 bool needToCreateLineBox = needToSetStaticX || needToSetStaticY; 1665 bool needToCreateLineBox = needToSetStaticX || needToSetStaticY;
1663 RenderObject* c = o->container(); 1666 RenderObject* c = o->container();
1664 if (c->isRenderInline() && (!needToSetStaticX || !needToSetStati cY)) 1667 if (c->isRenderInline() && (!needToSetStaticX || !needToSetStati cY))
1665 needToCreateLineBox = true; 1668 needToCreateLineBox = true;
1666 1669
1667 // If we're ignoring spaces, we have to stop and include this ob ject and 1670 // If we're ignoring spaces, we have to stop and include this ob ject and
1668 // then start ignoring spaces again. 1671 // then start ignoring spaces again.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 // space. 2199 // space.
2197 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth; 2200 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth;
2198 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) ) 2201 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) )
2199 curr->placeEllipsis(ellipsisStr, ltr, blockEdge, width); 2202 curr->placeEllipsis(ellipsisStr, ltr, blockEdge, width);
2200 } 2203 }
2201 } 2204 }
2202 } 2205 }
2203 2206
2204 } 2207 }
2205 2208
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderWidget.cpp ('k') | third_party/WebKit/WebCore/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698