OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 | 1578 |
1579 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate | 1579 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos
e of this call is to determine our bounds clipped to intermediate |
1580 // layers between us and the pagination context. It's important to minimize
the number of fragments we need to create and this helps with that. | 1580 // layers between us and the pagination context. It's important to minimize
the number of fragments we need to create and this helps with that. |
1581 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, inOverlayScrollbarSizeRelevancy); | 1581 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip
RectsCacheSlot, inOverlayScrollbarSizeRelevancy); |
1582 if (respectOverflowClip == IgnoreOverflowClip) | 1582 if (respectOverflowClip == IgnoreOverflowClip) |
1583 paginationClipRectsContext.setIgnoreOverflowClip(); | 1583 paginationClipRectsContext.setIgnoreOverflowClip(); |
1584 LayoutRect layerBoundsInFlowThread; | 1584 LayoutRect layerBoundsInFlowThread; |
1585 ClipRect backgroundRectInFlowThread; | 1585 ClipRect backgroundRectInFlowThread; |
1586 ClipRect foregroundRectInFlowThread; | 1586 ClipRect foregroundRectInFlowThread; |
1587 ClipRect outlineRectInFlowThread; | 1587 ClipRect outlineRectInFlowThread; |
1588 clipper().calculateRects(paginationClipRectsContext, LayoutRect::infiniteInt
Rect(), layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlo
wThread, | 1588 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::
infiniteIntRect()), layerBoundsInFlowThread, backgroundRectInFlowThread, foregro
undRectInFlowThread, |
1589 outlineRectInFlowThread, &offsetWithinPaginatedLayer); | 1589 outlineRectInFlowThread, &offsetWithinPaginatedLayer); |
1590 | 1590 |
1591 // Take our bounding box within the flow thread and clip it. | 1591 // Take our bounding box within the flow thread and clip it. |
1592 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer
); | 1592 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer
); |
1593 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); | 1593 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
1594 | 1594 |
1595 // Make the dirty rect relative to the fragmentation context (multicol conta
iner, etc.). | 1595 // Make the dirty rect relative to the fragmentation context (multicol conta
iner, etc.). |
1596 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->renderer()); | 1596 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->renderer()); |
1597 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. | 1597 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. |
1598 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); | 1598 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 fragment.intersect(fragment.paginationClip); | 1644 fragment.intersect(fragment.paginationClip); |
1645 } | 1645 } |
1646 } | 1646 } |
1647 | 1647 |
1648 static inline LayoutRect frameVisibleRect(LayoutObject* renderer) | 1648 static inline LayoutRect frameVisibleRect(LayoutObject* renderer) |
1649 { | 1649 { |
1650 FrameView* frameView = renderer->document().view(); | 1650 FrameView* frameView = renderer->document().view(); |
1651 if (!frameView) | 1651 if (!frameView) |
1652 return LayoutRect(); | 1652 return LayoutRect(); |
1653 | 1653 |
1654 return frameView->visibleContentRect(); | 1654 return LayoutRect(frameView->visibleContentRect()); |
1655 } | 1655 } |
1656 | 1656 |
1657 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) | 1657 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) |
1658 { | 1658 { |
1659 return hitTest(request, result.hitTestLocation(), result); | 1659 return hitTest(request, result.hitTestLocation(), result); |
1660 } | 1660 } |
1661 | 1661 |
1662 bool Layer::hitTest(const HitTestRequest& request, const HitTestLocation& hitTes
tLocation, HitTestResult& result) | 1662 bool Layer::hitTest(const HitTestRequest& request, const HitTestLocation& hitTes
tLocation, HitTestResult& result) |
1663 { | 1663 { |
1664 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 1664 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
1665 | 1665 |
1666 // LayoutView should make sure to update layout before entering hit testing | 1666 // LayoutView should make sure to update layout before entering hit testing |
1667 ASSERT(!renderer()->frame()->view()->layoutPending()); | 1667 ASSERT(!renderer()->frame()->view()->layoutPending()); |
1668 ASSERT(!renderer()->document().layoutView()->needsLayout()); | 1668 ASSERT(!renderer()->document().layoutView()->needsLayout()); |
1669 | 1669 |
1670 // Start with frameVisibleRect to ensure we include the scrollbars. | 1670 // Start with frameVisibleRect to ensure we include the scrollbars. |
1671 LayoutRect hitTestArea = frameVisibleRect(renderer()); | 1671 LayoutRect hitTestArea = frameVisibleRect(renderer()); |
1672 if (request.ignoreClipping()) | 1672 if (request.ignoreClipping()) |
1673 hitTestArea.unite(renderer()->view()->documentRect()); | 1673 hitTestArea.unite(LayoutRect(renderer()->view()->documentRect())); |
1674 | 1674 |
1675 Layer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hit
TestLocation, false); | 1675 Layer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hit
TestLocation, false); |
1676 if (!insideLayer) { | 1676 if (!insideLayer) { |
1677 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, | 1677 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
1678 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | 1678 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
1679 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | 1679 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
1680 // In addtion, it is possible for the mouse to stay in the document but
there is no element. | 1680 // In addtion, it is possible for the mouse to stay in the document but
there is no element. |
1681 // At that time, the events of the mouse should be fired. | 1681 // At that time, the events of the mouse should be fired. |
1682 LayoutPoint hitPoint = hitTestLocation.point(); | 1682 LayoutPoint hitPoint = hitTestLocation.point(); |
1683 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { | 1683 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 else | 2196 else |
2197 childLayer->m_transform.clear(); | 2197 childLayer->m_transform.clear(); |
2198 } else { | 2198 } else { |
2199 // Adjust the transform such that the renderer's upper left corn
er will be at (0,0) in user space. | 2199 // Adjust the transform such that the renderer's upper left corn
er will be at (0,0) in user space. |
2200 // This involves subtracting out the position of the layer in ou
r current coordinate space. | 2200 // This involves subtracting out the position of the layer in ou
r current coordinate space. |
2201 Layer* nextLayer = columnLayers[columnIndex - 1]; | 2201 Layer* nextLayer = columnLayers[columnIndex - 1]; |
2202 RefPtr<HitTestingTransformState> newTransformState = nextLayer->
createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestLocation,
transformState); | 2202 RefPtr<HitTestingTransformState> newTransformState = nextLayer->
createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestLocation,
transformState); |
2203 newTransformState->translate(offset.width(), offset.height(), Hi
tTestingTransformState::AccumulateTransform); | 2203 newTransformState->translate(offset.width(), offset.height(), Hi
tTestingTransformState::AccumulateTransform); |
2204 FloatPoint localPoint = newTransformState->mappedPoint(); | 2204 FloatPoint localPoint = newTransformState->mappedPoint(); |
2205 FloatQuad localPointQuad = newTransformState->mappedQuad(); | 2205 FloatQuad localPointQuad = newTransformState->mappedQuad(); |
2206 LayoutRect localHitTestRect = newTransformState->mappedArea().en
closingBoundingBox(); | 2206 LayoutRect localHitTestRect(newTransformState->mappedArea().encl
osingBoundingBox()); |
2207 HitTestLocation newHitTestLocation; | 2207 HitTestLocation newHitTestLocation; |
2208 if (hitTestLocation.isRectBasedTest()) | 2208 if (hitTestLocation.isRectBasedTest()) |
2209 newHitTestLocation = HitTestLocation(localPoint, localPointQ
uad); | 2209 newHitTestLocation = HitTestLocation(localPoint, localPointQ
uad); |
2210 else | 2210 else |
2211 newHitTestLocation = HitTestLocation(localPoint); | 2211 newHitTestLocation = HitTestLocation(localPoint); |
2212 newTransformState->flatten(); | 2212 newTransformState->flatten(); |
2213 | 2213 |
2214 hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[col
umnIndex - 1], request, result, localHitTestRect, newHitTestLocation, | 2214 hitLayer = hitTestChildLayerColumns(childLayer, columnLayers[col
umnIndex - 1], request, result, localHitTestRect, newHitTestLocation, |
2215 newTransformState.get(), zOffset, columnLayers, columnIndex
- 1); | 2215 newTransformState.get(), zOffset, columnLayers, columnIndex
- 1); |
2216 } | 2216 } |
(...skipping 29 matching lines...) Expand all Loading... |
2246 { | 2246 { |
2247 for (Layer* child = firstChild(); child; child = child->nextSibling()) { | 2247 for (Layer* child = firstChild(); child; child = child->nextSibling()) { |
2248 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2248 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
2249 DisablePaintInvalidationStateAsserts disabler; | 2249 DisablePaintInvalidationStateAsserts disabler; |
2250 child->invalidatePaintForBlockSelectionGaps(); | 2250 child->invalidatePaintForBlockSelectionGaps(); |
2251 } | 2251 } |
2252 | 2252 |
2253 if (m_blockSelectionGapsBounds.isEmpty()) | 2253 if (m_blockSelectionGapsBounds.isEmpty()) |
2254 return; | 2254 return; |
2255 | 2255 |
2256 LayoutRect rect = m_blockSelectionGapsBounds; | 2256 LayoutRect rect(m_blockSelectionGapsBounds); |
2257 if (renderer()->hasOverflowClip()) { | 2257 if (renderer()->hasOverflowClip()) { |
2258 LayoutBox* box = layoutBox(); | 2258 LayoutBox* box = layoutBox(); |
2259 rect.move(-box->scrolledContentOffset()); | 2259 rect.move(-box->scrolledContentOffset()); |
2260 if (!scrollableArea()->usesCompositedScrolling()) | 2260 if (!scrollableArea()->usesCompositedScrolling()) |
2261 rect.intersect(box->overflowClipRect(LayoutPoint())); | 2261 rect.intersect(box->overflowClipRect(LayoutPoint())); |
2262 } | 2262 } |
2263 if (renderer()->hasClip()) | 2263 if (renderer()->hasClip()) |
2264 rect.intersect(toLayoutBox(renderer())->clipRect(LayoutPoint())); | 2264 rect.intersect(toLayoutBox(renderer())->clipRect(LayoutPoint())); |
2265 if (!rect.isEmpty()) { | 2265 if (!rect.isEmpty()) { |
2266 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2266 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 | 2429 |
2430 if (!ancestorLayer) | 2430 if (!ancestorLayer) |
2431 ancestorLayer = this; | 2431 ancestorLayer = this; |
2432 | 2432 |
2433 // FIXME: This could be improved to do a check like hasVisibleNonCompositing
DescendantLayers() (bug 92580). | 2433 // FIXME: This could be improved to do a check like hasVisibleNonCompositing
DescendantLayers() (bug 92580). |
2434 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) | 2434 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) |
2435 return LayoutRect(); | 2435 return LayoutRect(); |
2436 | 2436 |
2437 // The root layer is always just the size of the document. | 2437 // The root layer is always just the size of the document. |
2438 if (isRootLayer()) | 2438 if (isRootLayer()) |
2439 return m_renderer->view()->unscaledDocumentRect(); | 2439 return LayoutRect(m_renderer->view()->unscaledDocumentRect()); |
2440 | 2440 |
2441 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, | 2441 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, |
2442 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute | 2442 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute |
2443 // the correct size for the rendered content of the multicol container. | 2443 // the correct size for the rendered content of the multicol container. |
2444 if (useRegionBasedColumns() && renderer()->isLayoutFlowThread()) | 2444 if (useRegionBasedColumns() && renderer()->isLayoutFlowThread()) |
2445 return LayoutRect(); | 2445 return LayoutRect(); |
2446 | 2446 |
2447 LayoutRect result = clipper().localClipRect(); | 2447 LayoutRect result = clipper().localClipRect(); |
2448 if (result == LayoutRect::infiniteIntRect()) { | 2448 if (result == LayoutRect::infiniteIntRect()) { |
2449 LayoutPoint origin; | 2449 LayoutPoint origin; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 } | 2951 } |
2952 } | 2952 } |
2953 | 2953 |
2954 void showLayerTree(const blink::LayoutObject* renderer) | 2954 void showLayerTree(const blink::LayoutObject* renderer) |
2955 { | 2955 { |
2956 if (!renderer) | 2956 if (!renderer) |
2957 return; | 2957 return; |
2958 showLayerTree(renderer->enclosingLayer()); | 2958 showLayerTree(renderer->enclosingLayer()); |
2959 } | 2959 } |
2960 #endif | 2960 #endif |
OLD | NEW |