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

Side by Side Diff: Source/core/rendering/RenderLineBoxList.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. Created 7 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 RootInlineBox* firstRootBox = firstLineBox()->root(); 178 RootInlineBox* firstRootBox = firstLineBox()->root();
179 RootInlineBox* lastRootBox = lastLineBox()->root(); 179 RootInlineBox* lastRootBox = lastLineBox()->root();
180 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot Box->lineTop()); 180 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot Box->lineTop());
181 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR ootBox->lineBottom()); 181 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR ootBox->lineBottom());
182 LayoutUnit logicalTop = firstLineTop - outlineSize; 182 LayoutUnit logicalTop = firstLineTop - outlineSize;
183 LayoutUnit logicalBottom = outlineSize + lastLineBottom; 183 LayoutUnit logicalBottom = outlineSize + lastLineBottom;
184 184
185 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset ); 185 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset );
186 } 186 }
187 187
188 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const 188 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, PaintInfo& paintInfo, const LayoutPoint& offset) const
189 { 189 {
190 RootInlineBox* root = box->root(); 190 RootInlineBox* root = box->root();
191 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root-> lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase ); 191 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root-> lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.getPh ase());
192 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom ()) + renderer->maximalOutlineSize(paintInfo.phase); 192 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom ()) + renderer->maximalOutlineSize(paintInfo.getPhase());
193 193
194 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re ct, offset); 194 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.ge tRect(), offset);
195 } 195 }
196 196
197 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const 197 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const
198 { 198 {
199 // Only paint during the foreground/selection phases. 199 // Only paint during the foreground/selection phases.
200 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && paintInfo.phase != PaintPhaseOutline 200 if (paintInfo.getPhase() != PaintPhaseForeground && paintInfo.getPhase() != PaintPhaseSelection && paintInfo.getPhase() != PaintPhaseOutline
201 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines && paintInfo.phase != PaintPhaseTextClip 201 && paintInfo.getPhase() != PaintPhaseSelfOutline && paintInfo.getPhase() != PaintPhaseChildOutlines && paintInfo.getPhase() != PaintPhaseTextClip
202 && paintInfo.phase != PaintPhaseMask) 202 && paintInfo.getPhase() != PaintPhaseMask)
203 return; 203 return;
204 204
205 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer. 205 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer.
206 206
207 // If we have no lines then we have no work to do. 207 // If we have no lines then we have no work to do.
208 if (!firstLineBox()) 208 if (!firstLineBox())
209 return; 209 return;
210 210
211 LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.phase); 211 LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.getPhase());
212 if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, outlineSiz e)) 212 if (!anyLineIntersectsRect(renderer, paintInfo.getRect(), paintOffset, outli neSize))
213 return; 213 return;
214 214
215 PaintInfo info(paintInfo); 215 PaintInfo info(paintInfo);
216 ListHashSet<RenderInline*> outlineObjects; 216 ListHashSet<RenderInline*> outlineObjects;
217 info.outlineObjects = &outlineObjects; 217 info.setOutlineObjects(&outlineObjects);
218 218
219 // See if our root lines intersect with the dirty rect. If so, then we pain t 219 // See if our root lines intersect with the dirty rect. If so, then we pain t
220 // them. Note that boxes can easily overlap, so we can't make any assumptio ns 220 // them. Note that boxes can easily overlap, so we can't make any assumptio ns
221 // based off positions of our first line box or our last line box. 221 // based off positions of our first line box or our last line box.
222 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { 222 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
223 if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) { 223 if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) {
224 RootInlineBox* root = curr->root(); 224 RootInlineBox* root = curr->root();
225 curr->paint(info, paintOffset, root->lineTop(), root->lineBottom()); 225 curr->paint(info, paintOffset, root->lineTop(), root->lineBottom());
226 } 226 }
227 } 227 }
228 228
229 if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline | | info.phase == PaintPhaseChildOutlines) { 229 if (info.getPhase() == PaintPhaseOutline || info.getPhase() == PaintPhaseSel fOutline || info.getPhase() == PaintPhaseChildOutlines) {
230 ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end(); 230 ListHashSet<RenderInline*>::iterator end = info.getOutlineObjects()->end ();
231 for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begi n(); it != end; ++it) { 231 for (ListHashSet<RenderInline*>::iterator it = info.getOutlineObjects()- >begin(); it != end; ++it) {
232 RenderInline* flow = *it; 232 RenderInline* flow = *it;
233 flow->paintOutline(info, paintOffset); 233 flow->paintOutline(info, paintOffset);
234 } 234 }
235 info.outlineObjects->clear(); 235 info.getOutlineObjects()->clear();
236 } 236 }
237 } 237 }
238 238
239 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq uest& request, HitTestResult& result, const HitTestLocation& locationInContainer , const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const 239 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq uest& request, HitTestResult& result, const HitTestLocation& locationInContainer , const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const
240 { 240 {
241 if (hitTestAction != HitTestForeground) 241 if (hitTestAction != HitTestForeground)
242 return false; 242 return false;
243 243
244 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could hit test like this is if it has a layer. 244 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could hit test like this is if it has a layer.
245 245
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 ASSERT(child->prevLineBox() == prev); 370 ASSERT(child->prevLineBox() == prev);
371 prev = child; 371 prev = child;
372 } 372 }
373 ASSERT(prev == m_lastLineBox); 373 ASSERT(prev == m_lastLineBox);
374 #endif 374 #endif
375 } 375 }
376 376
377 #endif 377 #endif
378 378
379 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698