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

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

Issue 1632133007: The missing value default for <area shape> is 'rect' (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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAreaElement.h ('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/html/HTMLAreaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
index 1c096e2a2880d63decc0c9150b421cf4e5db70a9..8a3649aa0c2dd9f45474678d4b62bb1ee7124bf0 100644
--- a/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAreaElement.cpp
@@ -49,7 +49,7 @@ using namespace HTMLNames;
inline HTMLAreaElement::HTMLAreaElement(Document& document)
: HTMLAnchorElement(areaTag, document)
, m_lastSize(-1, -1)
- , m_shape(Unknown)
+ , m_shape(Rect)
{
}
@@ -67,14 +67,17 @@ DEFINE_NODE_FACTORY(HTMLAreaElement)
void HTMLAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value)
{
if (name == shapeAttr) {
- if (equalIgnoringASCIICase(value, "default"))
+ if (equalIgnoringASCIICase(value, "default")) {
m_shape = Default;
- else if (equalIgnoringASCIICase(value, "circle"))
+ } else if (equalIgnoringASCIICase(value, "circle") || equalIgnoringASCIICase(value, "circ")) {
m_shape = Circle;
- else if (equalIgnoringASCIICase(value, "poly"))
+ } else if (equalIgnoringASCIICase(value, "polygon") || equalIgnoringASCIICase(value, "poly")) {
m_shape = Poly;
- else if (equalIgnoringASCIICase(value, "rect"))
+ } else {
+ // The missing (and implicitly invalid) value default for the
+ // 'shape' attribute is 'rect'.
m_shape = Rect;
+ }
invalidateCachedRegion();
} else if (name == coordsAttr) {
m_coords = parseHTMLAreaElementCoords(value.string());
@@ -136,19 +139,8 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
if (m_coords.isEmpty() && m_shape != Default)
return Path();
- // If element omits the shape attribute, select shape based on number of coordinates.
- Shape shape = m_shape;
- if (shape == Unknown) {
- if (m_coords.size() == 3)
- shape = Circle;
- else if (m_coords.size() == 4)
- shape = Rect;
- else if (m_coords.size() >= 6)
- shape = Poly;
- }
-
Path path;
- switch (shape) {
+ switch (m_shape) {
case Poly:
if (m_coords.size() >= 6) {
int numPoints = m_coords.size() / 2;
@@ -177,8 +169,6 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
case Default:
path.addRect(FloatRect(FloatPoint(0, 0), FloatSize(size)));
break;
- case Unknown:
- break;
}
return path;
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLAreaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698