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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 1630793002: Stop hit testing culled inlines when a match is found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler approach, but duplicated code Created 4 years, 10 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 * (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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return -1; 376 return -1;
377 } 377 }
378 378
379 bool InlineTextBox::isLineBreak() const 379 bool InlineTextBox::isLineBreak() const
380 { 380 {
381 return lineLayoutItem().isBR() || (lineLayoutItem().style()->preserveNewline () && len() == 1 && (*lineLayoutItem().text().impl())[start()] == '\n'); 381 return lineLayoutItem().isBR() || (lineLayoutItem().style()->preserveNewline () && len() == 1 && (*lineLayoutItem().text().impl())[start()] == '\n');
382 } 382 }
383 383
384 bool InlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo cationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop * /, LayoutUnit /*lineBottom*/) 384 bool InlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo cationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop * /, LayoutUnit /*lineBottom*/)
385 { 385 {
386 if (isLineBreak()) 386 if (isLineBreak() || m_truncation == cFullTruncation)
387 return false; 387 return false;
388 388
389 LayoutPoint boxOrigin = locationIncludingFlipping(); 389 LayoutPoint boxOrigin = locationIncludingFlipping();
390 boxOrigin.moveBy(accumulatedOffset); 390 boxOrigin.moveBy(accumulatedOffset);
391 LayoutRect rect(boxOrigin, size()); 391 LayoutRect rect(boxOrigin, size());
392 // FIXME: both calls to rawValue() below is temporary and should be removed once the transition 392 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContainer. intersects(rect)) {
393 // to LayoutUnit-based types is complete (crbug.com/321237)
394 if (m_truncation != cFullTruncation && visibleToHitTestRequest(result.hitTes tRequest()) && locationInContainer.intersects(rect)) {
395 lineLayoutItem().updateHitTestResult(result, flipForWritingMode(location InContainer.point() - toLayoutSize(accumulatedOffset))); 393 lineLayoutItem().updateHitTestResult(result, flipForWritingMode(location InContainer.point() - toLayoutSize(accumulatedOffset)));
396 if (!result.addNodeToListBasedTestResult(lineLayoutItem().node(), locati onInContainer, rect)) 394 if (result.addNodeToListBasedTestResult(lineLayoutItem().node(), locatio nInContainer, rect) == StopHitTesting)
397 return true; 395 return true;
398 } 396 }
399 return false; 397 return false;
400 } 398 }
401 399
402 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const 400 bool InlineTextBox::getEmphasisMarkPosition(const ComputedStyle& style, TextEmph asisPosition& emphasisPosition) const
403 { 401 {
404 // This function returns true if there are text emphasis marks and they are suppressed by ruby text. 402 // This function returns true if there are text emphasis marks and they are suppressed by ruby text.
405 if (style.textEmphasisMark() == TextEmphasisMarkNone) 403 if (style.textEmphasisMark() == TextEmphasisMarkNone)
406 return false; 404 return false;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer( )); 627 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer( ));
630 const int layoutObjectCharacterOffset = 75; 628 const int layoutObjectCharacterOffset = 75;
631 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 629 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
632 fputc(' ', stderr); 630 fputc(' ', stderr);
633 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 631 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
634 } 632 }
635 633
636 #endif 634 #endif
637 635
638 } // namespace blink 636 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698