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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp

Issue 2888623008: Remove SVGTextMetrics Width/Height getters (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGTextMetrics.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
index 4c7514604bff631d5f1acef0f9de7867cddf8f79..c9f0283962546efc8a0237bececd25f0567ccb83 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
@@ -28,7 +28,6 @@
#include "core/layout/svg/SVGTextFragment.h"
#include "core/layout/svg/SVGTextMetrics.h"
#include "core/layout/svg/line/SVGInlineTextBox.h"
-#include "platform/wtf/MathExtras.h"
#include "platform/wtf/Vector.h"
namespace blink {
@@ -258,8 +257,7 @@ static float CalculateGlyphRange(const QueryData* query_data,
auto end_metrics = FindMetricsForCharacter(metrics_list, fragment, end);
float glyph_range = 0;
for (; metrics != end_metrics; ++metrics)
- glyph_range +=
- query_data->is_vertical_text ? metrics->Height() : metrics->Width();
+ glyph_range += metrics->Advance(query_data->is_vertical_text);
return glyph_range;
}
@@ -447,11 +445,7 @@ struct ExtentOfCharacterData : QueryData {
static FloatRect PhysicalGlyphExtents(const QueryData* query_data,
const SVGTextMetrics& metrics,
const FloatPoint& glyph_position) {
- // TODO(fs): Negative glyph extents seems kind of weird to have, but
- // presently it can occur in some cases (like Arabic.)
- FloatRect glyph_extents(glyph_position,
- FloatSize(std::max<float>(metrics.Width(), 0),
- std::max<float>(metrics.Height(), 0)));
+ FloatRect glyph_extents(glyph_position, metrics.Extents());
// If RTL, adjust the starting point to align with the LHS of the glyph
// bounding box.
@@ -621,8 +615,7 @@ static bool CharacterNumberAtPositionCallback(QueryData* query_data,
return true;
}
fragment_offset += metrics->length();
- glyph_offset +=
- data->is_vertical_text ? metrics->Height() : metrics->Width();
+ glyph_offset += metrics->Advance(data->is_vertical_text);
++metrics;
}
return false;
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGTextMetrics.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698