Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/PaintInvalidationState.h" | 5 #include "core/layout/PaintInvalidationState.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 } | 300 } |
| 301 } else if (m_currentObject.isSVGRoot()) { | 301 } else if (m_currentObject.isSVGRoot()) { |
| 302 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject); | 302 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject); |
| 303 if (svgRoot.shouldApplyViewportClip()) | 303 if (svgRoot.shouldApplyViewportClip()) |
| 304 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize()))); | 304 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize()))); |
| 305 } else if (m_currentObject.isTableRow()) { | 305 } else if (m_currentObject.isTableRow()) { |
| 306 // Child table cell's locationOffset() includes its row's locationOffset (). | 306 // Child table cell's locationOffset() includes its row's locationOffset (). |
| 307 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); | 307 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 if (!m_currentObject.hasOverflowClip()) | 310 if (!m_currentObject.hasClipRelatedProperty()) |
| 311 return; | 311 return; |
| 312 | 312 |
| 313 const LayoutBox& box = toLayoutBox(m_currentObject); | 313 const LayoutBox& box = toLayoutBox(m_currentObject); |
| 314 | 314 |
| 315 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited | 315 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited |
| 316 // scrolling in this case. | 316 // scrolling in this case. |
| 317 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) { | 317 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) { |
| 318 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. | 318 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. |
| 319 } else { | 319 } else { |
| 320 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint())); | 320 addClipRectRelativeToPaintOffset(box.clippingRect()); |
|
Xianzhu
2016/08/12 17:07:57
The original code won't apply clip on descendant a
chrishtr
2016/08/12 17:56:24
Added one here and in LayoutBox.
| |
| 321 m_paintOffset -= box.scrolledContentOffset(); | 321 if (box.hasOverflowClip()) |
| 322 m_paintOffset -= box.scrolledContentOffset(); | |
| 322 } | 323 } |
| 323 | 324 |
| 324 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. | 325 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. |
| 325 } | 326 } |
| 326 | 327 |
| 327 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) | 328 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) |
| 328 { | 329 { |
| 329 if (object.isLayoutView()) | 330 if (object.isLayoutView()) |
| 330 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates); | 331 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates); |
| 331 FloatPoint result = object.localToAncestorPoint(point, &ancestor, TraverseDo cumentBoundaries); | 332 FloatPoint result = object.localToAncestorPoint(point, &ancestor, TraverseDo cumentBoundaries); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s", | 507 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s", |
| 507 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data()); | 508 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data()); |
| 508 showLayoutTree(&m_currentObject); | 509 showLayoutTree(&m_currentObject); |
| 509 | 510 |
| 510 ASSERT_NOT_REACHED(); | 511 ASSERT_NOT_REACHED(); |
| 511 } | 512 } |
| 512 | 513 |
| 513 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 514 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
| 514 | 515 |
| 515 } // namespace blink | 516 } // namespace blink |
| OLD | NEW |