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

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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 } else if (m_currentObject.isSVGRoot()) { 303 } else if (m_currentObject.isSVGRoot()) {
304 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject); 304 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject);
305 if (svgRoot.shouldApplyViewportClip()) 305 if (svgRoot.shouldApplyViewportClip())
306 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize()))); 306 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize())));
307 } else if (m_currentObject.isTableRow()) { 307 } else if (m_currentObject.isTableRow()) {
308 // Child table cell's locationOffset() includes its row's locationOffset (). 308 // Child table cell's locationOffset() includes its row's locationOffset ().
309 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); 309 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset();
310 } 310 }
311 311
312 if (!m_currentObject.hasOverflowClip()) 312 if (!m_currentObject.hasClipRelatedProperty())
313 return; 313 return;
314 314
315 const LayoutBox& box = toLayoutBox(m_currentObject); 315 const LayoutBox& box = toLayoutBox(m_currentObject);
316 316
317 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited 317 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited
318 // scrolling in this case. 318 // scrolling in this case.
319 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) { 319 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) {
320 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. 320 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited.
321 } else { 321 } else {
322 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint())); 322 // This won't work fully correctly for fixed-position elements, who shou ld receive CSS clip but for whom the current object
323 m_paintOffset -= box.scrolledContentOffset(); 323 // is not in the containing block chain.
324 addClipRectRelativeToPaintOffset(box.clippingRect());
325 if (box.hasOverflowClip())
326 m_paintOffset -= box.scrolledContentOffset();
324 } 327 }
325 328
326 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 329 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
327 } 330 }
328 331
329 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) 332 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point)
330 { 333 {
331 if (object.isLayoutView()) 334 if (object.isLayoutView())
332 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates); 335 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates);
333 FloatPoint result = object.localToAncestorPoint(point, &ancestor, TraverseDo cumentBoundaries); 336 FloatPoint result = object.localToAncestorPoint(point, &ancestor, TraverseDo cumentBoundaries);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 533 }
531 534
532 535
533 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking(cons t LayoutObject& object, LayoutRect& rect) const 536 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking(cons t LayoutObject& object, LayoutRect& rect) const
534 { 537 {
535 DCHECK(&object == &m_paintInvalidationState.currentObject()); 538 DCHECK(&object == &m_paintInvalidationState.currentObject());
536 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); 539 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect);
537 } 540 }
538 541
539 } // namespace blink 542 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698