| OLD | NEW |
| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) =
= IgnoreOverflowClip) | 475 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) =
= IgnoreOverflowClip) |
| 476 clipRectsContext.setIgnoreOverflowClip(); | 476 clipRectsContext.setIgnoreOverflowClip(); |
| 477 ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(c
lipRectsContext); | 477 ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(c
lipRectsContext); |
| 478 } | 478 } |
| 479 | 479 |
| 480 LayoutObject* object = m_paintLayer.layoutObject(); | 480 LayoutObject* object = m_paintLayer.layoutObject(); |
| 481 LayoutView* view = object->view(); | 481 LayoutView* view = object->view(); |
| 482 bool isFixedPosObjectInPagedMedia = object->style()->position() == FixedPosi
tion && object->container() == view && view->pageLogicalHeight(); | 482 bool isFixedPosObjectInPagedMedia = object->style()->position() == FixedPosi
tion && object->container() == view && view->pageLogicalHeight(); |
| 483 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); | 483 PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); |
| 484 PaintLayerFragments fragments; | 484 PaintLayerFragments fragments; |
| 485 if (isFixedPosObjectInPagedMedia) { | 485 // TODO(crbug.com/619094): Figure out the correct behaviour for fixed positi
on objects |
| 486 // in paged media with vertical writing modes. |
| 487 if (isFixedPosObjectInPagedMedia && view->isHorizontalWritingMode()) { |
| 486 // "For paged media, boxes with fixed positions are repeated on every pa
ge." | 488 // "For paged media, boxes with fixed positions are repeated on every pa
ge." |
| 487 // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-pos
itioning | 489 // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-pos
itioning |
| 488 ASSERT(view->firstChild() && view->firstChild()->isLayoutBlock()); | 490 unsigned pages = ceilf(view->documentRect().height() / view->pageLogical
Height()); |
| 489 int pages = static_cast<int>(ceilf(toLayoutBlock(view->firstChild())->lo
gicalHeight() / view->pageLogicalHeight())); | |
| 490 LayoutPoint paginationOffset; | 491 LayoutPoint paginationOffset; |
| 491 for (int i = 0; i < pages; i++) { | 492 for (unsigned i = 0; i < pages; i++) { |
| 492 PaintLayerFragment fragment; | 493 PaintLayerFragment fragment; |
| 493 fragment.backgroundRect = paintingInfo.paintDirtyRect; | 494 fragment.backgroundRect = paintingInfo.paintDirtyRect; |
| 494 fragment.paginationOffset = paginationOffset; | 495 fragment.paginationOffset = paginationOffset; |
| 495 fragments.append(fragment); | 496 fragments.append(fragment); |
| 496 paginationOffset += LayoutPoint(0, view->pageLogicalHeight()); | 497 paginationOffset += LayoutPoint(0, view->pageLogicalHeight()); |
| 497 } | 498 } |
| 498 } else if (paginationLayer) { | 499 } else if (paginationLayer) { |
| 499 // FIXME: This is a mess. Look closely at this code and the code in Laye
r and fix any | 500 // FIXME: This is a mess. Look closely at this code and the code in Laye
r and fix any |
| 500 // issues in it & refactor to make it obvious from code structure what i
t does and that it's | 501 // issues in it & refactor to make it obvious from code structure what i
t does and that it's |
| 501 // correct. | 502 // correct. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 804 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 804 return; | 805 return; |
| 805 | 806 |
| 806 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); | 807 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe
ct(damageRect)), paintFlags, LayoutSize()); |
| 807 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 808 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 808 | 809 |
| 809 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 810 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 810 } | 811 } |
| 811 | 812 |
| 812 } // namespace blink | 813 } // namespace blink |
| OLD | NEW |