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

Side by Side Diff: Source/core/rendering/InlineBox.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) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void InlineBox::adjustPosition(float dx, float dy) 190 void InlineBox::adjustPosition(float dx, float dy)
191 { 191 {
192 m_topLeft.move(dx, dy); 192 m_topLeft.move(dx, dy);
193 193
194 if (m_renderer->isReplaced()) 194 if (m_renderer->isReplaced())
195 toRenderBox(m_renderer)->move(dx, dy); 195 toRenderBox(m_renderer)->move(dx, dy);
196 } 196 }
197 197
198 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/) 198 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/)
199 { 199 {
200 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != Pain tPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 200 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.getPhase() != PaintPhaseForeground && paintInfo.getPhase() != PaintPhaseSelection))
201 return; 201 return;
202 202
203 LayoutPoint childPoint = paintOffset; 203 LayoutPoint childPoint = paintOffset;
204 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock(). 204 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock().
205 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint); 205 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint);
206 206
207 // Paint all phases of replaced elements atomically, as though the replaced element established its 207 // Paint all phases of replaced elements atomically, as though the replaced element established its
208 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 208 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
209 // specification.) 209 // specification.)
210 bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.pha se == PaintPhaseTextClip; 210 bool preservePhase = paintInfo.getPhase() == PaintPhaseSelection || paintInf o.getPhase() == PaintPhaseTextClip;
211 PaintInfo info(paintInfo); 211 PaintInfo info(paintInfo);
212 info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 212 PaintPhase phase = preservePhase ? paintInfo.getPhase() : PaintPhaseBlockBac kground;
213 info.setPhase(phase);
213 renderer()->paint(info, childPoint); 214 renderer()->paint(info, childPoint);
214 if (!preservePhase) { 215 if (!preservePhase) {
215 info.phase = PaintPhaseChildBlockBackgrounds; 216 info.setPhase(PaintPhaseChildBlockBackgrounds);
216 renderer()->paint(info, childPoint); 217 renderer()->paint(info, childPoint);
217 info.phase = PaintPhaseFloat; 218 info.setPhase(PaintPhaseFloat);
218 renderer()->paint(info, childPoint); 219 renderer()->paint(info, childPoint);
219 info.phase = PaintPhaseForeground; 220 info.setPhase(PaintPhaseForeground);
220 renderer()->paint(info, childPoint); 221 renderer()->paint(info, childPoint);
221 info.phase = PaintPhaseOutline; 222 info.setPhase(PaintPhaseOutline);
222 renderer()->paint(info, childPoint); 223 renderer()->paint(info, childPoint);
223 } 224 }
224 } 225 }
225 226
226 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 227 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
227 { 228 {
228 // Hit test all phases of replaced elements atomically, as though the replac ed element established its 229 // Hit test all phases of replaced elements atomically, as though the replac ed element established its
229 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 230 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
230 // specification.) 231 // specification.)
231 LayoutPoint childPoint = accumulatedOffset; 232 LayoutPoint childPoint = accumulatedOffset;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 b->showTreeForThis(); 382 b->showTreeForThis();
382 } 383 }
383 384
384 void showLineTree(const WebCore::InlineBox* b) 385 void showLineTree(const WebCore::InlineBox* b)
385 { 386 {
386 if (b) 387 if (b)
387 b->showLineTreeForThis(); 388 b->showLineTreeForThis();
388 } 389 }
389 390
390 #endif 391 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698