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

Unified Diff: Source/core/dom/Document.cpp

Issue 329943004: Implementation of brand-color (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 02613ffb62168ff2fce5286458324ac3915ce6b6..74310e8aa4369c6440bcb9758a6d1729378dde0e 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -52,6 +52,7 @@
#include "core/css/StyleSheetContents.h"
#include "core/css/StyleSheetList.h"
#include "core/css/invalidation/StyleInvalidator.h"
+#include "core/css/parser/CSSPropertyParser.h"
#include "core/css/resolver/FontBuilder.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/css/resolver/StyleResolverStats.h"
@@ -4735,6 +4736,16 @@ Vector<IconURL> Document::iconURLs(int iconTypesMask)
return iconURLs;
}
+Color Document::brandColor() const
+{
+ for (HTMLMetaElement* metaElement = head() ? Traversal<HTMLMetaElement>::firstChild(*head()) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*metaElement)) {
+ RGBA32 rgb;
+ if (equalIgnoringCase(metaElement->name(), "brand-color") && CSSPropertyParser::fastParseColor(rgb, metaElement->content().string(), true))
michaelbai 2014/06/12 23:47:58 Knew I shouldn't use CSSPropertyParser::fastParseC
abarth-chromium 2014/06/13 05:40:41 fastParseColor is fine. Do you want to strip lead
michaelbai 2014/06/13 19:56:51 Striped the spaces, and added test
+ return Color(rgb);
+ }
+ return Color();
+}
+
HTMLLinkElement* Document::linkManifest() const
{
HTMLHeadElement* head = this->head();

Powered by Google App Engine
This is Rietveld 408576698