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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGText.cpp

Issue 1541083002: Fix invalid selection produced when dragging mouse outside the SVG text element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 4 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 5 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
6 * Copyright (C) 2008 Rob Buis <buis@kde.org> 6 * Copyright (C) 2008 Rob Buis <buis@kde.org>
7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
9 * Copyright (C) 2012 Google Inc. 9 * Copyright (C) 2012 Google Inc.
10 * 10 *
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 return false; 446 return false;
447 } 447 }
448 448
449 PositionWithAffinity LayoutSVGText::positionForPoint(const LayoutPoint& pointInC ontents) 449 PositionWithAffinity LayoutSVGText::positionForPoint(const LayoutPoint& pointInC ontents)
450 { 450 {
451 RootInlineBox* rootBox = firstRootBox(); 451 RootInlineBox* rootBox = firstRootBox();
452 if (!rootBox) 452 if (!rootBox)
453 return createPositionWithAffinity(0); 453 return createPositionWithAffinity(0);
454 454
455 FloatPoint absolutePoint(pointInContents);
fs 2016/01/19 13:30:04 Maybe call this "clippedPointInContents" or someth
456 if (absolutePoint.x() < 0)
fs 2016/01/19 13:30:04 This operation would be the same as LayoutPoint::c
457 absolutePoint.setX(0);
458 if (absolutePoint.y() < 0)
459 absolutePoint.setY(0);
460
455 ASSERT(!rootBox->nextRootBox()); 461 ASSERT(!rootBox->nextRootBox());
456 ASSERT(childrenInline()); 462 ASSERT(childrenInline());
457 463
458 InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosi tion(pointInContents); 464 InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosi tion(LayoutPoint(absolutePoint));
459 if (!closestBox) 465 if (!closestBox)
460 return createPositionWithAffinity(0); 466 return createPositionWithAffinity(0);
461 467
462 return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(pointInCont ents.x(), closestBox->y())); 468 return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(absolutePoi nt.x(), closestBox->y()));
463 } 469 }
464 470
465 void LayoutSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons t 471 void LayoutSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons t
466 { 472 {
467 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed )); 473 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed ));
468 } 474 }
469 475
470 void LayoutSVGText::paint(const PaintInfo& paintInfo, const LayoutPoint&) const 476 void LayoutSVGText::paint(const PaintInfo& paintInfo, const LayoutPoint&) const
471 { 477 {
472 SVGTextPainter(*this).paint(paintInfo); 478 SVGTextPainter(*this).paint(paintInfo);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); 536 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this);
531 537
532 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState); 538 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState);
533 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, pai ntInvalidationState.paintInvalidationContainer()); 539 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, pai ntInvalidationState.paintInvalidationContainer());
534 if (reason == PaintInvalidationSVGResourceChange) 540 if (reason == PaintInvalidationSVGResourceChange)
535 childTreeWalkState.setForceSubtreeInvalidationWithinContainer(); 541 childTreeWalkState.setForceSubtreeInvalidationWithinContainer();
536 invalidatePaintOfSubtreesIfNeeded(childTreeWalkState); 542 invalidatePaintOfSubtreesIfNeeded(childTreeWalkState);
537 } 543 }
538 544
539 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698