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

Side by Side Diff: Source/core/paint/BoxPainter.cpp

Issue 1303413004: Convert some call sites to use explicit LayoutRect->FloatRect conversion. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/paint/BoxPainter.h" 6 #include "core/paint/BoxPainter.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLFrameOwnerElement.h" 10 #include "core/html/HTMLFrameOwnerElement.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 int bLeft = includeLeftEdge ? obj.borderLeft() : 0; 380 int bLeft = includeLeftEdge ? obj.borderLeft() : 0;
381 int bRight = includeRightEdge ? obj.borderRight() : 0; 381 int bRight = includeRightEdge ? obj.borderRight() : 0;
382 LayoutUnit pLeft = includeLeftEdge ? obj.paddingLeft() : LayoutUnit(); 382 LayoutUnit pLeft = includeLeftEdge ? obj.paddingLeft() : LayoutUnit();
383 LayoutUnit pRight = includeRightEdge ? obj.paddingRight() : LayoutUnit(); 383 LayoutUnit pRight = includeRightEdge ? obj.paddingRight() : LayoutUnit();
384 384
385 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling); 385 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling);
386 LayoutRect scrolledPaintRect = rect; 386 LayoutRect scrolledPaintRect = rect;
387 if (clippedWithLocalScrolling) { 387 if (clippedWithLocalScrolling) {
388 // Clip to the overflow area. 388 // Clip to the overflow area.
389 LayoutBox* thisBox = toLayoutBox(&obj); 389 LayoutBox* thisBox = toLayoutBox(&obj);
390 context->clip(thisBox->overflowClipRect(rect.location())); 390 // TODO(chrishtr): this should be pixel-snapped.
391 context->clip(FloatRect(thisBox->overflowClipRect(rect.location())));
391 392
392 // Adjust the paint rect to reflect a scrolled content box with borders at the ends. 393 // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
393 IntSize offset = thisBox->scrolledContentOffset(); 394 IntSize offset = thisBox->scrolledContentOffset();
394 scrolledPaintRect.move(-offset); 395 scrolledPaintRect.move(-offset);
395 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight); 396 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight);
396 scrolledPaintRect.setHeight(thisBox->borderTop() + thisBox->scrollHeight () + thisBox->borderBottom()); 397 scrolledPaintRect.setHeight(thisBox->borderTop() + thisBox->scrollHeight () + thisBox->borderBottom());
397 } 398 }
398 399
399 GraphicsContextStateSaver backgroundClipStateSaver(*context, false); 400 GraphicsContextStateSaver backgroundClipStateSaver(*context, false);
400 IntRect maskRect; 401 IntRect maskRect;
401 402
402 switch (bgLayer.clip()) { 403 switch (bgLayer.clip()) {
403 case PaddingFillBox: 404 case PaddingFillBox:
404 case ContentFillBox: { 405 case ContentFillBox: {
405 if (clipToBorderRadius) 406 if (clipToBorderRadius)
406 break; 407 break;
407 408
408 // Clip to the padding or content boxes as necessary. 409 // Clip to the padding or content boxes as necessary.
409 bool includePadding = bgLayer.clip() == ContentFillBox; 410 bool includePadding = bgLayer.clip() == ContentFillBox;
410 LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includ ePadding ? pLeft : LayoutUnit()), 411 LayoutRect clipRect(scrolledPaintRect.x() + bLeft + (includePadding ? pL eft : LayoutUnit()),
411 scrolledPaintRect.y() + obj.borderTop() + (includePadding ? obj.padd ingTop() : LayoutUnit()), 412 scrolledPaintRect.y() + obj.borderTop() + (includePadding ? obj.padd ingTop() : LayoutUnit()),
412 scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : LayoutUnit()), 413 scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : LayoutUnit()),
413 scrolledPaintRect.height() - obj.borderTop() - obj.borderBottom() - (includePadding ? obj.paddingTop() + obj.paddingBottom() : LayoutUnit())); 414 scrolledPaintRect.height() - obj.borderTop() - obj.borderBottom() - (includePadding ? obj.paddingTop() + obj.paddingBottom() : LayoutUnit()));
414 backgroundClipStateSaver.save(); 415 backgroundClipStateSaver.save();
415 context->clip(clipRect); 416 // TODO(chrishtr): this should be pixel-snapped.
417 context->clip(FloatRect(clipRect));
416 418
417 break; 419 break;
418 } 420 }
419 case TextFillBox: { 421 case TextFillBox: {
420 // First figure out how big the mask has to be. It should be no bigger t han what we need 422 // First figure out how big the mask has to be. It should be no bigger t han what we need
421 // to actually render, so we should intersect the dirty rect with the bo rder box of the background. 423 // to actually render, so we should intersect the dirty rect with the bo rder box of the background.
422 maskRect = pixelSnappedIntRect(rect); 424 maskRect = pixelSnappedIntRect(rect);
423 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 425 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
424 maskRect.intersect(paintInfo.rect); 426 maskRect.intersect(paintInfo.rect);
425 427
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 762 }
761 } 763 }
762 764
763 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) 765 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document)
764 { 766 {
765 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy 767 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy
766 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); 768 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ());
767 } 769 }
768 770
769 } // namespace blink 771 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BoxBorderPainter.cpp ('k') | Source/core/paint/DeprecatedPaintLayerClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698