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

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

Issue 1592493002: Fix links in inline continuations in printed PDF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an extra condition Created 4 years, 11 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/BlockPainter.h" 5 #include "core/paint/BlockPainter.h"
6 6
7 #include "core/editing/DragCaretController.h" 7 #include "core/editing/DragCaretController.h"
8 #include "core/editing/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutBlockFlow.h" 10 #include "core/layout/LayoutBlockFlow.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) { 144 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) {
145 m_layoutBlock.paintMask(paintInfo, paintOffset); 145 m_layoutBlock.paintMask(paintInfo, paintOffset);
146 return; 146 return;
147 } 147 }
148 148
149 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) { 149 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) {
150 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); 150 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset);
151 return; 151 return;
152 } 152 }
153 153
154 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872),
155 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase.
156 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) 154 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting())
157 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse t); 155 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse t);
158 156
159 { 157 {
160 Optional<ScrollRecorder> scrollRecorder; 158 Optional<ScrollRecorder> scrollRecorder;
161 Optional<PaintInfo> scrolledPaintInfo; 159 Optional<PaintInfo> scrolledPaintInfo;
162 if (m_layoutBlock.hasOverflowClip()) { 160 if (m_layoutBlock.hasOverflowClip()) {
163 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); 161 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset();
164 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) { 162 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) {
165 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset); 163 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (m_layoutBlock.hasCursorCaret()) 204 if (m_layoutBlock.hasCursorCaret())
207 frame->selection().paintCaret(paintInfo.context, paintOffset); 205 frame->selection().paintCaret(paintInfo.context, paintOffset);
208 206
209 if (m_layoutBlock.hasDragCaret()) 207 if (m_layoutBlock.hasDragCaret())
210 frame->page()->dragCaretController().paintDragCaret(frame, paintInfo.con text, paintOffset); 208 frame->page()->dragCaretController().paintDragCaret(frame, paintInfo.con text, paintOffset);
211 } 209 }
212 210
213 bool BlockPainter::intersectsPaintRect(const PaintInfo& paintInfo, const LayoutP oint& paintOffset) const 211 bool BlockPainter::intersectsPaintRect(const PaintInfo& paintInfo, const LayoutP oint& paintOffset) const
214 { 212 {
215 LayoutRect overflowRect = m_layoutBlock.visualOverflowRect(); 213 LayoutRect overflowRect = m_layoutBlock.visualOverflowRect();
214
215 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && m_layoutBl ock.childrenInline()) {
chrishtr 2016/01/15 18:16:35 How about: if (paintInfo.isPrinting()) return t
Xianzhu 2016/01/15 18:36:29 During printing, we paint each page separately (ht
216 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the anonymous container
217 // of <a>, the anonymous container's visual overflow is empty, but we ne ed to continue
218 // painting to output <a>'s PDF URL rect which covers the continuations, as if we included
219 // <a>'s PDF URL rect into m_layoutBlock's visual overflow. For simplici ty, we just check
220 // if the parent block intersects paint rect.
221 return BlockPainter(toLayoutBlock(*m_layoutBlock.parent())).intersectsPa intRect(paintInfo, paintOffset);
Xianzhu 2016/01/19 20:25:33 Now call m_layoutBlock.addElementVisualOverflowRec
222 }
223
216 if (m_layoutBlock.hasOverflowModel() && m_layoutBlock.usesCompositedScrollin g()) { 224 if (m_layoutBlock.hasOverflowModel() && m_layoutBlock.usesCompositedScrollin g()) {
217 overflowRect.unite(m_layoutBlock.layoutOverflowRect()); 225 overflowRect.unite(m_layoutBlock.layoutOverflowRect());
218 overflowRect.move(-m_layoutBlock.scrolledContentOffset()); 226 overflowRect.move(-m_layoutBlock.scrolledContentOffset());
219 } 227 }
220 m_layoutBlock.flipForWritingMode(overflowRect); 228 m_layoutBlock.flipForWritingMode(overflowRect);
221 overflowRect.moveBy(paintOffset + m_layoutBlock.location()); 229 overflowRect.moveBy(paintOffset + m_layoutBlock.location());
222 return paintInfo.cullRect().intersectsCullRect(overflowRect); 230 return paintInfo.cullRect().intersectsCullRect(overflowRect);
223 } 231 }
224 232
225 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 233 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
(...skipping 15 matching lines...) Expand all
241 249
242 // We don't paint our own background, but we do let the kids paint their backgrounds. 250 // We don't paint our own background, but we do let the kids paint their backgrounds.
243 PaintInfo paintInfoForChild(paintInfo); 251 PaintInfo paintInfoForChild(paintInfo);
244 paintInfoForChild.phase = newPhase; 252 paintInfoForChild.phase = newPhase;
245 paintInfoForChild.updatePaintingRootForChildren(&m_layoutBlock); 253 paintInfoForChild.updatePaintingRootForChildren(&m_layoutBlock);
246 m_layoutBlock.paintChildren(paintInfoForChild, paintOffset); 254 m_layoutBlock.paintChildren(paintInfoForChild, paintOffset);
247 } 255 }
248 } 256 }
249 257
250 } // namespace blink 258 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/PrintContextTest.cpp ('k') | third_party/WebKit/Source/core/paint/InlinePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698