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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderObject.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) 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 551
552 ASSERT_NOT_REACHED(); 552 ASSERT_NOT_REACHED();
553 return 0; 553 return 0;
554 } 554 }
555 555
556 RenderBlock* RenderObject::firstLineBlock() const 556 RenderBlock* RenderObject::firstLineBlock() const
557 { 557 {
558 return 0; 558 return 0;
559 } 559 }
560 560
561 bool RenderObject::hasStaticX() const
562 {
563 return (style()->left().isAuto() && style()->right().isAuto()) || style()->l eft().isStatic() || style()->right().isStatic();
564 }
565
566 bool RenderObject::hasStaticY() const
567 {
568 return (style()->top().isAuto() && style()->bottom().isAuto()) || style()->t op().isStatic();
569 }
570
561 void RenderObject::setPrefWidthsDirty(bool b, bool markParents) 571 void RenderObject::setPrefWidthsDirty(bool b, bool markParents)
562 { 572 {
563 bool alreadyDirty = m_prefWidthsDirty; 573 bool alreadyDirty = m_prefWidthsDirty;
564 m_prefWidthsDirty = b; 574 m_prefWidthsDirty = b;
565 if (b && !alreadyDirty && markParents && (isText() || (style()->position() ! = FixedPosition && style()->position() != AbsolutePosition))) 575 if (b && !alreadyDirty && markParents && (isText() || (style()->position() ! = FixedPosition && style()->position() != AbsolutePosition)))
566 invalidateContainerPrefWidths(); 576 invalidateContainerPrefWidths();
567 } 577 }
568 578
569 void RenderObject::invalidateContainerPrefWidths() 579 void RenderObject::invalidateContainerPrefWidths()
570 { 580 {
(...skipping 18 matching lines...) Expand all
589 RenderBlock* RenderObject::containingBlock() const 599 RenderBlock* RenderObject::containingBlock() const
590 { 600 {
591 if (isTableCell()) { 601 if (isTableCell()) {
592 const RenderTableCell* cell = static_cast<const RenderTableCell*>(this); 602 const RenderTableCell* cell = static_cast<const RenderTableCell*>(this);
593 if (parent() && cell->section()) 603 if (parent() && cell->section())
594 return cell->table(); 604 return cell->table();
595 return 0; 605 return 0;
596 } 606 }
597 607
598 if (isRenderView()) 608 if (isRenderView())
599 return const_cast<RenderView*>(toRenderView(this)); 609 return const_cast<RenderBlock*>(static_cast<const RenderBlock*>(this));
600 610
601 RenderObject* o = parent(); 611 RenderObject* o = parent();
602 if (!isText() && m_style->position() == FixedPosition) { 612 if (!isText() && m_style->position() == FixedPosition) {
603 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc k())) 613 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc k()))
604 o = o->parent(); 614 o = o->parent();
605 } else if (!isText() && m_style->position() == AbsolutePosition) { 615 } else if (!isText() && m_style->position() == AbsolutePosition) {
606 while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende rBlock())) { 616 while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende rBlock())) {
607 // For relpositioned inlines, we return the nearest enclosing block. We don't try 617 // For relpositioned inlines, we return the nearest enclosing block. We don't try
608 // to return the inline itself. This allows us to avoid having a po sitioned objects 618 // to return the inline itself. This allows us to avoid having a po sitioned objects
609 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result 619 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 topLevelRect = result; 1635 topLevelRect = result;
1626 for (RenderObject* current = firstChild(); current; current = current->nextS ibling()) 1636 for (RenderObject* current = firstChild(); current; current = current->nextS ibling())
1627 current->addAbsoluteRectForLayer(result); 1637 current->addAbsoluteRectForLayer(result);
1628 return result; 1638 return result;
1629 } 1639 }
1630 1640
1631 void RenderObject::paint(PaintInfo& /*paintInfo*/, int /*tx*/, int /*ty*/) 1641 void RenderObject::paint(PaintInfo& /*paintInfo*/, int /*tx*/, int /*ty*/)
1632 { 1642 {
1633 } 1643 }
1634 1644
1635 RenderBoxModelObject* RenderObject::containerForRepaint() const 1645 RenderBox* RenderObject::containerForRepaint() const
1636 { 1646 {
1637 #if USE(ACCELERATED_COMPOSITING) 1647 #if USE(ACCELERATED_COMPOSITING)
1638 if (RenderView* v = view()) { 1648 if (RenderView* v = view()) {
1639 if (v->usesCompositing()) { 1649 if (v->usesCompositing()) {
1640 RenderLayer* compLayer = enclosingCompositingLayer(); 1650 RenderLayer* compLayer = enclosingCompositingLayer();
1641 return compLayer ? compLayer->renderer() : 0; 1651 return compLayer ? compLayer->renderer() : 0;
1642 } 1652 }
1643 } 1653 }
1644 #endif 1654 #endif
1645 // Do root-relative repaint. 1655 // Do root-relative repaint.
1646 return 0; 1656 return 0;
1647 } 1657 }
1648 1658
1649 void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate) 1659 void RenderObject::repaintUsingContainer(RenderBox* repaintContainer, const IntR ect& r, bool immediate)
1650 { 1660 {
1651 if (!repaintContainer || repaintContainer->isRenderView()) { 1661 if (!repaintContainer || repaintContainer->isRenderView()) {
1652 RenderView* v = repaintContainer ? toRenderView(repaintContainer) : view (); 1662 RenderView* v = repaintContainer ? toRenderView(repaintContainer) : view ();
1653 v->repaintViewRectangle(r, immediate); 1663 v->repaintViewRectangle(r, immediate);
1654 } else { 1664 } else {
1655 #if USE(ACCELERATED_COMPOSITING) 1665 #if USE(ACCELERATED_COMPOSITING)
1656 RenderView* v = view(); 1666 RenderView* v = view();
1657 if (v->usesCompositing()) { 1667 if (v->usesCompositing()) {
1658 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->is Composited()); 1668 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->is Composited());
1659 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); 1669 repaintContainer->layer()->setBackingNeedsRepaintInRect(r);
(...skipping 10 matching lines...) Expand all
1670 RenderObject* o = this; 1680 RenderObject* o = this;
1671 while (o->parent()) 1681 while (o->parent())
1672 o = o->parent(); 1682 o = o->parent();
1673 if (!o->isRenderView()) 1683 if (!o->isRenderView())
1674 return; 1684 return;
1675 1685
1676 RenderView* view = toRenderView(o); 1686 RenderView* view = toRenderView(o);
1677 if (view->printing()) 1687 if (view->printing())
1678 return; // Don't repaint if we're printing. 1688 return; // Don't repaint if we're printing.
1679 1689
1680 RenderBoxModelObject* repaintContainer = containerForRepaint(); 1690 RenderBox* repaintContainer = containerForRepaint();
1681 repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOve rflowRectForRepaint(repaintContainer), immediate); 1691 repaintUsingContainer(repaintContainer ? repaintContainer : view, clippedOve rflowRectForRepaint(repaintContainer), immediate);
1682 } 1692 }
1683 1693
1684 void RenderObject::repaintRectangle(const IntRect& r, bool immediate) 1694 void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
1685 { 1695 {
1686 // Can't use view(), since we might be unrooted. 1696 // Can't use view(), since we might be unrooted.
1687 RenderObject* o = this; 1697 RenderObject* o = this;
1688 while (o->parent()) 1698 while (o->parent())
1689 o = o->parent(); 1699 o = o->parent();
1690 if (!o->isRenderView()) 1700 if (!o->isRenderView())
1691 return; 1701 return;
1692 1702
1693 RenderView* view = toRenderView(o); 1703 RenderView* view = toRenderView(o);
1694 if (view->printing()) 1704 if (view->printing())
1695 return; // Don't repaint if we're printing. 1705 return; // Don't repaint if we're printing.
1696 1706
1697 IntRect dirtyRect(r); 1707 IntRect dirtyRect(r);
1698 1708
1699 // FIXME: layoutDelta needs to be applied in parts before/after transforms a nd 1709 // 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 1710 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
1701 dirtyRect.move(view->layoutDelta()); 1711 dirtyRect.move(view->layoutDelta());
1702 1712
1703 RenderBoxModelObject* repaintContainer = containerForRepaint(); 1713 RenderBox* repaintContainer = containerForRepaint();
1704 computeRectForRepaint(repaintContainer, dirtyRect); 1714 computeRectForRepaint(repaintContainer, dirtyRect);
1705 repaintUsingContainer(repaintContainer ? repaintContainer : view, dirtyRect, immediate); 1715 repaintUsingContainer(repaintContainer ? repaintContainer : view, dirtyRect, immediate);
1706 } 1716 }
1707 1717
1708 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta iner, const IntRect& oldBounds, const IntRect& oldOutlineBox) 1718 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBox* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox)
1709 { 1719 {
1710 RenderView* v = view(); 1720 RenderView* v = view();
1711 if (v->printing()) 1721 if (v->printing())
1712 return false; // Don't repaint if we're printing. 1722 return false; // Don't repaint if we're printing.
1713 1723
1714 IntRect newBounds = clippedOverflowRectForRepaint(repaintContainer); 1724 IntRect newBounds = clippedOverflowRectForRepaint(repaintContainer);
1715 IntRect newOutlineBox; 1725 IntRect newOutlineBox;
1716 1726
1717 bool fullRepaint = selfNeedsLayout(); 1727 bool fullRepaint = selfNeedsLayout();
1718 // Presumably a background or a border exists if border-fit:lines was specif ied. 1728 // Presumably a background or a border exists if border-fit:lines was specif ied.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 } 1827 }
1818 1828
1819 bool RenderObject::checkForRepaintDuringLayout() const 1829 bool RenderObject::checkForRepaintDuringLayout() const
1820 { 1830 {
1821 // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=20885> It is probably saf e to also require 1831 // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=20885> It is probably saf e to also require
1822 // m_everHadLayout. Currently, only RenderBlock::layoutBlock() adds this con dition. See also 1832 // m_everHadLayout. Currently, only RenderBlock::layoutBlock() adds this con dition. See also
1823 // <https://bugs.webkit.org/show_bug.cgi?id=15129>. 1833 // <https://bugs.webkit.org/show_bug.cgi?id=15129>.
1824 return !document()->view()->needsFullRepaint() && !hasLayer(); 1834 return !document()->view()->needsFullRepaint() && !hasLayer();
1825 } 1835 }
1826 1836
1827 IntRect RenderObject::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCon tainer, int outlineWidth) 1837 IntRect RenderObject::rectWithOutlineForRepaint(RenderBox* repaintContainer, int outlineWidth)
1828 { 1838 {
1829 IntRect r(clippedOverflowRectForRepaint(repaintContainer)); 1839 IntRect r(clippedOverflowRectForRepaint(repaintContainer));
1830 r.inflate(outlineWidth); 1840 r.inflate(outlineWidth);
1831 return r; 1841 return r;
1832 } 1842 }
1833 1843
1834 IntRect RenderObject::clippedOverflowRectForRepaint(RenderBoxModelObject*) 1844 IntRect RenderObject::clippedOverflowRectForRepaint(RenderBox* repaintContainer)
1835 { 1845 {
1836 ASSERT_NOT_REACHED(); 1846 if (parent())
1847 return parent()->clippedOverflowRectForRepaint(repaintContainer);
1837 return IntRect(); 1848 return IntRect();
1838 } 1849 }
1839 1850
1840 void RenderObject::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed) 1851 void RenderObject::computeRectForRepaint(RenderBox* repaintContainer, IntRect& r ect, bool fixed)
1841 { 1852 {
1842 if (repaintContainer == this) 1853 if (repaintContainer == this)
1843 return; 1854 return;
1844 1855
1845 if (RenderObject* o = parent()) { 1856 if (RenderObject* o = parent()) {
1846 if (o->isBlockFlow()) { 1857 if (o->isBlockFlow()) {
1847 RenderBlock* cb = toRenderBlock(o); 1858 RenderBlock* cb = toRenderBlock(o);
1848 if (cb->hasColumns()) 1859 if (cb->hasColumns())
1849 cb->adjustRectForColumns(rect); 1860 cb->adjustRectForColumns(rect);
1850 } 1861 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 2023
2013 RefPtr<RenderStyle> oldStyle = m_style.release(); 2024 RefPtr<RenderStyle> oldStyle = m_style.release();
2014 m_style = style; 2025 m_style = style;
2015 2026
2016 updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_st yle->backgroundLayers() : 0); 2027 updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_st yle->backgroundLayers() : 0);
2017 updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->m askLayers() : 0); 2028 updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->m askLayers() : 0);
2018 2029
2019 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_styl e->borderImage().image() : 0); 2030 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_styl e->borderImage().image() : 0);
2020 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_sty le->maskBoxImage().image() : 0); 2031 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_sty le->maskBoxImage().image() : 0);
2021 2032
2022 // We need to ensure that view->maximalOutlineSize() is valid for any repain ts that happen
2023 // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
2024 if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSi ze(PaintPhaseOutline))
2025 toRenderView(document()->renderer())->setMaximalOutlineSize(m_style->out lineSize());
2026
2027 styleDidChange(diff, oldStyle.get()); 2033 styleDidChange(diff, oldStyle.get());
2028 } 2034 }
2029 2035
2030 void RenderObject::setStyleInternal(PassRefPtr<RenderStyle> style) 2036 void RenderObject::setStyleInternal(PassRefPtr<RenderStyle> style)
2031 { 2037 {
2032 m_style = style; 2038 m_style = style;
2033 } 2039 }
2034 2040
2035 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS tyle) 2041 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS tyle)
2036 { 2042 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 if (oldStyleSlowScroll) 2102 if (oldStyleSlowScroll)
2097 view()->frameView()->removeSlowRepaintObject(); 2103 view()->frameView()->removeSlowRepaintObject();
2098 if (newStyleSlowScroll) 2104 if (newStyleSlowScroll)
2099 view()->frameView()->addSlowRepaintObject(); 2105 view()->frameView()->addSlowRepaintObject();
2100 } 2106 }
2101 } 2107 }
2102 } 2108 }
2103 2109
2104 void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*) 2110 void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*)
2105 { 2111 {
2112 setHasBoxDecorations(m_style->hasBorder() || m_style->hasBackground() || m_s tyle->hasAppearance() || m_style->boxShadow());
2113
2106 if (s_affectsParentBlock) 2114 if (s_affectsParentBlock)
2107 handleDynamicFloatPositionChange(); 2115 handleDynamicFloatPositionChange();
2108 2116
2109 if (!m_parent) 2117 if (!m_parent)
2110 return; 2118 return;
2111 2119
2112 if (diff == StyleDifferenceLayout) 2120 if (diff == StyleDifferenceLayout)
2113 setNeedsLayoutAndPrefWidthsRecalc(); 2121 setNeedsLayoutAndPrefWidthsRecalc();
2114 else if (diff == StyleDifferenceLayoutPositionedMovementOnly) 2122 else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
2115 setNeedsPositionedMovementLayout(); 2123 setNeedsPositionedMovementLayout();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 RenderObject* o = parent(); 2172 RenderObject* o = parent();
2165 if (o) { 2173 if (o) {
2166 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra nsforms); 2174 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra nsforms);
2167 if (o->hasOverflowClip()) 2175 if (o->hasOverflowClip())
2168 localPoint += toRenderBox(o)->layer()->scrolledContentOffset(); 2176 localPoint += toRenderBox(o)->layer()->scrolledContentOffset();
2169 return localPoint; 2177 return localPoint;
2170 } 2178 }
2171 return FloatPoint(); 2179 return FloatPoint();
2172 } 2180 }
2173 2181
2174 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, RenderB oxModelObject* repaintContainer, bool fixed) const 2182 FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, RenderB ox* repaintContainer, bool fixed) const
2175 { 2183 {
2176 if (repaintContainer == this) 2184 if (repaintContainer == this)
2177 return localQuad; 2185 return localQuad;
2178 2186
2179 RenderObject* o = parent(); 2187 RenderObject* o = parent();
2180 if (o) { 2188 if (o) {
2181 FloatQuad quad = localQuad; 2189 FloatQuad quad = localQuad;
2182 if (o->hasOverflowClip()) 2190 if (o->hasOverflowClip())
2183 quad -= toRenderBox(o)->layer()->scrolledContentOffset(); 2191 quad -= toRenderBox(o)->layer()->scrolledContentOffset();
2184 return o->localToContainerQuad(quad, repaintContainer, fixed); 2192 return o->localToContainerQuad(quad, repaintContainer, fixed);
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 unsigned RenderObject::caretMaxRenderedOffset() const 2745 unsigned RenderObject::caretMaxRenderedOffset() const
2738 { 2746 {
2739 return 0; 2747 return 0;
2740 } 2748 }
2741 2749
2742 int RenderObject::previousOffset(int current) const 2750 int RenderObject::previousOffset(int current) const
2743 { 2751 {
2744 return current - 1; 2752 return current - 1;
2745 } 2753 }
2746 2754
2747 int RenderObject::previousOffsetForBackwardDeletion(int current) const
2748 {
2749 return current - 1;
2750 }
2751
2752 int RenderObject::nextOffset(int current) const 2755 int RenderObject::nextOffset(int current) const
2753 { 2756 {
2754 return current + 1; 2757 return current + 1;
2755 } 2758 }
2756 2759
2757 void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const 2760 void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const
2758 { 2761 {
2759 int outlineSize = outlineStyleForRepaint()->outlineSize(); 2762 int outlineSize = outlineStyleForRepaint()->outlineSize();
2760 if (ShadowData* boxShadow = style()->boxShadow()) { 2763 if (ShadowData* boxShadow = style()->boxShadow()) {
2761 int shadowLeft = 0; 2764 int shadowLeft = 0;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 #ifndef NDEBUG 2818 #ifndef NDEBUG
2816 2819
2817 void showTree(const WebCore::RenderObject* ro) 2820 void showTree(const WebCore::RenderObject* ro)
2818 { 2821 {
2819 if (ro) 2822 if (ro)
2820 ro->showTreeForThis(); 2823 ro->showTreeForThis();
2821 } 2824 }
2822 2825
2823 #endif 2826 #endif
2824 2827
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderObject.h ('k') | third_party/WebKit/WebCore/rendering/RenderPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698