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

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

Issue 2068723002: Paint local attachment backgrounds into composited scrolling contents layer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve opaque layer detection and fix non-composited border painting bug in layout tests. 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/paint/BackgroundImageGeometry.h" 5 #include "core/paint/BackgroundImageGeometry.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBox.h" 8 #include "core/layout/LayoutBox.h"
9 #include "core/layout/LayoutBoxModelObject.h" 9 #include "core/layout/LayoutBoxModelObject.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 void BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPo int) 247 void BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPo int)
248 { 248 {
249 LayoutPoint alignedPoint = attachmentPoint; 249 LayoutPoint alignedPoint = attachmentPoint;
250 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), LayoutUnit()), std: :max(alignedPoint.y() - m_destRect.y(), LayoutUnit())); 250 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), LayoutUnit()), std: :max(alignedPoint.y() - m_destRect.y(), LayoutUnit()));
251 setPhase(LayoutPoint(roundedIntPoint(m_phase))); 251 setPhase(LayoutPoint(roundedIntPoint(m_phase)));
252 } 252 }
253 253
254 void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L ayoutBoxModelObject* paintContainer, 254 void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L ayoutBoxModelObject* paintContainer,
255 const GlobalPaintFlags globalPaintFlags, const FillLayer& fillLayer, const L ayoutRect& paintRect) 255 const GlobalPaintFlags globalPaintFlags, const FillLayer& fillLayer, const L ayoutRect& paintRect, const bool layerIncludesBorders)
256 { 256 {
257 LayoutUnit left; 257 LayoutUnit left;
258 LayoutUnit top; 258 LayoutUnit top;
259 LayoutSize positioningAreaSize; 259 LayoutSize positioningAreaSize;
260 bool isLayoutView = obj.isLayoutView(); 260 bool isLayoutView = obj.isLayoutView();
261 const LayoutBox* rootBox = nullptr; 261 const LayoutBox* rootBox = nullptr;
262 if (isLayoutView) { 262 if (isLayoutView) {
263 // It is only possible reach here when root element has a box. 263 // It is only possible reach here when root element has a box.
264 Element* documentElement = obj.document().documentElement(); 264 Element* documentElement = obj.document().documentElement();
265 DCHECK(documentElement); 265 DCHECK(documentElement);
(...skipping 16 matching lines...) Expand all
282 fixedAttachment = false; 282 fixedAttachment = false;
283 } 283 }
284 284
285 if (!fixedAttachment) { 285 if (!fixedAttachment) {
286 setDestRect(paintRect); 286 setDestRect(paintRect);
287 287
288 LayoutUnit right; 288 LayoutUnit right;
289 LayoutUnit bottom; 289 LayoutUnit bottom;
290 // Scroll and Local. 290 // Scroll and Local.
291 if (fillLayer.origin() != BorderFillBox) { 291 if (fillLayer.origin() != BorderFillBox) {
292 left = LayoutUnit(positioningBox.borderLeft()); 292 if (layerIncludesBorders) {
293 right = LayoutUnit(positioningBox.borderRight()); 293 left = LayoutUnit(positioningBox.borderLeft());
294 top = LayoutUnit(positioningBox.borderTop()); 294 right = LayoutUnit(positioningBox.borderRight());
295 bottom = LayoutUnit(positioningBox.borderBottom()); 295 top = LayoutUnit(positioningBox.borderTop());
296 bottom = LayoutUnit(positioningBox.borderBottom());
297 }
296 if (fillLayer.origin() == ContentFillBox) { 298 if (fillLayer.origin() == ContentFillBox) {
297 left += positioningBox.paddingLeft(); 299 left += positioningBox.paddingLeft();
298 right += positioningBox.paddingRight(); 300 right += positioningBox.paddingRight();
299 top += positioningBox.paddingTop(); 301 top += positioningBox.paddingTop();
300 bottom += positioningBox.paddingBottom(); 302 bottom += positioningBox.paddingBottom();
301 } 303 }
302 } 304 }
303 305
304 if (isLayoutView) { 306 if (isLayoutView) {
305 // The background of the box generated by the root element covers th e entire canvas and will 307 // The background of the box generated by the root element covers th e entire canvas and will
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 useFixedAttachment(paintRect.location()); 417 useFixedAttachment(paintRect.location());
416 418
417 // Clip the final output rect to the paint rect 419 // Clip the final output rect to the paint rect
418 m_destRect.intersect(paintRect); 420 m_destRect.intersect(paintRect);
419 421
420 // Snap as-yet unsnapped values. 422 // Snap as-yet unsnapped values.
421 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); 423 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect)));
422 } 424 }
423 425
424 } // namespace blink 426 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698