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

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, 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 * 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 LayoutPoint clippedPointInContents(pointInContents);
456 clippedPointInContents.clampNegativeToZero();
457
455 ASSERT(!rootBox->nextRootBox()); 458 ASSERT(!rootBox->nextRootBox());
456 ASSERT(childrenInline()); 459 ASSERT(childrenInline());
457 460
458 InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosi tion(pointInContents); 461 InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosi tion(clippedPointInContents);
459 if (!closestBox) 462 if (!closestBox)
460 return createPositionWithAffinity(0); 463 return createPositionWithAffinity(0);
461 464
462 return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(pointInCont ents.x(), closestBox->y())); 465 return closestBox->lineLayoutItem().positionForPoint(LayoutPoint(clippedPoin tInContents.x(), closestBox->y()));
463 } 466 }
464 467
465 void LayoutSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons t 468 void LayoutSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) cons t
466 { 469 {
467 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed )); 470 quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed ));
468 } 471 }
469 472
470 void LayoutSVGText::paint(const PaintInfo& paintInfo, const LayoutPoint&) const 473 void LayoutSVGText::paint(const PaintInfo& paintInfo, const LayoutPoint&) const
471 { 474 {
472 SVGTextPainter(*this).paint(paintInfo); 475 SVGTextPainter(*this).paint(paintInfo);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); 533 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this);
531 534
532 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState); 535 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState);
533 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, pai ntInvalidationState.paintInvalidationContainer()); 536 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, pai ntInvalidationState.paintInvalidationContainer());
534 if (reason == PaintInvalidationSVGResourceChange) 537 if (reason == PaintInvalidationSVGResourceChange)
535 childTreeWalkState.setForceSubtreeInvalidationWithinContainer(); 538 childTreeWalkState.setForceSubtreeInvalidationWithinContainer();
536 invalidatePaintOfSubtreesIfNeeded(childTreeWalkState); 539 invalidatePaintOfSubtreesIfNeeded(childTreeWalkState);
537 } 540 }
538 541
539 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698