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

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

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 RenderLayer*& beforeChild) 422 RenderLayer*& beforeChild)
423 { 423 {
424 if (obj->hasLayer()) { 424 if (obj->hasLayer()) {
425 if (!beforeChild && newObject) { 425 if (!beforeChild && newObject) {
426 // We need to figure out the layer that follows newObject. We only do 426 // We need to figure out the layer that follows newObject. We only do
427 // this the first time we find a child layer, and then we update the 427 // this the first time we find a child layer, and then we update the
428 // pointer values for newObject and beforeChild used by everyone els e. 428 // pointer values for newObject and beforeChild used by everyone els e.
429 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect); 429 beforeChild = newObject->parent()->findNextLayer(parentLayer, newObj ect);
430 newObject = 0; 430 newObject = 0;
431 } 431 }
432 parentLayer->addChild(toRenderBox(obj)->layer(), beforeChild); 432 parentLayer->addChild(toRenderBoxModelObject(obj)->layer(), beforeChild) ;
433 return; 433 return;
434 } 434 }
435 435
436 for (RenderObject* curr = obj->firstChild(); curr; curr = curr->nextSibling( )) 436 for (RenderObject* curr = obj->firstChild(); curr; curr = curr->nextSibling( ))
437 addLayers(curr, parentLayer, newObject, beforeChild); 437 addLayers(curr, parentLayer, newObject, beforeChild);
438 } 438 }
439 439
440 void RenderObject::addLayers(RenderLayer* parentLayer, RenderObject* newObject) 440 void RenderObject::addLayers(RenderLayer* parentLayer, RenderObject* newObject)
441 { 441 {
442 if (!parentLayer) 442 if (!parentLayer)
443 return; 443 return;
444 444
445 RenderObject* object = newObject; 445 RenderObject* object = newObject;
446 RenderLayer* beforeChild = 0; 446 RenderLayer* beforeChild = 0;
447 WebCore::addLayers(this, parentLayer, object, beforeChild); 447 WebCore::addLayers(this, parentLayer, object, beforeChild);
448 } 448 }
449 449
450 void RenderObject::removeLayers(RenderLayer* parentLayer) 450 void RenderObject::removeLayers(RenderLayer* parentLayer)
451 { 451 {
452 if (!parentLayer) 452 if (!parentLayer)
453 return; 453 return;
454 454
455 if (hasLayer()) { 455 if (hasLayer()) {
456 parentLayer->removeChild(toRenderBox(this)->layer()); 456 parentLayer->removeChild(toRenderBoxModelObject(this)->layer());
457 return; 457 return;
458 } 458 }
459 459
460 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 460 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
461 curr->removeLayers(parentLayer); 461 curr->removeLayers(parentLayer);
462 } 462 }
463 463
464 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent) 464 void RenderObject::moveLayers(RenderLayer* oldParent, RenderLayer* newParent)
465 { 465 {
466 if (!newParent) 466 if (!newParent)
467 return; 467 return;
468 468
469 if (hasLayer()) { 469 if (hasLayer()) {
470 RenderLayer* layer = toRenderBox(this)->layer(); 470 RenderLayer* layer = toRenderBoxModelObject(this)->layer();
471 if (oldParent) 471 if (oldParent)
472 oldParent->removeChild(layer); 472 oldParent->removeChild(layer);
473 newParent->addChild(layer); 473 newParent->addChild(layer);
474 return; 474 return;
475 } 475 }
476 476
477 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) 477 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
478 curr->moveLayers(oldParent, newParent); 478 curr->moveLayers(oldParent, newParent);
479 } 479 }
480 480
481 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, 481 RenderLayer* RenderObject::findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint,
482 bool checkParent) 482 bool checkParent)
483 { 483 {
484 // Error check the parent layer passed in. If it's null, we can't find anyt hing. 484 // Error check the parent layer passed in. If it's null, we can't find anyt hing.
485 if (!parentLayer) 485 if (!parentLayer)
486 return 0; 486 return 0;
487 487
488 // Step 1: If our layer is a child of the desired parent, then return our la yer. 488 // Step 1: If our layer is a child of the desired parent, then return our la yer.
489 RenderLayer* ourLayer = hasLayer() ? toRenderBox(this)->layer() : 0; 489 RenderLayer* ourLayer = hasLayer() ? toRenderBoxModelObject(this)->layer() : 0;
490 if (ourLayer && ourLayer->parent() == parentLayer) 490 if (ourLayer && ourLayer->parent() == parentLayer)
491 return ourLayer; 491 return ourLayer;
492 492
493 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend 493 // Step 2: If we don't have a layer, or our layer is the desired parent, the n descend
494 // into our siblings trying to find the next layer whose parent is the desir ed parent. 494 // into our siblings trying to find the next layer whose parent is the desir ed parent.
495 if (!ourLayer || ourLayer == parentLayer) { 495 if (!ourLayer || ourLayer == parentLayer) {
496 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : first Child(); 496 for (RenderObject* curr = startPoint ? startPoint->nextSibling() : first Child();
497 curr; curr = curr->nextSibling()) { 497 curr; curr = curr->nextSibling()) {
498 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false); 498 RenderLayer* nextLayer = curr->findNextLayer(parentLayer, 0, false);
499 if (nextLayer) 499 if (nextLayer)
(...skipping 11 matching lines...) Expand all
511 if (checkParent && parent()) 511 if (checkParent && parent())
512 return parent()->findNextLayer(parentLayer, this, true); 512 return parent()->findNextLayer(parentLayer, this, true);
513 513
514 return 0; 514 return 0;
515 } 515 }
516 516
517 RenderLayer* RenderObject::enclosingLayer() const 517 RenderLayer* RenderObject::enclosingLayer() const
518 { 518 {
519 const RenderObject* curr = this; 519 const RenderObject* curr = this;
520 while (curr) { 520 while (curr) {
521 RenderLayer* layer = curr->hasLayer() ? toRenderBox(curr)->layer() : 0; 521 RenderLayer* layer = curr->hasLayer() ? toRenderBoxModelObject(curr)->la yer() : 0;
522 if (layer) 522 if (layer)
523 return layer; 523 return layer;
524 curr = curr->parent(); 524 curr = curr->parent();
525 } 525 }
526 return 0; 526 return 0;
527 } 527 }
528 528
529 #if USE(ACCELERATED_COMPOSITING) 529 #if USE(ACCELERATED_COMPOSITING)
530 RenderLayer* RenderObject::enclosingCompositingLayer() const 530 RenderLayer* RenderObject::enclosingCompositingLayer() const
531 { 531 {
532 const RenderObject* curr = this; 532 const RenderObject* curr = this;
533 while (curr) { 533 while (curr) {
534 RenderLayer* layer = curr->hasLayer() ? toRenderBox(curr)->layer() : 0; 534 RenderLayer* layer = curr->hasLayer() ? toRenderBoxModelObject(curr)->la yer() : 0;
535 if (layer && layer->isComposited()) 535 if (layer && layer->isComposited())
536 return layer; 536 return layer;
537 curr = curr->parent(); 537 curr = curr->parent();
538 } 538 }
539 return 0; 539 return 0;
540 } 540 }
541 #endif 541 #endif
542 542
543 RenderBox* RenderObject::enclosingBox() const 543 RenderBox* RenderObject::enclosingBox() const
544 { 544 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 if (o->style()->position() == FixedPosition || o->style()->position() == AbsolutePosition) 576 if (o->style()->position() == FixedPosition || o->style()->position() == AbsolutePosition)
577 // A positioned object has no effect on the min/max width of its con taining block ever. 577 // A positioned object has no effect on the min/max width of its con taining block ever.
578 // We can optimize this case and not go up any further. 578 // We can optimize this case and not go up any further.
579 break; 579 break;
580 o = o->isTableCell() ? o->containingBlock() : o->container(); 580 o = o->isTableCell() ? o->containingBlock() : o->container();
581 } 581 }
582 } 582 }
583 583
584 void RenderObject::setLayerNeedsFullRepaint() 584 void RenderObject::setLayerNeedsFullRepaint()
585 { 585 {
586 toRenderBox(this)->layer()->setNeedsFullRepaint(true); 586 ASSERT(hasLayer());
587 toRenderBoxModelObject(this)->layer()->setNeedsFullRepaint(true);
587 } 588 }
588 589
589 RenderBlock* RenderObject::containingBlock() const 590 RenderBlock* RenderObject::containingBlock() const
590 { 591 {
591 if (isTableCell()) { 592 if (isTableCell()) {
592 const RenderTableCell* cell = static_cast<const RenderTableCell*>(this); 593 const RenderTableCell* cell = static_cast<const RenderTableCell*>(this);
593 if (parent() && cell->section()) 594 if (parent() && cell->section())
594 return cell->table(); 595 return cell->table();
595 return 0; 596 return 0;
596 } 597 }
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 drawBorder(graphicsContext, tx + w, ty - ow, tx + w + ow, ty + h + ow, 1543 drawBorder(graphicsContext, tx + w, ty - ow, tx + w + ow, ty + h + ow,
1543 BSRight, Color(oc), style->color(), os, ow, ow); 1544 BSRight, Color(oc), style->color(), os, ow, ow);
1544 1545
1545 drawBorder(graphicsContext, tx - ow, ty + h, tx + w + ow, ty + h + ow, 1546 drawBorder(graphicsContext, tx - ow, ty + h, tx + w + ow, ty + h + ow,
1546 BSBottom, Color(oc), style->color(), os, ow, ow); 1547 BSBottom, Color(oc), style->color(), os, ow, ow);
1547 } 1548 }
1548 1549
1549 1550
1550 void RenderObject::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool) 1551 void RenderObject::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool)
1551 { 1552 {
1552 if (!virtualChildren()->firstChild()) { 1553 if (!firstChild()) {
1553 if ((isInline() || isAnonymousBlock())) { 1554 if ((isInline() || isAnonymousBlock())) {
1554 FloatPoint absPos = localToAbsolute(FloatPoint()); 1555 FloatPoint absPos = localToAbsolute(FloatPoint());
1555 absoluteRects(rects, absPos.x(), absPos.y()); 1556 absoluteRects(rects, absPos.x(), absPos.y());
1556 } 1557 }
1557 return; 1558 return;
1558 } 1559 }
1559 1560
1560 unsigned offset = start; 1561 unsigned offset = start;
1561 for (RenderObject* child = childAt(start); child && offset < end; child = ch ild->nextSibling(), ++offset) { 1562 for (RenderObject* child = childAt(start); child && offset < end; child = ch ild->nextSibling(), ++offset) {
1562 if (child->isText() || child->isInline() || child->isAnonymousBlock()) { 1563 if (child->isText() || child->isInline() || child->isAnonymousBlock()) {
1563 FloatPoint absPos = child->localToAbsolute(FloatPoint()); 1564 FloatPoint absPos = child->localToAbsolute(FloatPoint());
1564 child->absoluteRects(rects, absPos.x(), absPos.y()); 1565 child->absoluteRects(rects, absPos.x(), absPos.y());
1565 } 1566 }
1566 } 1567 }
1567 } 1568 }
1568 1569
1569 void RenderObject::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned star t, unsigned end, bool) 1570 void RenderObject::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned star t, unsigned end, bool)
1570 { 1571 {
1571 if (!virtualChildren()->firstChild()) { 1572 if (!firstChild()) {
1572 if (isInline() || isAnonymousBlock()) 1573 if (isInline() || isAnonymousBlock())
1573 absoluteQuads(quads); 1574 absoluteQuads(quads);
1574 return; 1575 return;
1575 } 1576 }
1576 1577
1577 unsigned offset = start; 1578 unsigned offset = start;
1578 for (RenderObject* child = childAt(start); child && offset < end; child = ch ild->nextSibling(), ++offset) { 1579 for (RenderObject* child = childAt(start); child && offset < end; child = ch ild->nextSibling(), ++offset) {
1579 if (child->isText() || child->isInline() || child->isAnonymousBlock()) 1580 if (child->isText() || child->isInline() || child->isAnonymousBlock())
1580 child->absoluteQuads(quads); 1581 child->absoluteQuads(quads);
1581 } 1582 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); 1660 repaintContainer->layer()->setBackingNeedsRepaintInRect(r);
1660 } 1661 }
1661 #else 1662 #else
1662 ASSERT_NOT_REACHED(); 1663 ASSERT_NOT_REACHED();
1663 #endif 1664 #endif
1664 } 1665 }
1665 } 1666 }
1666 1667
1667 void RenderObject::repaint(bool immediate) 1668 void RenderObject::repaint(bool immediate)
1668 { 1669 {
1669 // Can't use view(), since we might be unrooted. 1670 // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
1670 RenderObject* o = this; 1671 RenderView* view;
1671 while (o->parent()) 1672 if (!isRooted(&view))
1672 o = o->parent();
1673 if (!o->isRenderView())
1674 return; 1673 return;
1675 1674
1676 RenderView* view = toRenderView(o);
1677 if (view->printing()) 1675 if (view->printing())
1678 return; // Don't repaint if we're printing. 1676 return; // Don't repaint if we're printing.
1679 1677
1680 RenderBoxModelObject* repaintContainer = containerForRepaint(); 1678 RenderBoxModelObject* repaintContainer = containerForRepaint();
1681 repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOve rflowRectForRepaint(repaintContainer), immediate); 1679 repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOve rflowRectForRepaint(repaintContainer), immediate);
1682 } 1680 }
1683 1681
1684 void RenderObject::repaintRectangle(const IntRect& r, bool immediate) 1682 void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
1685 { 1683 {
1686 // Can't use view(), since we might be unrooted. 1684 // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
1687 RenderObject* o = this; 1685 RenderView* view;
1688 while (o->parent()) 1686 if (!isRooted(&view))
1689 o = o->parent();
1690 if (!o->isRenderView())
1691 return; 1687 return;
1692 1688
1693 RenderView* view = toRenderView(o);
1694 if (view->printing()) 1689 if (view->printing())
1695 return; // Don't repaint if we're printing. 1690 return; // Don't repaint if we're printing.
1696 1691
1697 IntRect dirtyRect(r); 1692 IntRect dirtyRect(r);
1698 1693
1699 // FIXME: layoutDelta needs to be applied in parts before/after transforms a nd 1694 // FIXME: layoutDelta needs to be applied in parts before/after transforms a nd
1700 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 1695 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
1701 dirtyRect.move(view->layoutDelta()); 1696 dirtyRect.move(view->layoutDelta());
1702 1697
1703 RenderBoxModelObject* repaintContainer = containerForRepaint(); 1698 RenderBoxModelObject* repaintContainer = containerForRepaint();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 } 1964 }
1970 1965
1971 void RenderObject::handleDynamicFloatPositionChange() 1966 void RenderObject::handleDynamicFloatPositionChange()
1972 { 1967 {
1973 // We have gone from not affecting the inline status of the parent flow to s uddenly 1968 // We have gone from not affecting the inline status of the parent flow to s uddenly
1974 // having an impact. See if there is a mismatch between the parent flow's 1969 // having an impact. See if there is a mismatch between the parent flow's
1975 // childrenInline() state and our state. 1970 // childrenInline() state and our state.
1976 setInline(style()->isDisplayInlineType()); 1971 setInline(style()->isDisplayInlineType());
1977 if (isInline() != parent()->childrenInline()) { 1972 if (isInline() != parent()->childrenInline()) {
1978 if (!isInline()) 1973 if (!isInline())
1979 toRenderBox(parent())->childBecameNonInline(this); 1974 toRenderBoxModelObject(parent())->childBecameNonInline(this);
1980 else { 1975 else {
1981 // An anonymous block must be made to wrap this inline. 1976 // An anonymous block must be made to wrap this inline.
1982 RenderBlock* block = createAnonymousBlock(); 1977 RenderBlock* block = createAnonymousBlock();
1983 RenderObjectChildList* childlist = parent()->virtualChildren(); 1978 RenderObjectChildList* childlist = parent()->virtualChildren();
1984 childlist->insertChildNode(parent(), block, this); 1979 childlist->insertChildNode(parent(), block, this);
1985 block->children()->appendChildNode(block, childlist->removeChildNode (parent(), this)); 1980 block->children()->appendChildNode(block, childlist->removeChildNode (parent(), this));
1986 } 1981 }
1987 } 1982 }
1988 } 1983 }
1989 1984
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 *extraWidthToEndOfLine = 0; 2199 *extraWidthToEndOfLine = 0;
2205 2200
2206 return IntRect(); 2201 return IntRect();
2207 } 2202 }
2208 2203
2209 RenderView* RenderObject::view() const 2204 RenderView* RenderObject::view() const
2210 { 2205 {
2211 return toRenderView(document()->renderer()); 2206 return toRenderView(document()->renderer());
2212 } 2207 }
2213 2208
2209 bool RenderObject::isRooted(RenderView** view)
2210 {
2211 RenderObject* o = this;
2212 while (o->parent())
2213 o = o->parent();
2214
2215 if (!o->isRenderView())
2216 return false;
2217
2218 if (view)
2219 *view = toRenderView(o);
2220
2221 return true;
2222 }
2223
2214 bool RenderObject::hasOutlineAnnotation() const 2224 bool RenderObject::hasOutlineAnnotation() const
2215 { 2225 {
2216 return element() && element()->isLink() && document()->printing(); 2226 return element() && element()->isLink() && document()->printing();
2217 } 2227 }
2218 2228
2219 RenderObject* RenderObject::container() const 2229 RenderObject* RenderObject::container() const
2220 { 2230 {
2221 // This method is extremely similar to containingBlock(), but with a few not able 2231 // This method is extremely similar to containingBlock(), but with a few not able
2222 // exceptions. 2232 // exceptions.
2223 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when 2233 // (1) It can be used on orphaned subtrees, i.e., it can be called safely ev en when
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 document()->axObjectCache()->remove(this); 2290 document()->axObjectCache()->remove(this);
2281 } 2291 }
2282 animation()->cancelAnimations(this); 2292 animation()->cancelAnimations(this);
2283 2293
2284 // By default no ref-counting. RenderWidget::destroy() doesn't call 2294 // By default no ref-counting. RenderWidget::destroy() doesn't call
2285 // this function because it needs to do ref-counting. If anything 2295 // this function because it needs to do ref-counting. If anything
2286 // in this function changes, be sure to fix RenderWidget::destroy() as well. 2296 // in this function changes, be sure to fix RenderWidget::destroy() as well.
2287 2297
2288 remove(); 2298 remove();
2289 2299
2290 // FIXME: Would like to do this in RenderBox, but the timing is so complicat ed that this can't easily 2300 // FIXME: Would like to do this in RenderBoxModelObject, but the timing is s o complicated that this can't easily
2291 // be moved into RenderBox::destroy. 2301 // be moved into RenderBoxModelObject::destroy.
2292 RenderArena* arena = renderArena(); 2302 RenderArena* arena = renderArena();
2293 if (hasLayer()) 2303 if (hasLayer())
2294 toRenderBox(this)->layer()->destroy(arena); 2304 toRenderBoxModelObject(this)->layer()->destroy(arena);
2295 arenaDelete(arena, this); 2305 arenaDelete(arena, this);
2296 } 2306 }
2297 2307
2298 void RenderObject::arenaDelete(RenderArena* arena, void* base) 2308 void RenderObject::arenaDelete(RenderArena* arena, void* base)
2299 { 2309 {
2300 if (m_style) { 2310 if (m_style) {
2301 for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bg Layer = bgLayer->next()) { 2311 for (const FillLayer* bgLayer = m_style->backgroundLayers(); bgLayer; bg Layer = bgLayer->next()) {
2302 if (StyleImage* backgroundImage = bgLayer->image()) 2312 if (StyleImage* backgroundImage = bgLayer->image())
2303 backgroundImage->removeClient(this); 2313 backgroundImage->removeClient(this);
2304 } 2314 }
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 AnimationController* RenderObject::animation() const 2792 AnimationController* RenderObject::animation() const
2783 { 2793 {
2784 return document()->frame()->animation(); 2794 return document()->frame()->animation();
2785 } 2795 }
2786 2796
2787 void RenderObject::imageChanged(CachedImage* image, const IntRect* rect) 2797 void RenderObject::imageChanged(CachedImage* image, const IntRect* rect)
2788 { 2798 {
2789 imageChanged(static_cast<WrappedImagePtr>(image), rect); 2799 imageChanged(static_cast<WrappedImagePtr>(image), rect);
2790 } 2800 }
2791 2801
2802 RenderBoxModelObject* RenderObject::offsetParent() const
2803 {
2804 // If any of the following holds true return null and stop this algorithm:
2805 // A is the root element.
2806 // A is the HTML body element.
2807 // The computed value of the position property for element A is fixed.
2808 if (isRoot() || isBody() || (isPositioned() && style()->position() == FixedP osition))
2809 return 0;
2810
2811 // If A is an area HTML element which has a map HTML element somewhere in th e ancestor
2812 // chain return the nearest ancestor map HTML element and stop this algorith m.
2813 // FIXME: Implement!
2814
2815 // Return the nearest ancestor element of A for which at least one of the fo llowing is
2816 // true and stop this algorithm if such an ancestor is found:
2817 // * The computed value of the position property is not static.
2818 // * It is the HTML body element.
2819 // * The computed value of the position property of A is static and the ancestor
2820 // is one of the following HTML elements: td, th, or table.
2821 // * Our own extension: if there is a difference in the effective zoom
2822 bool skipTables = isPositioned() || isRelPositioned();
2823 float currZoom = style()->effectiveZoom();
2824 RenderObject* curr = parent();
2825 while (curr && (!curr->element() ||
2826 (!curr->isPositioned() && !curr->isRelPositioned() && !curr- >isBody()))) {
2827 Node* element = curr->element();
2828 if (!skipTables && element) {
2829 bool isTableElement = element->hasTagName(tableTag) ||
2830 element->hasTagName(tdTag) ||
2831 element->hasTagName(thTag);
2832
2833 #if ENABLE(WML)
2834 if (!isTableElement && element->isWMLElement())
2835 isTableElement = element->hasTagName(WMLNames::tableTag) ||
2836 element->hasTagName(WMLNames::tdTag);
2837 #endif
2838
2839 if (isTableElement)
2840 break;
2841 }
2842
2843 float newZoom = curr->style()->effectiveZoom();
2844 if (currZoom != newZoom)
2845 break;
2846 currZoom = newZoom;
2847 curr = curr->parent();
2848 }
2849 return curr && curr->isBox() ? toRenderBox(curr) : 0;
2850 }
2851
2792 #if ENABLE(SVG) 2852 #if ENABLE(SVG)
2793 2853
2794 FloatRect RenderObject::relativeBBox(bool) const 2854 FloatRect RenderObject::relativeBBox(bool) const
2795 { 2855 {
2796 return FloatRect(); 2856 return FloatRect();
2797 } 2857 }
2798 2858
2799 TransformationMatrix RenderObject::localTransform() const 2859 TransformationMatrix RenderObject::localTransform() const
2800 { 2860 {
2801 return TransformationMatrix(); 2861 return TransformationMatrix();
(...skipping 13 matching lines...) Expand all
2815 #ifndef NDEBUG 2875 #ifndef NDEBUG
2816 2876
2817 void showTree(const WebCore::RenderObject* ro) 2877 void showTree(const WebCore::RenderObject* ro)
2818 { 2878 {
2819 if (ro) 2879 if (ro)
2820 ro->showTreeForThis(); 2880 ro->showTreeForThis();
2821 } 2881 }
2822 2882
2823 #endif 2883 #endif
2824 2884
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderObject.h ('k') | third_party/WebKit/WebCore/rendering/RenderPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698