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

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

Issue 21165: Revert the merge. Mac build is mysteriously broken. (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->style()->hasStaticX() && !obj->style()->ha sStaticY() && !obj->container()->isRenderInline())) 390 (obj->isPositioned() && !obj->hasStaticX() && !obj->hasStaticY() && !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() && hasLayer()) { 844 if (v && !v->doingFullRepaint() && m_layer) {
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(), layer()->repaintRec t()); 849 repaintUsingContainer(containerForRepaint(), m_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 toRenderInline(c)->layer()->setStaticX(style()->direction() == L TR ? leftOffset(height(), false) : rightOffset(height(), false)); 1441 c->setStaticX(style()->direction() == LTR ? leftOffset(height(), false) : rightOffset(height(), false));
1442 toRenderInline(c)->layer()->setStaticY(height()); 1442 c->setStaticY(height());
1443 } 1443 }
1444 1444
1445 RenderBox* box = toRenderBox(object); 1445 if (object->hasStaticX()) {
1446 if (box->style()->hasStaticX()) { 1446 if (object->style()->isOriginalDisplayInlineType())
1447 if (box->style()->isOriginalDisplayInlineType()) 1447 object->setStaticX(style()->direction() == LTR ? leftOffset( height(), false) : width() - rightOffset(height(), false));
1448 box->layer()->setStaticX(style()->direction() == LTR ? leftO ffset(height(), false) : width() - rightOffset(height(), false));
1449 else 1448 else
1450 box->layer()->setStaticX(style()->direction() == LTR ? borde rLeft() + paddingLeft() : borderRight() + paddingRight()); 1449 object->setStaticX(style()->direction() == LTR ? borderLeft( ) + paddingLeft() : borderRight() + paddingRight());
1451 } 1450 }
1452 1451
1453 if (box->style()->hasStaticY()) 1452 if (object->hasStaticY())
1454 box->layer()->setStaticY(height()); 1453 object->setStaticY(height());
1455 } 1454 }
1456 iterator.increment(); 1455 iterator.increment();
1457 } 1456 }
1458 } 1457 }
1459 1458
1460 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL ine) 1459 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL ine)
1461 { 1460 {
1462 int availableWidth = lineWidth(height(), firstLine); 1461 int availableWidth = lineWidth(height(), firstLine);
1463 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position()) ) { 1462 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position()) ) {
1464 RenderObject* object = resolver.position().obj; 1463 RenderObject* object = resolver.position().obj;
1465 if (object->isFloating()) { 1464 if (object->isFloating()) {
1466 insertFloatingObject(toRenderBox(object)); 1465 insertFloatingObject(toRenderBox(object));
1467 positionNewFloats(); 1466 positionNewFloats();
1468 availableWidth = lineWidth(height(), firstLine); 1467 availableWidth = lineWidth(height(), firstLine);
1469 } else if (object->isPositioned()) { 1468 } else if (object->isPositioned()) {
1470 // FIXME: The math here is actually not really right. It's a best-g uess approximation that 1469 // FIXME: The math here is actually not really right. It's a best-g uess approximation that
1471 // will work for the common cases 1470 // will work for the common cases
1472 RenderObject* c = object->container(); 1471 RenderObject* c = object->container();
1473 if (c->isRenderInline()) { 1472 if (c->isRenderInline()) {
1474 // A relative positioned inline encloses us. In this case, we a lso have to determine our 1473 // A relative positioned inline encloses us. In this case, we a lso have to determine our
1475 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned 1474 // position as though we were an inline. Set |staticX| and |sta ticY| on the relative positioned
1476 // inline so that we can obtain the value later. 1475 // inline so that we can obtain the value later.
1477 toRenderInline(c)->layer()->setStaticX(style()->direction() == L TR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine)); 1476 c->setStaticX(style()->direction() == LTR ? leftOffset(height(), firstLine) : rightOffset(height(), firstLine));
1478 toRenderInline(c)->layer()->setStaticY(height()); 1477 c->setStaticY(height());
1479 } 1478 }
1480 1479
1481 RenderBox* box = toRenderBox(object); 1480 if (object->hasStaticX()) {
1482 if (box->style()->hasStaticX()) {
1483 if (object->style()->isOriginalDisplayInlineType()) 1481 if (object->style()->isOriginalDisplayInlineType())
1484 box->layer()->setStaticX(style()->direction() == LTR ? leftO ffset(height(), firstLine) : width() - rightOffset(height(), firstLine)); 1482 object->setStaticX(style()->direction() == LTR ? leftOffset( height(), firstLine) : width() - rightOffset(height(), firstLine));
1485 else 1483 else
1486 box->layer()->setStaticX(style()->direction() == LTR ? borde rLeft() + paddingLeft() : borderRight() + paddingRight()); 1484 object->setStaticX(style()->direction() == LTR ? borderLeft( ) + paddingLeft() : borderRight() + paddingRight());
1487 } 1485 }
1488 1486
1489 if (box->style()->hasStaticY()) 1487 if (object->hasStaticY())
1490 box->layer()->setStaticY(height()); 1488 object->setStaticY(height());
1491 } 1489 }
1492 resolver.increment(); 1490 resolver.increment();
1493 } 1491 }
1494 resolver.commitExplicitEmbedding(); 1492 resolver.commitExplicitEmbedding();
1495 return availableWidth; 1493 return availableWidth;
1496 } 1494 }
1497 1495
1498 // This is currently just used for list markers and inline flows that have line boxes. Neither should 1496 // This is currently just used for list markers and inline flows that have line boxes. Neither should
1499 // have an effect on whitespace at the start of the line. 1497 // have an effect on whitespace at the start of the line.
1500 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObjec t* o) 1498 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObjec t* o)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 // If it does, position it now, otherwise, position 1635 // If it does, position it now, otherwise, position
1638 // it after moving to next line (in newLine() func) 1636 // it after moving to next line (in newLine() func)
1639 if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft( ) + floatBox->marginRight() + w + tmpW <= width) { 1637 if (floatsFitOnLine && floatBox->width() + floatBox->marginLeft( ) + floatBox->marginRight() + w + tmpW <= width) {
1640 positionNewFloats(); 1638 positionNewFloats();
1641 width = lineWidth(height(), firstLine); 1639 width = lineWidth(height(), firstLine);
1642 } else 1640 } else
1643 floatsFitOnLine = false; 1641 floatsFitOnLine = false;
1644 } else if (o->isPositioned()) { 1642 } else if (o->isPositioned()) {
1645 // If our original display wasn't an inline type, then we can 1643 // If our original display wasn't an inline type, then we can
1646 // go ahead and determine our static x position now. 1644 // go ahead and determine our static x position now.
1647 RenderBox* box = toRenderBox(o); 1645 bool isInlineType = o->style()->isOriginalDisplayInlineType();
1648 bool isInlineType = box->style()->isOriginalDisplayInlineType(); 1646 bool needToSetStaticX = o->hasStaticX();
1649 bool needToSetStaticX = box->style()->hasStaticX(); 1647 if (o->hasStaticX() && !isInlineType) {
1650 if (box->style()->hasStaticX() && !isInlineType) { 1648 o->setStaticX(o->parent()->style()->direction() == LTR ?
1651 box->layer()->setStaticX(o->parent()->style()->direction() = = LTR ?
1652 borderLeft() + paddingLeft() : 1649 borderLeft() + paddingLeft() :
1653 borderRight() + paddingRight()); 1650 borderRight() + paddingRight());
1654 needToSetStaticX = false; 1651 needToSetStaticX = false;
1655 } 1652 }
1656 1653
1657 // If our original display was an INLINE type, then we can go ah ead 1654 // If our original display was an INLINE type, then we can go ah ead
1658 // and determine our static y position now. 1655 // and determine our static y position now.
1659 bool needToSetStaticY = box->style()->hasStaticY(); 1656 bool needToSetStaticY = o->hasStaticY();
1660 if (box->style()->hasStaticY() && isInlineType) { 1657 if (o->hasStaticY() && isInlineType) {
1661 box->layer()->setStaticY(height()); 1658 o->setStaticY(height());
1662 needToSetStaticY = false; 1659 needToSetStaticY = false;
1663 } 1660 }
1664 1661
1665 bool needToCreateLineBox = needToSetStaticX || needToSetStaticY; 1662 bool needToCreateLineBox = needToSetStaticX || needToSetStaticY;
1666 RenderObject* c = o->container(); 1663 RenderObject* c = o->container();
1667 if (c->isRenderInline() && (!needToSetStaticX || !needToSetStati cY)) 1664 if (c->isRenderInline() && (!needToSetStaticX || !needToSetStati cY))
1668 needToCreateLineBox = true; 1665 needToCreateLineBox = true;
1669 1666
1670 // If we're ignoring spaces, we have to stop and include this ob ject and 1667 // If we're ignoring spaces, we have to stop and include this ob ject and
1671 // then start ignoring spaces again. 1668 // then start ignoring spaces again.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 // space. 2196 // space.
2200 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth; 2197 int width = curr == firstRootBox() ? firstLineEllipsisWidth : ellips isWidth;
2201 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) ) 2198 if (curr->canAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width) )
2202 curr->placeEllipsis(ellipsisStr, ltr, blockEdge, width); 2199 curr->placeEllipsis(ellipsisStr, ltr, blockEdge, width);
2203 } 2200 }
2204 } 2201 }
2205 } 2202 }
2206 2203
2207 } 2204 }
2208 2205
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