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

Side by Side Diff: Source/core/layout/line/InlineBox.cpp

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 8 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
« no previous file with comments | « Source/core/layout/line/InlineBox.h ('k') | Source/core/layout/line/InlineFlowBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 toLayoutBox(layoutObject()).move(dx, dy); 204 toLayoutBox(layoutObject()).move(dx, dy);
205 } 205 }
206 206
207 void InlineBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset , LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 207 void InlineBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset , LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
208 { 208 {
209 // Text clips are painted only for the direct inline children of the object that has a text clip style on it, not block children. 209 // Text clips are painted only for the direct inline children of the object that has a text clip style on it, not block children.
210 if (paintInfo.phase != PaintPhaseTextClip) 210 if (paintInfo.phase != PaintPhaseTextClip)
211 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset); 211 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset);
212 } 212 }
213 213
214 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 214 bool InlineBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati onInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, L ayoutUnit /*lineBottom*/)
215 { 215 {
216 // Hit test all phases of replaced elements atomically, as though the replac ed element established its 216 // Hit test all phases of replaced elements atomically, as though the replac ed element established its
217 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 217 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
218 // specification.) 218 // specification.)
219 LayoutPoint childPoint = accumulatedOffset; 219 LayoutPoint childPoint = accumulatedOffset;
220 if (parent()->layoutObject().hasFlippedBlocksWritingMode()) // Faster than c alling containingBlock(). 220 if (parent()->layoutObject().hasFlippedBlocksWritingMode()) // Faster than c alling containingBlock().
221 childPoint = layoutObject().containingBlock()->flipForWritingModeForChil d(&toLayoutBox(layoutObject()), childPoint); 221 childPoint = layoutObject().containingBlock()->flipForWritingModeForChil d(&toLayoutBox(layoutObject()), childPoint);
222 222
223 if (layoutObject().style()->hasBorderRadius()) { 223 if (layoutObject().style()->hasBorderRadius()) {
224 LayoutRect borderRect = logicalFrameRect(); 224 LayoutRect borderRect = logicalFrameRect();
225 borderRect.moveBy(accumulatedOffset); 225 borderRect.moveBy(accumulatedOffset);
226 FloatRoundedRect border = layoutObject().style()->getRoundedBorderFor(bo rderRect); 226 FloatRoundedRect border = layoutObject().style()->getRoundedBorderFor(bo rderRect);
227 if (!locationInContainer.intersects(border)) 227 if (!locationInContainer.intersects(border))
228 return false; 228 return false;
229 } 229 }
230 230
231 return layoutObject().hitTest(request, result, locationInContainer, childPoi nt); 231 return layoutObject().hitTest(result, locationInContainer, childPoint);
232 } 232 }
233 233
234 const RootInlineBox& InlineBox::root() const 234 const RootInlineBox& InlineBox::root() const
235 { 235 {
236 if (m_parent) 236 if (m_parent)
237 return m_parent->root(); 237 return m_parent->root();
238 ASSERT(isRootInlineBox()); 238 ASSERT(isRootInlineBox());
239 return static_cast<const RootInlineBox&>(*this); 239 return static_cast<const RootInlineBox&>(*this);
240 } 240 }
241 241
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 b->showTreeForThis(); 393 b->showTreeForThis();
394 } 394 }
395 395
396 void showLineTree(const blink::InlineBox* b) 396 void showLineTree(const blink::InlineBox* b)
397 { 397 {
398 if (b) 398 if (b)
399 b->showLineTreeForThis(); 399 b->showLineTreeForThis();
400 } 400 }
401 401
402 #endif 402 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineBox.h ('k') | Source/core/layout/line/InlineFlowBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698