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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master Created 5 years, 9 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, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 IntRect result = rects[0]; 989 IntRect result = rects[0];
990 for (size_t i = 1; i < n; ++i) 990 for (size_t i = 1; i < n; ++i)
991 result.unite(rects[i]); 991 result.unite(rects[i]);
992 return result; 992 return result;
993 } 993 }
994 994
995 IntRect LayoutObject::absoluteFocusRingBoundingBoxRect() const 995 IntRect LayoutObject::absoluteFocusRingBoundingBoxRect() const
996 { 996 {
997 Vector<LayoutRect> rects; 997 Vector<LayoutRect> rects;
998 const LayoutBoxModelObject* container = enclosingLayer()->renderer(); 998 const LayoutBoxModelObject* container = enclosingLayer()->layoutObject();
999 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer))); 999 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con tainer)));
1000 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing BoundingBox(); 1000 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing BoundingBox();
1001 } 1001 }
1002 1002
1003 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) 1003 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range)
1004 { 1004 {
1005 if (!range || !range->startContainer()) 1005 if (!range || !range->startContainer())
1006 return FloatRect(); 1006 return FloatRect();
1007 1007
1008 range->ownerDocument().updateLayout(); 1008 range->ownerDocument().updateLayout();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner()); 1043 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner());
1044 } 1044 }
1045 1045
1046 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const 1046 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const
1047 { 1047 {
1048 LayoutBoxModelObject* container = 0; 1048 LayoutBoxModelObject* container = 0;
1049 // FIXME: CompositingState is not necessarily up to date for many callers of this function. 1049 // FIXME: CompositingState is not necessarily up to date for many callers of this function.
1050 DisableCompositingQueryAsserts disabler; 1050 DisableCompositingQueryAsserts disabler;
1051 1051
1052 if (Layer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvali dationCrossingFrameBoundaries()) 1052 if (Layer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvali dationCrossingFrameBoundaries())
1053 container = compositingLayer->renderer(); 1053 container = compositingLayer->layoutObject();
1054 return container; 1054 return container;
1055 } 1055 }
1056 1056
1057 const LayoutBoxModelObject* LayoutObject::adjustCompositedContainerForSpecialAnc estors(const LayoutBoxModelObject* paintInvalidationContainer) const 1057 const LayoutBoxModelObject* LayoutObject::adjustCompositedContainerForSpecialAnc estors(const LayoutBoxModelObject* paintInvalidationContainer) const
1058 { 1058 {
1059 if (paintInvalidationContainer) 1059 if (paintInvalidationContainer)
1060 return paintInvalidationContainer; 1060 return paintInvalidationContainer;
1061 1061
1062 LayoutView* layoutView = view(); 1062 LayoutView* layoutView = view();
1063 while (layoutView->frame()->ownerLayoutObject()) 1063 while (layoutView->frame()->ownerLayoutObject())
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) { 1749 if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) {
1750 // On low-powered/mobile devices, preventing blitting on a scroll ca n cause noticeable delays 1750 // On low-powered/mobile devices, preventing blitting on a scroll ca n cause noticeable delays
1751 // when scrolling a page with a fixed background image. As an optimi zation, assuming there are 1751 // when scrolling a page with a fixed background image. As an optimi zation, assuming there are
1752 // no fixed positoned elements on the page, we can acclerate scrolli ng (via blitting) if we 1752 // no fixed positoned elements on the page, we can acclerate scrolli ng (via blitting) if we
1753 // ignore the CSS property "background-attachment: fixed". 1753 // ignore the CSS property "background-attachment: fixed".
1754 shouldBlitOnFixedBackgroundImage = true; 1754 shouldBlitOnFixedBackgroundImage = true;
1755 } 1755 }
1756 bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle. hasFixedBackgroundImage(); 1756 bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle. hasFixedBackgroundImage();
1757 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage & & m_style->hasFixedBackgroundImage(); 1757 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage & & m_style->hasFixedBackgroundImage();
1758 1758
1759 bool drawsRootBackground = isDocumentElement() || (isBody() && !renderer HasBackground(document().documentElement()->renderer())); 1759 bool drawsRootBackground = isDocumentElement() || (isBody() && !renderer HasBackground(document().documentElement()->layoutObject()));
1760 if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) { 1760 if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) {
1761 if (view()->compositor()->supportsFixedRootBackgroundCompositing()) { 1761 if (view()->compositor()->supportsFixedRootBackgroundCompositing()) {
1762 if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground()) 1762 if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground())
1763 newStyleSlowScroll = false; 1763 newStyleSlowScroll = false;
1764 1764
1765 if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground()) 1765 if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground())
1766 oldStyleSlowScroll = false; 1766 oldStyleSlowScroll = false;
1767 } 1767 }
1768 } 1768 }
1769 1769
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 void LayoutObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const 2109 void LayoutObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const
2110 { 2110 {
2111 // Figure out what layer our container is in. Any offset (or new layer) for this 2111 // Figure out what layer our container is in. Any offset (or new layer) for this
2112 // renderer within it's container will be applied in addLayerHitTestRects. 2112 // renderer within it's container will be applied in addLayerHitTestRects.
2113 LayoutPoint layerOffset; 2113 LayoutPoint layerOffset;
2114 const Layer* currentLayer = 0; 2114 const Layer* currentLayer = 0;
2115 2115
2116 if (!hasLayer()) { 2116 if (!hasLayer()) {
2117 LayoutObject* container = this->container(); 2117 LayoutObject* container = this->container();
2118 currentLayer = container->enclosingLayer(); 2118 currentLayer = container->enclosingLayer();
2119 if (container && currentLayer->renderer() != container) { 2119 if (container && currentLayer->layoutObject() != container) {
2120 layerOffset.move(container->offsetFromAncestorContainer(currentLayer ->renderer())); 2120 layerOffset.move(container->offsetFromAncestorContainer(currentLayer ->layoutObject()));
2121 // If the layer itself is scrolled, we have to undo the subtraction of its scroll 2121 // If the layer itself is scrolled, we have to undo the subtraction of its scroll
2122 // offset since we want the offset relative to the scrolling content , not the 2122 // offset since we want the offset relative to the scrolling content , not the
2123 // element itself. 2123 // element itself.
2124 if (currentLayer->renderer()->hasOverflowClip()) 2124 if (currentLayer->layoutObject()->hasOverflowClip())
2125 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffse t()); 2125 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffse t());
2126 } 2126 }
2127 } 2127 }
2128 2128
2129 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect ()); 2129 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect ());
2130 } 2130 }
2131 2131
2132 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Lay er* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRec t) const 2132 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Lay er* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRec t) const
2133 { 2133 {
2134 ASSERT(currentLayer); 2134 ASSERT(currentLayer);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 2196
2197 LayoutObject* LayoutObject::rendererForRootBackground() 2197 LayoutObject* LayoutObject::rendererForRootBackground()
2198 { 2198 {
2199 ASSERT(isDocumentElement()); 2199 ASSERT(isDocumentElement());
2200 if (!hasBackground() && isHTMLHtmlElement(node())) { 2200 if (!hasBackground() && isHTMLHtmlElement(node())) {
2201 // Locate the <body> element using the DOM. This is easier than trying 2201 // Locate the <body> element using the DOM. This is easier than trying
2202 // to crawl around a render tree with potential :before/:after content a nd 2202 // to crawl around a render tree with potential :before/:after content a nd
2203 // anonymous blocks created by inline <body> tags etc. We can locate the <body> 2203 // anonymous blocks created by inline <body> tags etc. We can locate the <body>
2204 // render object very easily via the DOM. 2204 // render object very easily via the DOM.
2205 HTMLElement* body = document().body(); 2205 HTMLElement* body = document().body();
2206 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->renderer() : 0; 2206 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject( ) : 0;
2207 if (bodyObject) 2207 if (bodyObject)
2208 return bodyObject; 2208 return bodyObject;
2209 } 2209 }
2210 2210
2211 return this; 2211 return this;
2212 } 2212 }
2213 2213
2214 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const 2214 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const
2215 { 2215 {
2216 // Respect the image's orientation if it's being used as a full-page image o r it's 2216 // Respect the image's orientation if it's being used as a full-page image o r it's
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 } 2706 }
2707 2707
2708 PassRefPtr<LayoutStyle> LayoutObject::getUncachedPseudoStyleFromParentOrShadowHo st() const 2708 PassRefPtr<LayoutStyle> LayoutObject::getUncachedPseudoStyleFromParentOrShadowHo st() const
2709 { 2709 {
2710 if (!node()) 2710 if (!node())
2711 return nullptr; 2711 return nullptr;
2712 2712
2713 if (ShadowRoot* root = node()->containingShadowRoot()) { 2713 if (ShadowRoot* root = node()->containingShadowRoot()) {
2714 if (root->type() == ShadowRoot::ClosedShadowRoot) { 2714 if (root->type() == ShadowRoot::ClosedShadowRoot) {
2715 if (Element* shadowHost = node()->shadowHost()) { 2715 if (Element* shadowHost = node()->shadowHost()) {
2716 return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyl eRequest(SELECTION)); 2716 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2717 } 2717 }
2718 } 2718 }
2719 } 2719 }
2720 2720
2721 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2721 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2722 } 2722 }
2723 2723
2724 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle) 2724 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2725 { 2725 {
2726 LayoutObject* curr = this; 2726 LayoutObject* curr = this;
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 { 3193 {
3194 if (object1) { 3194 if (object1) {
3195 const blink::LayoutObject* root = object1; 3195 const blink::LayoutObject* root = object1;
3196 while (root->parent()) 3196 while (root->parent())
3197 root = root->parent(); 3197 root = root->parent();
3198 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3198 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3199 } 3199 }
3200 } 3200 }
3201 3201
3202 #endif 3202 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698