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

Unified Diff: third_party/WebKit/Source/core/html/HTMLAreaElement.cpp

Issue 1636333003: Implement specced parsing algorithm for <area coords> (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
index 4b88f7311a02c677bf51313ea30c550bd5793038..650238b3e141673364ea16c04c23c508f89bfaf3 100644
--- a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
@@ -25,6 +25,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLMapElement.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutImage.h"
#include "core/layout/LayoutView.h"
@@ -35,11 +36,10 @@ namespace blink {
namespace {
-// Adapt a Length to the allowed range of a LayoutUnit.
-float clampCoordinate(const Length& length)
+// Adapt a double to the allowed range of a LayoutUnit and narrow it to float precision.
+float clampCoordinate(double value)
{
- ASSERT(length.isFixed());
- return LayoutUnit(length.value()).toFloat();
+ return LayoutUnit(value).toFloat();
}
}
@@ -80,7 +80,7 @@ void HTMLAreaElement::parseAttribute(const QualifiedName& name, const AtomicStri
}
invalidateCachedRegion();
} else if (name == coordsAttr) {
- m_coords = parseHTMLAreaElementCoords(value.string());
+ m_coords = parseHTMLListOfFloatingPointNumbers(value.string());
invalidateCachedRegion();
} else if (name == altAttr || name == accesskeyAttr) {
// Do nothing.
@@ -152,7 +152,7 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
}
break;
case Circle:
- if (m_coords.size() >= 3 && m_coords[2].value() > 0) {
+ if (m_coords.size() >= 3 && m_coords[2] > 0) {
float r = clampCoordinate(m_coords[2]);
path.addEllipse(FloatRect(clampCoordinate(m_coords[0]) - r, clampCoordinate(m_coords[1]) - r, 2 * r, 2 * r));
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAreaElement.h ('k') | third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698