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

Side by Side Diff: Source/core/layout/line/InlineTextBox.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/InlineTextBox.h ('k') | Source/core/layout/line/LineBoxList.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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 truncatedWidth += logicalWidth(); 305 truncatedWidth += logicalWidth();
306 return -1; 306 return -1;
307 } 307 }
308 308
309 bool InlineTextBox::isLineBreak() const 309 bool InlineTextBox::isLineBreak() const
310 { 310 {
311 return layoutObject().isBR() || (layoutObject().style()->preserveNewline() & & len() == 1 && (*layoutObject().text().impl())[start()] == '\n'); 311 return layoutObject().isBR() || (layoutObject().style()->preserveNewline() & & len() == 1 && (*layoutObject().text().impl())[start()] == '\n');
312 } 312 }
313 313
314 bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 314 bool InlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo cationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop * /, LayoutUnit /*lineBottom*/)
315 { 315 {
316 if (isLineBreak()) 316 if (isLineBreak())
317 return false; 317 return false;
318 318
319 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping(); 319 FloatPointWillBeLayoutPoint boxOrigin = locationIncludingFlipping();
320 boxOrigin.moveBy(accumulatedOffset); 320 boxOrigin.moveBy(accumulatedOffset);
321 FloatRectWillBeLayoutRect rect(boxOrigin, size()); 321 FloatRectWillBeLayoutRect rect(boxOrigin, size());
322 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition 322 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition
323 // to LayoutUnit-based types is complete (crbug.com/321237) 323 // to LayoutUnit-based types is complete (crbug.com/321237)
324 if (m_truncation != cFullTruncation && visibleToHitTestRequest(request) && l ocationInContainer.intersects(rect.rawValue())) { 324 if (m_truncation != cFullTruncation && visibleToHitTestRequest(result.hitTes tRequest()) && locationInContainer.intersects(rect.rawValue())) {
325 layoutObject().updateHitTestResult(result, flipForWritingMode(locationIn Container.point() - toLayoutSize(accumulatedOffset))); 325 layoutObject().updateHitTestResult(result, flipForWritingMode(locationIn Container.point() - toLayoutSize(accumulatedOffset)));
326 if (!result.addNodeToListBasedTestResult(layoutObject().node(), request, locationInContainer, rect.rawValue())) 326 if (!result.addNodeToListBasedTestResult(layoutObject().node(), location InContainer, rect.rawValue()))
327 return true; 327 return true;
328 } 328 }
329 return false; 329 return false;
330 } 330 }
331 331
332 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const 332 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const
333 { 333 {
334 // This function returns true if there are text emphasis marks and they are suppressed by ruby text. 334 // This function returns true if there are text emphasis marks and they are suppressed by ruby text.
335 if (style.textEmphasisMark() == TextEmphasisMarkNone) 335 if (style.textEmphasisMark() == TextEmphasisMarkNone)
336 return false; 336 return false;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj); 552 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj);
553 const int layoutObjectCharacterOffset = 75; 553 const int layoutObjectCharacterOffset = 75;
554 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 554 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
555 fputc(' ', stderr); 555 fputc(' ', stderr);
556 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 556 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
557 } 557 }
558 558
559 #endif 559 #endif
560 560
561 } // namespace blink 561 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineTextBox.h ('k') | Source/core/layout/line/LineBoxList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698