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

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

Issue 2394913003: Fixed pos objects are offset from the top of the page in paged media (Closed)
Patch Set: bug 652449 Created 4 years, 2 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/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "core/layout/LayoutInline.h" 8 #include "core/layout/LayoutInline.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ClipPathClipper.h" 10 #include "core/paint/ClipPathClipper.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); 579 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
580 PaintLayerFragments fragments; 580 PaintLayerFragments fragments;
581 // TODO(crbug.com/619094): Figure out the correct behaviour for fixed position objects 581 // TODO(crbug.com/619094): Figure out the correct behaviour for fixed position objects
582 // in paged media with vertical writing modes. 582 // in paged media with vertical writing modes.
583 if (isFixedPosObjectInPagedMedia && view->isHorizontalWritingMode()) { 583 if (isFixedPosObjectInPagedMedia && view->isHorizontalWritingMode()) {
584 // "For paged media, boxes with fixed positions are repeated on every page." 584 // "For paged media, boxes with fixed positions are repeated on every page."
585 // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positio ning 585 // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positio ning
586 unsigned pages = 586 unsigned pages =
587 ceilf(view->documentRect().height() / view->pageLogicalHeight()); 587 ceilf(view->documentRect().height() / view->pageLogicalHeight());
588 LayoutPoint paginationOffset; 588 LayoutPoint paginationOffset;
589
590 // The fixed position object is offset from the top of the page, so remove a ny scroll offset.
Xianzhu 2016/10/06 22:40:42 Nit: Wrap at 80 chars. (Though there are other com
591 LayoutPoint offsetFromRoot;
592 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
593 paginationOffset -= offsetFromRoot - m_paintLayer.location();
594
589 for (unsigned i = 0; i < pages; i++) { 595 for (unsigned i = 0; i < pages; i++) {
590 PaintLayerFragment fragment; 596 PaintLayerFragment fragment;
591 fragment.backgroundRect = paintingInfo.paintDirtyRect; 597 fragment.backgroundRect = paintingInfo.paintDirtyRect;
592 fragment.paginationOffset = paginationOffset; 598 fragment.paginationOffset = paginationOffset;
593 fragments.append(fragment); 599 fragments.append(fragment);
594 paginationOffset += LayoutPoint(LayoutUnit(), view->pageLogicalHeight()); 600 paginationOffset += LayoutPoint(LayoutUnit(), view->pageLogicalHeight());
595 } 601 }
596 } else if (paginationLayer) { 602 } else if (paginationLayer) {
597 // FIXME: This is a mess. Look closely at this code and the code in Layer an d fix any 603 // FIXME: This is a mess. Look closely at this code and the code in Layer an d fix any
598 // issues in it & refactor to make it obvious from code structure what it do es and that it's 604 // issues in it & refactor to make it obvious from code structure what it do es and that it's
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1052
1047 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, 1053 PaintLayerPaintingInfo paintingInfo(&m_paintLayer,
1048 LayoutRect(enclosingIntRect(damageRect)), 1054 LayoutRect(enclosingIntRect(damageRect)),
1049 paintFlags, LayoutSize()); 1055 paintFlags, LayoutSize());
1050 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 1056 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
1051 1057
1052 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 1058 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
1053 } 1059 }
1054 1060
1055 } // namespace blink 1061 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698