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

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp

Issue 2672983003: Implements PrintBrowser mode. (Closed)
Patch Set: Add tests and respond to comments Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/ObjectPaintInvalidator.h" 5 #include "core/paint/ObjectPaintInvalidator.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/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/api/LayoutPartItem.h" 10 #include "core/layout/api/LayoutPartItem.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return value; 274 return value;
275 } 275 }
276 276
277 static void invalidatePaintRectangleOnWindow( 277 static void invalidatePaintRectangleOnWindow(
278 const LayoutBoxModelObject& paintInvalidationContainer, 278 const LayoutBoxModelObject& paintInvalidationContainer,
279 const IntRect& dirtyRect) { 279 const IntRect& dirtyRect) {
280 FrameView* frameView = paintInvalidationContainer.frameView(); 280 FrameView* frameView = paintInvalidationContainer.frameView();
281 DCHECK(paintInvalidationContainer.isLayoutView() && 281 DCHECK(paintInvalidationContainer.isLayoutView() &&
282 paintInvalidationContainer.layer()->compositingState() == 282 paintInvalidationContainer.layer()->compositingState() ==
283 NotComposited); 283 NotComposited);
284 if (!frameView || paintInvalidationContainer.document().printing()) 284
285 if (!frameView)
286 return;
287
288 if (paintInvalidationContainer.document().printing() &&
289 !RuntimeEnabledFeatures::printBrowserEnabled())
285 return; 290 return;
286 291
287 DCHECK(frameView->frame().ownerLayoutItem().isNull()); 292 DCHECK(frameView->frame().ownerLayoutItem().isNull());
288 293
289 IntRect paintRect = dirtyRect; 294 IntRect paintRect = dirtyRect;
290 paintRect.intersect(frameView->visibleContentRect()); 295 paintRect.intersect(frameView->visibleContentRect());
291 if (paintRect.isEmpty()) 296 if (paintRect.isEmpty())
292 return; 297 return;
293 298
294 if (HostWindow* window = frameView->getHostWindow()) 299 if (HostWindow* window = frameView->getHostWindow())
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 388 }
384 389
385 LayoutRect ObjectPaintInvalidator::invalidatePaintRectangle( 390 LayoutRect ObjectPaintInvalidator::invalidatePaintRectangle(
386 const LayoutRect& dirtyRect, 391 const LayoutRect& dirtyRect,
387 DisplayItemClient* displayItemClient) { 392 DisplayItemClient* displayItemClient) {
388 CHECK(m_object.isRooted()); 393 CHECK(m_object.isRooted());
389 394
390 if (dirtyRect.isEmpty()) 395 if (dirtyRect.isEmpty())
391 return LayoutRect(); 396 return LayoutRect();
392 397
393 if (m_object.view()->document().printing()) 398 if (m_object.view()->document().printing() &&
399 !RuntimeEnabledFeatures::printBrowserEnabled())
394 return LayoutRect(); // Don't invalidate paints if we're printing. 400 return LayoutRect(); // Don't invalidate paints if we're printing.
395 401
396 const LayoutBoxModelObject& paintInvalidationContainer = 402 const LayoutBoxModelObject& paintInvalidationContainer =
397 m_object.containerForPaintInvalidation(); 403 m_object.containerForPaintInvalidation();
398 LayoutRect dirtyRectOnBacking = dirtyRect; 404 LayoutRect dirtyRectOnBacking = dirtyRect;
399 PaintLayer::mapRectToPaintInvalidationBacking( 405 PaintLayer::mapRectToPaintInvalidationBacking(
400 m_object, paintInvalidationContainer, dirtyRectOnBacking); 406 m_object, paintInvalidationContainer, dirtyRectOnBacking);
401 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation( 407 dirtyRectOnBacking.move(m_object.scrollAdjustmentForPaintInvalidation(
402 paintInvalidationContainer)); 408 paintInvalidationContainer));
403 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking, 409 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRectOnBacking,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 610
605 m_context.paintingLayer->setNeedsRepaint(); 611 m_context.paintingLayer->setNeedsRepaint();
606 m_object.invalidateDisplayItemClients(reason); 612 m_object.invalidateDisplayItemClients(reason);
607 return reason; 613 return reason;
608 } 614 }
609 615
610 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 616 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
611 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} 617 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {}
612 618
613 } // namespace blink 619 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698