OLD | NEW |
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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 975 |
976 IntRect result = rects[0]; | 976 IntRect result = rects[0]; |
977 for (size_t i = 1; i < n; ++i) | 977 for (size_t i = 1; i < n; ++i) |
978 result.unite(rects[i]); | 978 result.unite(rects[i]); |
979 return result; | 979 return result; |
980 } | 980 } |
981 | 981 |
982 IntRect LayoutObject::absoluteFocusRingBoundingBoxRect() const | 982 IntRect LayoutObject::absoluteFocusRingBoundingBoxRect() const |
983 { | 983 { |
984 Vector<LayoutRect> rects; | 984 Vector<LayoutRect> rects; |
985 const LayoutBoxModelObject* container = enclosingLayer()->renderer(); | 985 const LayoutBoxModelObject* container = enclosingLayer()->layoutObject(); |
986 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer))); | 986 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer))); |
987 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing
BoundingBox(); | 987 return container->localToAbsoluteQuad(FloatQuad(unionRect(rects))).enclosing
BoundingBox(); |
988 } | 988 } |
989 | 989 |
990 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) | 990 FloatRect LayoutObject::absoluteBoundingBoxRectForRange(const Range* range) |
991 { | 991 { |
992 if (!range || !range->startContainer()) | 992 if (!range || !range->startContainer()) |
993 return FloatRect(); | 993 return FloatRect(); |
994 | 994 |
995 range->ownerDocument().updateLayout(); | 995 range->ownerDocument().updateLayout(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); | 1030 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta
iner()); |
1031 } | 1031 } |
1032 | 1032 |
1033 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const | 1033 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const |
1034 { | 1034 { |
1035 LayoutBoxModelObject* container = 0; | 1035 LayoutBoxModelObject* container = 0; |
1036 // FIXME: CompositingState is not necessarily up to date for many callers of
this function. | 1036 // FIXME: CompositingState is not necessarily up to date for many callers of
this function. |
1037 DisableCompositingQueryAsserts disabler; | 1037 DisableCompositingQueryAsserts disabler; |
1038 | 1038 |
1039 if (Layer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvali
dationCrossingFrameBoundaries()) | 1039 if (Layer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvali
dationCrossingFrameBoundaries()) |
1040 container = compositingLayer->renderer(); | 1040 container = compositingLayer->layoutObject(); |
1041 return container; | 1041 return container; |
1042 } | 1042 } |
1043 | 1043 |
1044 const LayoutBoxModelObject* LayoutObject::adjustCompositedContainerForSpecialAnc
estors(const LayoutBoxModelObject* paintInvalidationContainer) const | 1044 const LayoutBoxModelObject* LayoutObject::adjustCompositedContainerForSpecialAnc
estors(const LayoutBoxModelObject* paintInvalidationContainer) const |
1045 { | 1045 { |
1046 if (paintInvalidationContainer) | 1046 if (paintInvalidationContainer) |
1047 return paintInvalidationContainer; | 1047 return paintInvalidationContainer; |
1048 | 1048 |
1049 LayoutView* layoutView = view(); | 1049 LayoutView* layoutView = view(); |
1050 while (layoutView->frame()->ownerLayoutObject()) | 1050 while (layoutView->frame()->ownerLayoutObject()) |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) { | 1772 if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) { |
1773 // On low-powered/mobile devices, preventing blitting on a scroll ca
n cause noticeable delays | 1773 // On low-powered/mobile devices, preventing blitting on a scroll ca
n cause noticeable delays |
1774 // when scrolling a page with a fixed background image. As an optimi
zation, assuming there are | 1774 // when scrolling a page with a fixed background image. As an optimi
zation, assuming there are |
1775 // no fixed positoned elements on the page, we can acclerate scrolli
ng (via blitting) if we | 1775 // no fixed positoned elements on the page, we can acclerate scrolli
ng (via blitting) if we |
1776 // ignore the CSS property "background-attachment: fixed". | 1776 // ignore the CSS property "background-attachment: fixed". |
1777 shouldBlitOnFixedBackgroundImage = true; | 1777 shouldBlitOnFixedBackgroundImage = true; |
1778 } | 1778 } |
1779 bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle.
hasFixedBackgroundImage(); | 1779 bool newStyleSlowScroll = !shouldBlitOnFixedBackgroundImage && newStyle.
hasFixedBackgroundImage(); |
1780 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage &
& m_style->hasFixedBackgroundImage(); | 1780 bool oldStyleSlowScroll = m_style && !shouldBlitOnFixedBackgroundImage &
& m_style->hasFixedBackgroundImage(); |
1781 | 1781 |
1782 bool drawsRootBackground = isDocumentElement() || (isBody() && !renderer
HasBackground(document().documentElement()->renderer())); | 1782 bool drawsRootBackground = isDocumentElement() || (isBody() && !renderer
HasBackground(document().documentElement()->layoutObject())); |
1783 if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) { | 1783 if (drawsRootBackground && !shouldBlitOnFixedBackgroundImage) { |
1784 if (view()->compositor()->supportsFixedRootBackgroundCompositing())
{ | 1784 if (view()->compositor()->supportsFixedRootBackgroundCompositing())
{ |
1785 if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground()) | 1785 if (newStyleSlowScroll && newStyle.hasEntirelyFixedBackground()) |
1786 newStyleSlowScroll = false; | 1786 newStyleSlowScroll = false; |
1787 | 1787 |
1788 if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground()) | 1788 if (oldStyleSlowScroll && m_style->hasEntirelyFixedBackground()) |
1789 oldStyleSlowScroll = false; | 1789 oldStyleSlowScroll = false; |
1790 } | 1790 } |
1791 } | 1791 } |
1792 | 1792 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 void LayoutObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const | 2132 void LayoutObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const |
2133 { | 2133 { |
2134 // Figure out what layer our container is in. Any offset (or new layer) for
this | 2134 // Figure out what layer our container is in. Any offset (or new layer) for
this |
2135 // renderer within it's container will be applied in addLayerHitTestRects. | 2135 // renderer within it's container will be applied in addLayerHitTestRects. |
2136 LayoutPoint layerOffset; | 2136 LayoutPoint layerOffset; |
2137 const Layer* currentLayer = 0; | 2137 const Layer* currentLayer = 0; |
2138 | 2138 |
2139 if (!hasLayer()) { | 2139 if (!hasLayer()) { |
2140 LayoutObject* container = this->container(); | 2140 LayoutObject* container = this->container(); |
2141 currentLayer = container->enclosingLayer(); | 2141 currentLayer = container->enclosingLayer(); |
2142 if (container && currentLayer->renderer() != container) { | 2142 if (container && currentLayer->layoutObject() != container) { |
2143 layerOffset.move(container->offsetFromAncestorContainer(currentLayer
->renderer())); | 2143 layerOffset.move(container->offsetFromAncestorContainer(currentLayer
->layoutObject())); |
2144 // If the layer itself is scrolled, we have to undo the subtraction
of its scroll | 2144 // If the layer itself is scrolled, we have to undo the subtraction
of its scroll |
2145 // offset since we want the offset relative to the scrolling content
, not the | 2145 // offset since we want the offset relative to the scrolling content
, not the |
2146 // element itself. | 2146 // element itself. |
2147 if (currentLayer->renderer()->hasOverflowClip()) | 2147 if (currentLayer->layoutObject()->hasOverflowClip()) |
2148 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffse
t()); | 2148 layerOffset.move(currentLayer->layoutBox()->scrolledContentOffse
t()); |
2149 } | 2149 } |
2150 } | 2150 } |
2151 | 2151 |
2152 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect
()); | 2152 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect
()); |
2153 } | 2153 } |
2154 | 2154 |
2155 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Lay
er* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRec
t) const | 2155 void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Lay
er* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRec
t) const |
2156 { | 2156 { |
2157 ASSERT(currentLayer); | 2157 ASSERT(currentLayer); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 | 2219 |
2220 LayoutObject* LayoutObject::rendererForRootBackground() | 2220 LayoutObject* LayoutObject::rendererForRootBackground() |
2221 { | 2221 { |
2222 ASSERT(isDocumentElement()); | 2222 ASSERT(isDocumentElement()); |
2223 if (!hasBackground() && isHTMLHtmlElement(node())) { | 2223 if (!hasBackground() && isHTMLHtmlElement(node())) { |
2224 // Locate the <body> element using the DOM. This is easier than trying | 2224 // Locate the <body> element using the DOM. This is easier than trying |
2225 // to crawl around a render tree with potential :before/:after content a
nd | 2225 // to crawl around a render tree with potential :before/:after content a
nd |
2226 // anonymous blocks created by inline <body> tags etc. We can locate the
<body> | 2226 // anonymous blocks created by inline <body> tags etc. We can locate the
<body> |
2227 // render object very easily via the DOM. | 2227 // render object very easily via the DOM. |
2228 HTMLElement* body = document().body(); | 2228 HTMLElement* body = document().body(); |
2229 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->renderer() :
0; | 2229 LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject(
) : 0; |
2230 if (bodyObject) | 2230 if (bodyObject) |
2231 return bodyObject; | 2231 return bodyObject; |
2232 } | 2232 } |
2233 | 2233 |
2234 return this; | 2234 return this; |
2235 } | 2235 } |
2236 | 2236 |
2237 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const | 2237 RespectImageOrientationEnum LayoutObject::shouldRespectImageOrientation() const |
2238 { | 2238 { |
2239 // Respect the image's orientation if it's being used as a full-page image o
r it's | 2239 // 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 Loading... |
2729 } | 2729 } |
2730 | 2730 |
2731 PassRefPtr<LayoutStyle> LayoutObject::getUncachedPseudoStyleFromParentOrShadowHo
st() const | 2731 PassRefPtr<LayoutStyle> LayoutObject::getUncachedPseudoStyleFromParentOrShadowHo
st() const |
2732 { | 2732 { |
2733 if (!node()) | 2733 if (!node()) |
2734 return nullptr; | 2734 return nullptr; |
2735 | 2735 |
2736 if (ShadowRoot* root = node()->containingShadowRoot()) { | 2736 if (ShadowRoot* root = node()->containingShadowRoot()) { |
2737 if (root->type() == ShadowRoot::ClosedShadowRoot) { | 2737 if (root->type() == ShadowRoot::ClosedShadowRoot) { |
2738 if (Element* shadowHost = node()->shadowHost()) { | 2738 if (Element* shadowHost = node()->shadowHost()) { |
2739 return shadowHost->renderer()->getUncachedPseudoStyle(PseudoStyl
eRequest(SELECTION)); | 2739 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo
StyleRequest(SELECTION)); |
2740 } | 2740 } |
2741 } | 2741 } |
2742 } | 2742 } |
2743 | 2743 |
2744 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); | 2744 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); |
2745 } | 2745 } |
2746 | 2746 |
2747 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug
h, bool quirksMode, bool firstlineStyle) | 2747 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug
h, bool quirksMode, bool firstlineStyle) |
2748 { | 2748 { |
2749 LayoutObject* curr = this; | 2749 LayoutObject* curr = this; |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3216 { | 3216 { |
3217 if (object1) { | 3217 if (object1) { |
3218 const blink::LayoutObject* root = object1; | 3218 const blink::LayoutObject* root = object1; |
3219 while (root->parent()) | 3219 while (root->parent()) |
3220 root = root->parent(); | 3220 root = root->parent(); |
3221 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3221 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3222 } | 3222 } |
3223 } | 3223 } |
3224 | 3224 |
3225 #endif | 3225 #endif |
OLD | NEW |