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

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

Issue 2181953004: Changed ComputedStyle's EVisibility to be an enum class and fixed naming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_move_computedstyle_around
Patch Set: Rebase Created 4 years, 4 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) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 return textBoundingRect; 233 return textBoundingRect;
234 } 234 }
235 235
236 bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUn it) 236 bool SVGInlineTextBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUn it)
237 { 237 {
238 // FIXME: integrate with InlineTextBox::nodeAtPoint better. 238 // FIXME: integrate with InlineTextBox::nodeAtPoint better.
239 ASSERT(!isLineBreak()); 239 ASSERT(!isLineBreak());
240 240
241 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r esult.hitTestRequest(), getLineLayoutItem().style()->pointerEvents()); 241 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, r esult.hitTestRequest(), getLineLayoutItem().style()->pointerEvents());
242 bool isVisible = getLineLayoutItem().style()->visibility() == VISIBLE; 242 bool isVisible = getLineLayoutItem().style()->visibility() == EVisibility::V isible;
243 if (isVisible || !hitRules.requireVisible) { 243 if (isVisible || !hitRules.requireVisible) {
244 if (hitRules.canHitBoundingBox 244 if (hitRules.canHitBoundingBox
245 || (hitRules.canHitStroke && (getLineLayoutItem().style()->svgStyle( ).hasStroke() || !hitRules.requireStroke)) 245 || (hitRules.canHitStroke && (getLineLayoutItem().style()->svgStyle( ).hasStroke() || !hitRules.requireStroke))
246 || (hitRules.canHitFill && (getLineLayoutItem().style()->svgStyle(). hasFill() || !hitRules.requireFill))) { 246 || (hitRules.canHitFill && (getLineLayoutItem().style()->svgStyle(). hasFill() || !hitRules.requireFill))) {
247 LayoutRect rect(topLeft(), LayoutSize(logicalWidth(), logicalHeight( ))); 247 LayoutRect rect(topLeft(), LayoutSize(logicalWidth(), logicalHeight( )));
248 rect.moveBy(accumulatedOffset); 248 rect.moveBy(accumulatedOffset);
249 if (locationInContainer.intersects(rect)) { 249 if (locationInContainer.intersects(rect)) {
250 LineLayoutSVGInlineText lineLayoutItem = LineLayoutSVGInlineText (this->getLineLayoutItem()); 250 LineLayoutSVGInlineText lineLayoutItem = LineLayoutSVGInlineText (this->getLineLayoutItem());
251 ASSERT(lineLayoutItem.scalingFactor()); 251 ASSERT(lineLayoutItem.scalingFactor());
252 float baseline = lineLayoutItem.scaledFont().getFontMetrics().fl oatAscent() / lineLayoutItem.scalingFactor(); 252 float baseline = lineLayoutItem.scaledFont().getFontMetrics().fl oatAscent() / lineLayoutItem.scalingFactor();
253 253
254 FloatPoint floatLocation = FloatPoint(locationInContainer.point( )); 254 FloatPoint floatLocation = FloatPoint(locationInContainer.point( ));
255 for (const SVGTextFragment& fragment : m_textFragments) { 255 for (const SVGTextFragment& fragment : m_textFragments) {
256 FloatQuad fragmentQuad = fragment.boundingQuad(baseline); 256 FloatQuad fragmentQuad = fragment.boundingQuad(baseline);
257 if (fragmentQuad.containsPoint(floatLocation)) { 257 if (fragmentQuad.containsPoint(floatLocation)) {
258 lineLayoutItem.updateHitTestResult(result, locationInCon tainer.point() - toLayoutSize(accumulatedOffset)); 258 lineLayoutItem.updateHitTestResult(result, locationInCon tainer.point() - toLayoutSize(accumulatedOffset));
259 if (result.addNodeToListBasedTestResult(lineLayoutItem.n ode(), locationInContainer, rect) == StopHitTesting) 259 if (result.addNodeToListBasedTestResult(lineLayoutItem.n ode(), locationInContainer, rect) == StopHitTesting)
260 return true; 260 return true;
261 } 261 }
262 } 262 }
263 } 263 }
264 } 264 }
265 } 265 }
266 return false; 266 return false;
267 } 267 }
268 268
269 } // namespace blink 269 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698