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

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

Issue 2219153002: Offset repeating theads correctly when two tables adjoin at a page border (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug 634404 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/TableSectionPainter.h" 5 #include "core/paint/TableSectionPainter.h"
6 6
7 #include "core/layout/LayoutTableCell.h" 7 #include "core/layout/LayoutTableCell.h"
8 #include "core/layout/LayoutTableCol.h" 8 #include "core/layout/LayoutTableCol.h"
9 #include "core/layout/LayoutTableRow.h" 9 #include "core/layout/LayoutTableRow.h"
10 #include "core/paint/BoxClipper.h" 10 #include "core/paint/BoxClipper.h"
(...skipping 27 matching lines...) Expand all
38 void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint) 38 void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint)
39 { 39 {
40 if (!m_layoutTableSection.hasRepeatingHeaderGroup()) 40 if (!m_layoutTableSection.hasRepeatingHeaderGroup())
41 return; 41 return;
42 42
43 LayoutTable* table = m_layoutTableSection.table(); 43 LayoutTable* table = m_layoutTableSection.table();
44 LayoutPoint paginationOffset = paintOffset; 44 LayoutPoint paginationOffset = paintOffset;
45 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); 45 LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit());
46 46
47 // Move paginationOffset to the top of the next page. 47 // Move paginationOffset to the top of the next page.
48 LayoutUnit offsetToNextPage = pageHeight - intMod(table->pageLogicalOffset() , pageHeight); 48 // The header may have a pagination strut before it so we need to account fo r that when establishing its position.
49 LayoutUnit headerGroupOffset = table->pageLogicalOffset() + m_layoutTableSec tion.paginationStrutForRow(m_layoutTableSection.firstRow(), table->pageLogicalOf fset());
mstensho (USE GERRIT) 2016/08/10 09:42:48 m_layoutTableSection.firstRow() may be nullptr. W
rhogan 2016/08/10 18:05:14 We don't propagate the strut to the logical top of
50 LayoutUnit offsetToNextPage = pageHeight - intMod(headerGroupOffset, pageHei ght);
49 paginationOffset.move(0, offsetToNextPage); 51 paginationOffset.move(0, offsetToNextPage);
50 // Now move paginationOffset to the top of the page the cull rect starts on. 52 // Now move paginationOffset to the top of the page the cull rect starts on.
51 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) 53 if (paintInfo.cullRect().m_rect.y() > paginationOffset.y())
52 paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRe ct().m_rect.y() - paginationOffset.y()) / pageHeight)); 54 paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRe ct().m_rect.y() - paginationOffset.y()) / pageHeight));
53 LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.max Y()), paintOffset.y() + table->logicalHeight()); 55 LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.max Y()), paintOffset.y() + table->logicalHeight());
54 while (paginationOffset.y() < bottomBound) { 56 while (paginationOffset.y() < bottomBound) {
55 LayoutPoint nestedOffset = paginationOffset + LayoutPoint(0, m_layoutTab leSection.offsetForRepeatingHeader()); 57 LayoutPoint nestedOffset = paginationOffset + LayoutPoint(0, m_layoutTab leSection.offsetForRepeatingHeader());
56 if (itemToPaint == PaintCollapsedBorders) 58 if (itemToPaint == PaintCollapsedBorders)
57 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderV alue); 59 paintCollapsedSectionBorders(paintInfo, nestedOffset, currentBorderV alue);
58 else 60 else
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo xShadowNormal : DisplayItem::TableSectionBoxShadowInset; 298 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo xShadowNormal : DisplayItem::TableSectionBoxShadowInset;
297 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTableSection, type)) 299 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTableSection, type))
298 return; 300 return;
299 301
300 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde r(paintOffset); 302 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde r(paintOffset);
301 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection , type, bounds); 303 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection , type, bounds);
302 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS ection.size()), m_layoutTableSection.styleRef(), shadowStyle); 304 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS ection.size()), m_layoutTableSection.styleRef(), shadowStyle);
303 } 305 }
304 306
305 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698