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

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

Issue 1575983002: Display fixed position objects on every page of paged media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 9 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/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/LayoutBlock.h" 10 #include "core/layout/LayoutBlock.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 ClipRect ancestorBackgroundClipRect; 448 ClipRect ancestorBackgroundClipRect;
449 if (parentLayer) { 449 if (parentLayer) {
450 // Calculate the clip rectangle that the ancestors establish. 450 // Calculate the clip rectangle that the ancestors establish.
451 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver layScrollbarSize); 451 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver layScrollbarSize);
452 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) = = IgnoreOverflowClip) 452 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) = = IgnoreOverflowClip)
453 clipRectsContext.setIgnoreOverflowClip(); 453 clipRectsContext.setIgnoreOverflowClip();
454 ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(c lipRectsContext); 454 ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(c lipRectsContext);
455 } 455 }
456 456
457 LayoutObject* object = m_paintLayer.layoutObject();
458 LayoutView* view = object->view();
459 bool isFixedPosObjectInPagedMedia = object->style()->position() == FixedPosi tion && object->container() == view && view->pageLogicalHeight();
457 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); 460 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
458 PaintLayerFragments fragments; 461 PaintLayerFragments fragments;
459 if (paginationLayer) { 462 if (isFixedPosObjectInPagedMedia) {
463 // "For paged media, boxes with fixed positions are repeated on every pa ge."
464 // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-pos itioning
465 ASSERT(view->firstChild() && view->firstChild()->isLayoutBlock());
466 int pages = toLayoutBlock(view->firstChild())->logicalHeight() / view->p ageLogicalHeight();
467 LayoutPoint paginationOffset;
468 for (int i = 0; i <= pages; i++) {
469 PaintLayerFragment fragment;
470 fragment.backgroundRect = paintingInfo.paintDirtyRect;
471 fragment.paginationOffset = paginationOffset;
472 fragments.append(fragment);
473 paginationOffset += LayoutPoint(0, view->pageLogicalHeight());
474 }
475 } else if (paginationLayer) {
460 // FIXME: This is a mess. Look closely at this code and the code in Laye r and fix any 476 // FIXME: This is a mess. Look closely at this code and the code in Laye r and fix any
461 // issues in it & refactor to make it obvious from code structure what i t does and that it's 477 // issues in it & refactor to make it obvious from code structure what i t does and that it's
462 // correct. 478 // correct.
463 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; 479 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects;
464 ShouldRespectOverflowClipType respectOverflowClip = shouldRespectOverflo wClip(paintFlags, m_paintLayer.layoutObject()); 480 ShouldRespectOverflowClipType respectOverflowClip = shouldRespectOverflo wClip(paintFlags, m_paintLayer.layoutObject());
465 // Calculate the transformed bounding box in the current coordinate spac e, to figure out 481 // Calculate the transformed bounding box in the current coordinate spac e, to figure out
466 // which fragmentainers (e.g. columns) we need to visit. 482 // which fragmentainers (e.g. columns) we need to visit.
467 LayoutRect transformedExtent = PaintLayer::transparencyClipBox(&m_paintL ayer, paginationLayer, PaintLayer::PaintingTransparencyClipBox, PaintLayer::Root OfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.getGlobal PaintFlags()); 483 LayoutRect transformedExtent = PaintLayer::transparencyClipBox(&m_paintL ayer, paginationLayer, PaintLayer::PaintingTransparencyClipBox, PaintLayer::Root OfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.getGlobal PaintFlags());
468 // FIXME: we don't check if paginationLayer is within paintingInfo.rootL ayer here. 484 // FIXME: we don't check if paginationLayer is within paintingInfo.rootL ayer here.
469 paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, pai ntingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflow Clip, 0, paintingInfo.subPixelAccumulation, &transformedExtent); 485 paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, pai ntingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflow Clip, 0, paintingInfo.subPixelAccumulation, &transformedExtent);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 783 if (!m_paintLayer.containsDirtyOverlayScrollbars())
768 return; 784 return;
769 785
770 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); 786 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize());
771 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 787 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
772 788
773 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 789 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
774 } 790 }
775 791
776 } // namespace blink 792 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698