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

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

Issue 2254433004: Fix bad cast in PaintInvalidationState::updateForNormalChildren() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/svg-clip-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 m_cachedOffsetsForAbsolutePositionEnabled = false; 284 m_cachedOffsetsForAbsolutePositionEnabled = false;
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 void PaintInvalidationState::updateForNormalChildren() 289 void PaintInvalidationState::updateForNormalChildren()
290 { 290 {
291 if (!m_cachedOffsetsEnabled) 291 if (!m_cachedOffsetsEnabled)
292 return; 292 return;
293 293
294 if (!m_currentObject.isBoxModelObject() && !m_currentObject.isSVG()) 294 if (!m_currentObject.isBox())
295 return; 295 return;
296 const LayoutBox& box = toLayoutBox(m_currentObject);
296 297
297 if (m_currentObject.isLayoutView()) { 298 if (box.isLayoutView()) {
298 if (!m_currentObject.document().settings() || !m_currentObject.document( ).settings()->rootLayerScrolls()) { 299 if (!box.document().settings() || !box.document().settings()->rootLayerS crolls()) {
299 if (m_currentObject != m_paintInvalidationContainer) { 300 if (box != m_paintInvalidationContainer) {
300 m_paintOffset -= toLayoutView(m_currentObject).frameView()->scro llOffset(); 301 m_paintOffset -= toLayoutView(box).frameView()->scrollOffset();
301 addClipRectRelativeToPaintOffset(toLayoutView(m_currentObject).v iewRect()); 302 addClipRectRelativeToPaintOffset(toLayoutView(box).viewRect());
302 } 303 }
303 return; 304 return;
304 } 305 }
305 } else if (m_currentObject.isSVGRoot()) { 306 } else if (box.isSVGRoot()) {
306 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(m_currentObject); 307 const LayoutSVGRoot& svgRoot = toLayoutSVGRoot(box);
307 if (svgRoot.shouldApplyViewportClip()) 308 if (svgRoot.shouldApplyViewportClip())
308 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize()))); 309 addClipRectRelativeToPaintOffset(LayoutRect(LayoutPoint(), LayoutSiz e(svgRoot.pixelSnappedSize())));
309 } else if (m_currentObject.isTableRow()) { 310 } else if (box.isTableRow()) {
310 // Child table cell's locationOffset() includes its row's locationOffset (). 311 // Child table cell's locationOffset() includes its row's locationOffset ().
311 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); 312 m_paintOffset -= box.locationOffset();
312 } 313 }
313 314
314 if (!m_currentObject.hasClipRelatedProperty()) 315 if (!box.hasClipRelatedProperty())
315 return; 316 return;
316 317
317 const LayoutBox& box = toLayoutBox(m_currentObject);
318
319 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited 318 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited
320 // scrolling in this case. 319 // scrolling in this case.
321 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) { 320 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) {
322 DCHECK(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. 321 DCHECK(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited.
323 } else { 322 } else {
324 // This won't work fully correctly for fixed-position elements, who shou ld receive CSS clip but for whom the current object 323 // This won't work fully correctly for fixed-position elements, who shou ld receive CSS clip but for whom the current object
325 // is not in the containing block chain. 324 // is not in the containing block chain.
326 addClipRectRelativeToPaintOffset(box.clippingRect()); 325 addClipRectRelativeToPaintOffset(box.clippingRect());
327 if (box.hasOverflowClip()) 326 if (box.hasOverflowClip())
328 m_paintOffset -= box.scrolledContentOffset(); 327 m_paintOffset -= box.scrolledContentOffset();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 539 }
541 540
542 541
543 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking(cons t LayoutObject& object, LayoutRect& rect) const 542 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking(cons t LayoutObject& object, LayoutRect& rect) const
544 { 543 {
545 DCHECK(&object == &m_paintInvalidationState.currentObject()); 544 DCHECK(&object == &m_paintInvalidationState.currentObject());
546 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); 545 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect);
547 } 546 }
548 547
549 } // namespace blink 548 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/svg-clip-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698