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

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: 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) { 153 if (paintPhase == PaintPhaseMask && m_layoutBlock.style()->visibility() == V ISIBLE) {
154 m_layoutBlock.paintMask(paintInfo, paintOffset); 154 m_layoutBlock.paintMask(paintInfo, paintOffset);
155 return; 155 return;
156 } 156 }
157 157
158 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) { 158 if (paintPhase == PaintPhaseClippingMask && m_layoutBlock.style()->visibilit y() == VISIBLE) {
159 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset); 159 BoxPainter(m_layoutBlock).paintClippingMask(paintInfo, paintOffset);
160 return; 160 return;
161 } 161 }
162 162
163 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872),
164 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase.
165 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting()) 163 if (paintPhase == PaintPhaseForeground && paintInfo.isPrinting())
166 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse t); 164 ObjectPainter(m_layoutBlock).addPDFURLRectIfNeeded(paintInfo, paintOffse t);
167 165
168 if (paintPhase != PaintPhaseSelfOutlineOnly) { 166 if (paintPhase != PaintPhaseSelfOutlineOnly) {
169 Optional<ScrollRecorder> scrollRecorder; 167 Optional<ScrollRecorder> scrollRecorder;
170 Optional<PaintInfo> scrolledPaintInfo; 168 Optional<PaintInfo> scrolledPaintInfo;
171 if (m_layoutBlock.hasOverflowClip()) { 169 if (m_layoutBlock.hasOverflowClip()) {
172 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset(); 170 IntSize scrollOffset = m_layoutBlock.scrolledContentOffset();
173 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) { 171 if (m_layoutBlock.layer()->scrollsOverflow() || !scrollOffset.isZero ()) {
174 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset); 172 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 207
210 if (m_layoutBlock.hasCursorCaret()) 208 if (m_layoutBlock.hasCursorCaret())
211 frame->selection().paintCaret(paintInfo.context, paintOffset); 209 frame->selection().paintCaret(paintInfo.context, paintOffset);
212 210
213 if (m_layoutBlock.hasDragCaret()) 211 if (m_layoutBlock.hasDragCaret())
214 frame->page()->dragCaretController().paintDragCaret(frame, paintInfo.con text, paintOffset); 212 frame->page()->dragCaretController().paintDragCaret(frame, paintInfo.con text, paintOffset);
215 } 213 }
216 214
217 bool BlockPainter::intersectsPaintRect(const PaintInfo& paintInfo, const LayoutP oint& paintOffset) const 215 bool BlockPainter::intersectsPaintRect(const PaintInfo& paintInfo, const LayoutP oint& paintOffset) const
218 { 216 {
219 LayoutRect overflowRect = m_layoutBlock.visualOverflowRect(); 217 LayoutRect overflowRect;
218 if (paintInfo.isPrinting() && m_layoutBlock.isAnonymousBlock() && m_layoutBl ock.childrenInline()) {
chrishtr 2016/01/19 23:25:42 Last nit I promise: is childrenInline() necessary
219 // For case <a href="..."><div>...</div></a>, when m_layoutBlock is the anonymous container
220 // of <a>, the anonymous container's visual overflow is empty, but we ne ed to continue
221 // painting to output <a>'s PDF URL rect which covers the continuations, as if we included
222 // <a>'s PDF URL rect into m_layoutBlock's visual overflow.
223 Vector<LayoutRect> rects;
224 m_layoutBlock.addElementVisualOverflowRects(rects, LayoutPoint());
225 overflowRect = unionRect(rects);
226 } else {
227 overflowRect = m_layoutBlock.visualOverflowRect();
228 }
229
220 if (m_layoutBlock.hasOverflowModel() && m_layoutBlock.usesCompositedScrollin g()) { 230 if (m_layoutBlock.hasOverflowModel() && m_layoutBlock.usesCompositedScrollin g()) {
221 overflowRect.unite(m_layoutBlock.layoutOverflowRect()); 231 overflowRect.unite(m_layoutBlock.layoutOverflowRect());
222 overflowRect.move(-m_layoutBlock.scrolledContentOffset()); 232 overflowRect.move(-m_layoutBlock.scrolledContentOffset());
223 } 233 }
224 m_layoutBlock.flipForWritingMode(overflowRect); 234 m_layoutBlock.flipForWritingMode(overflowRect);
225 overflowRect.moveBy(paintOffset + m_layoutBlock.location()); 235 overflowRect.moveBy(paintOffset + m_layoutBlock.location());
226 return paintInfo.cullRect().intersectsCullRect(overflowRect); 236 return paintInfo.cullRect().intersectsCullRect(overflowRect);
227 } 237 }
228 238
229 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 239 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
(...skipping 10 matching lines...) Expand all
240 else 250 else
241 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p aintInfo, paintOffset); 251 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p aintInfo, paintOffset);
242 } else { 252 } else {
243 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); 253 PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
244 paintInfoForDescendants.updatePaintingRootForChildren(&m_layoutBlock); 254 paintInfoForDescendants.updatePaintingRootForChildren(&m_layoutBlock);
245 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); 255 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset);
246 } 256 }
247 } 257 }
248 258
249 } // namespace blink 259 } // 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