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

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

Issue 2600903002: Paint the whole of a table-part background image behind the cells in a table (Closed)
Patch Set: Paint the whole of an image behind the cells in a table Created 3 years, 11 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/paint/BoxPainter.h" 5 #include "core/paint/BoxPainter.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
10 #include "core/layout/ImageQualityController.h" 10 #include "core/layout/ImageQualityController.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 const PaintInfo& paintInfo, 515 const PaintInfo& paintInfo,
516 const FillLayerInfo& info, 516 const FillLayerInfo& info,
517 const FillLayer& layer, 517 const FillLayer& layer,
518 const LayoutRect& rect, 518 const LayoutRect& rect,
519 BackgroundBleedAvoidance bleedAvoidance, 519 BackgroundBleedAvoidance bleedAvoidance,
520 const InlineFlowBox* box, 520 const InlineFlowBox* box,
521 const LayoutSize& boxSize, 521 const LayoutSize& boxSize,
522 SkBlendMode op, 522 SkBlendMode op,
523 const LayoutObject* backgroundObject, 523 const LayoutObject* backgroundObject,
524 Optional<BackgroundImageGeometry>& geometry) { 524 Optional<BackgroundImageGeometry>& geometry) {
525 // Painting a background image from an ancestor onto a cell is a complex case.
526 if (obj.isTableCell() && backgroundObject && !backgroundObject->isTableCell())
527 return false;
525 // Complex cases not handled on the fast path. 528 // Complex cases not handled on the fast path.
526 if (!info.isBottomLayer || !info.isBorderFill || 529 if (!info.isBottomLayer || !info.isBorderFill ||
527 info.isClippedWithLocalScrolling) 530 info.isClippedWithLocalScrolling)
528 return false; 531 return false;
529 532
530 // Transparent layer, nothing to paint. 533 // Transparent layer, nothing to paint.
531 if (!info.shouldPaintColor && !info.shouldPaintImage) 534 if (!info.shouldPaintColor && !info.shouldPaintImage)
532 return true; 535 return true;
533 536
534 // When the layer has an image, figure out whether it is covered by a single 537 // When the layer has an image, figure out whether it is covered by a single
535 // tile. 538 // tile.
536 FloatRect imageTile; 539 FloatRect imageTile;
537 if (info.shouldPaintImage) { 540 if (info.shouldPaintImage) {
538 DCHECK(!geometry); 541 DCHECK(!geometry);
539 geometry.emplace(); 542 geometry.emplace();
540 geometry->calculate(obj, paintInfo.paintContainer(), 543 geometry->calculate(obj, backgroundObject, paintInfo.paintContainer(),
541 paintInfo.getGlobalPaintFlags(), layer, rect); 544 paintInfo.getGlobalPaintFlags(), layer, rect);
542 545
543 if (!geometry->destRect().isEmpty()) { 546 if (!geometry->destRect().isEmpty()) {
544 // The tile is too small. 547 // The tile is too small.
545 if (geometry->tileSize().width() < rect.width() || 548 if (geometry->tileSize().width() < rect.width() ||
546 geometry->tileSize().height() < rect.height()) 549 geometry->tileSize().height() < rect.height())
547 return false; 550 return false;
548 551
549 imageTile = Image::computeTileContaining( 552 imageTile = Image::computeTileContaining(
550 FloatPoint(geometry->destRect().location()), 553 FloatPoint(geometry->destRect().location()),
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 // painting area. 743 // painting area.
741 if (info.isBottomLayer && info.color.alpha() && info.shouldPaintColor) { 744 if (info.isBottomLayer && info.color.alpha() && info.shouldPaintColor) {
742 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); 745 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));
743 context.fillRect(backgroundRect, info.color); 746 context.fillRect(backgroundRect, info.color);
744 } 747 }
745 748
746 // no progressive loading of the background image 749 // no progressive loading of the background image
747 if (info.shouldPaintImage) { 750 if (info.shouldPaintImage) {
748 if (!geometry) { 751 if (!geometry) {
749 geometry.emplace(); 752 geometry.emplace();
750 geometry->calculate(obj, paintInfo.paintContainer(), 753 geometry->calculate(obj, backgroundObject, paintInfo.paintContainer(),
751 paintInfo.getGlobalPaintFlags(), bgLayer, 754 paintInfo.getGlobalPaintFlags(), bgLayer,
752 scrolledPaintRect); 755 scrolledPaintRect);
753 } else { 756 } else {
754 // The geometry was calculated in paintFastBottomLayer(). 757 // The geometry was calculated in paintFastBottomLayer().
755 DCHECK(info.isBottomLayer && info.isBorderFill && 758 DCHECK(info.isBottomLayer && info.isBorderFill &&
756 !info.isClippedWithLocalScrolling); 759 !info.isClippedWithLocalScrolling);
757 } 760 }
758 761
759 if (!geometry->destRect().isEmpty()) { 762 if (!geometry->destRect().isEmpty()) {
760 const ImagePaintContext imageContext(obj, context, bgLayer, *info.image, 763 const ImagePaintContext imageContext(obj, context, bgLayer, *info.image,
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( 1086 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(
1084 const ComputedStyle& style, 1087 const ComputedStyle& style,
1085 const Document& document) { 1088 const Document& document) {
1086 return document.printing() && 1089 return document.printing() &&
1087 style.printColorAdjust() == EPrintColorAdjust::kEconomy && 1090 style.printColorAdjust() == EPrintColorAdjust::kEconomy &&
1088 (!document.settings() || 1091 (!document.settings() ||
1089 !document.settings()->getShouldPrintBackgrounds()); 1092 !document.settings()->getShouldPrintBackgrounds());
1090 } 1093 }
1091 1094
1092 } // namespace blink 1095 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698