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

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 2241663002: Take CSS Clip and contain: paint into account when computing visual rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698