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

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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); 601 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
602 PaintLayerFragments fragments; 602 PaintLayerFragments fragments;
603 // TODO(crbug.com/619094): Figure out the correct behaviour for fixed position 603 // TODO(crbug.com/619094): Figure out the correct behaviour for fixed position
604 // objects in paged media with vertical writing modes. 604 // objects in paged media with vertical writing modes.
605 if (isFixedPosObjectInPagedMedia && view->isHorizontalWritingMode()) { 605 if (isFixedPosObjectInPagedMedia && view->isHorizontalWritingMode()) {
606 // "For paged media, boxes with fixed positions are repeated on every page." 606 // "For paged media, boxes with fixed positions are repeated on every page."
607 // https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positioni ng 607 // https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positioni ng
608 unsigned pages = 608 unsigned pages =
609 ceilf(view->documentRect().height() / view->pageLogicalHeight()); 609 ceilf(view->documentRect().height() / view->pageLogicalHeight());
610 LayoutPoint paginationOffset; 610 LayoutPoint paginationOffset;
611
612 // The fixed position object is offset from the top of the page, so remove
613 // any scroll offset.
614 LayoutPoint offsetFromRoot;
615 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
616 paginationOffset -= offsetFromRoot - m_paintLayer.location();
617
611 for (unsigned i = 0; i < pages; i++) { 618 for (unsigned i = 0; i < pages; i++) {
612 PaintLayerFragment fragment; 619 PaintLayerFragment fragment;
613 fragment.backgroundRect = paintingInfo.paintDirtyRect; 620 fragment.backgroundRect = paintingInfo.paintDirtyRect;
614 fragment.paginationOffset = paginationOffset; 621 fragment.paginationOffset = paginationOffset;
615 fragments.append(fragment); 622 fragments.append(fragment);
616 paginationOffset += LayoutPoint(LayoutUnit(), view->pageLogicalHeight()); 623 paginationOffset += LayoutPoint(LayoutUnit(), view->pageLogicalHeight());
617 } 624 }
618 } else if (paginationLayer) { 625 } else if (paginationLayer) {
619 // FIXME: This is a mess. Look closely at this code and the code in Layer 626 // FIXME: This is a mess. Look closely at this code and the code in Layer
620 // and fix any issues in it & refactor to make it obvious from code 627 // and fix any issues in it & refactor to make it obvious from code
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 1083
1077 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, 1084 PaintLayerPaintingInfo paintingInfo(&m_paintLayer,
1078 LayoutRect(enclosingIntRect(damageRect)), 1085 LayoutRect(enclosingIntRect(damageRect)),
1079 paintFlags, LayoutSize()); 1086 paintFlags, LayoutSize());
1080 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 1087 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
1081 1088
1082 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 1089 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
1083 } 1090 }
1084 1091
1085 } // namespace blink 1092 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698