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 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2050 if (isSVGClipPathElement(element) && element->layoutObject()) { | 2050 if (isSVGClipPathElement(element) && element->layoutObject()) { |
2051 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(toLay outSVGResourceContainer(element->layoutObject())); | 2051 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(toLay outSVGResourceContainer(element->layoutObject())); |
2052 if (!clipper->hitTestClipContent(FloatRect(rootRelativeBounds), Floa tPoint(hitTestLocation.point()))) | 2052 if (!clipper->hitTestClipContent(FloatRect(rootRelativeBounds), Floa tPoint(hitTestLocation.point()))) |
2053 return true; | 2053 return true; |
2054 } | 2054 } |
2055 } | 2055 } |
2056 | 2056 |
2057 return false; | 2057 return false; |
2058 } | 2058 } |
2059 | 2059 |
2060 void PaintLayer::blockSelectionGapsBoundsChanged() | |
2061 { | |
2062 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
2063 return; | |
2064 | |
2065 setNeedsCompositingInputsUpdate(); | |
2066 } | |
2067 | |
2068 void PaintLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) | |
2069 { | |
2070 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | |
2071 return; | |
2072 if (!bounds.isEmpty()) | |
2073 ensureRareData().blockSelectionGapsBounds.unite(enclosingIntRect(bounds) ); | |
2074 blockSelectionGapsBoundsChanged(); | |
2075 } | |
2076 | |
2077 void PaintLayer::clearBlockSelectionGapsBounds() | |
2078 { | |
2079 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | |
2080 return; | |
2081 if (m_rareData) | |
2082 m_rareData->blockSelectionGapsBounds = IntRect(); | |
2083 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | |
2084 child->clearBlockSelectionGapsBounds(); | |
2085 blockSelectionGapsBoundsChanged(); | |
2086 } | |
2087 | |
2088 void PaintLayer::invalidatePaintForBlockSelectionGaps() | |
2089 { | |
2090 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | |
2091 return; | |
2092 | |
2093 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) { | |
2094 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 | |
2095 DisablePaintInvalidationStateAsserts disabler; | |
2096 child->invalidatePaintForBlockSelectionGaps(); | |
2097 } | |
2098 | |
2099 if (!m_rareData || m_rareData->blockSelectionGapsBounds.isEmpty()) | |
chrishtr
2016/01/28 22:06:22
delete from m_rareData
wkorman
2016/01/28 22:54:32
Already done, see PaintLayer.h.
| |
2100 return; | |
2101 | |
2102 LayoutRect rect(m_rareData->blockSelectionGapsBounds); | |
2103 if (layoutObject()->hasOverflowClip()) { | |
2104 LayoutBox* box = layoutBox(); | |
2105 rect.move(-box->scrolledContentOffset()); | |
2106 if (!scrollableArea()->usesCompositedScrolling()) | |
2107 rect.intersect(box->overflowClipRect(LayoutPoint())); | |
2108 } | |
2109 if (layoutObject()->hasClip()) | |
2110 rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint())); | |
2111 if (!rect.isEmpty()) { | |
2112 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 | |
2113 DisablePaintInvalidationStateAsserts disabler; | |
2114 layoutObject()->invalidatePaintRectangle(rect); | |
2115 } | |
2116 } | |
2117 | |
2118 IntRect PaintLayer::blockSelectionGapsBounds() const | |
2119 { | |
2120 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | |
2121 return IntRect(); | |
2122 | |
2123 if (!layoutObject()->isLayoutBlockFlow()) | |
2124 return IntRect(); | |
2125 | |
2126 LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject()); | |
2127 LayoutRect gapRects = layoutBlockFlow->selectionGapRectsForPaintInvalidation (layoutBlockFlow); | |
2128 | |
2129 return pixelSnappedIntRect(gapRects); | |
2130 } | |
2131 | |
2132 bool PaintLayer::hasBlockSelectionGapBounds() const | |
2133 { | |
2134 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) | |
2135 return false; | |
2136 | |
2137 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is Empty(), but this is impossible | |
2138 // at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802). | |
2139 // ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycl e::LayoutClean); | |
2140 | |
2141 if (!layoutObject()->isLayoutBlock()) | |
2142 return false; | |
2143 | |
2144 return toLayoutBlock(layoutObject())->shouldPaintSelectionGaps(); | |
2145 } | |
2146 | |
2147 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou tRect& damageRect, const LayoutPoint& offsetFromRoot) const | 2060 bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layou tRect& damageRect, const LayoutPoint& offsetFromRoot) const |
2148 { | 2061 { |
2149 // Always examine the canvas and the root. | 2062 // Always examine the canvas and the root. |
2150 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView | 2063 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView |
2151 // paints the root's background. | 2064 // paints the root's background. |
2152 if (isRootLayer() || layoutObject()->isDocumentElement()) | 2065 if (isRootLayer() || layoutObject()->isDocumentElement()) |
2153 return true; | 2066 return true; |
2154 | 2067 |
2155 // If we aren't an inline flow, and our layer bounds do intersect the damage rect, then we | 2068 // If we aren't an inline flow, and our layer bounds do intersect the damage rect, then we |
2156 // can go ahead and return true. | 2069 // can go ahead and return true. |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2881 | 2794 |
2882 void showLayerTree(const blink::LayoutObject* layoutObject) | 2795 void showLayerTree(const blink::LayoutObject* layoutObject) |
2883 { | 2796 { |
2884 if (!layoutObject) { | 2797 if (!layoutObject) { |
2885 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2798 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2886 return; | 2799 return; |
2887 } | 2800 } |
2888 showLayerTree(layoutObject->enclosingLayer()); | 2801 showLayerTree(layoutObject->enclosingLayer()); |
2889 } | 2802 } |
2890 #endif | 2803 #endif |
OLD | NEW |