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

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 f72f2564cef33af2412c9031b9e88fcd0d4e21af..a03b7fdb617c93bd3de6f01d331e18b88cb657b0 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -51,6 +51,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"
@@ -4737,6 +4738,19 @@ Vector<IconURL> Document::iconURLs(int iconTypesMask)
return iconURLs;
}
+Color Document::brandColor() const
+{
+ if (!RuntimeEnabledFeatures::brandColorEnabled())
+ return Color();
+
+ for (HTMLMetaElement* metaElement = head() ? Traversal<HTMLMetaElement>::firstChild(*head()) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*metaElement)) {
esprehn 2014/06/19 10:37:04 You call this method from inside HTMLMetaElement::
michaelbai 2014/06/19 16:42:51 In the case that there are multiple brand-color me
esprehn 2014/06/19 18:02:20 That's not what your code does. Every time a <meta
+ RGBA32 rgb;
+ if (equalIgnoringCase(metaElement->name(), "brand-color") && CSSPropertyParser::fastParseColor(rgb, metaElement->content().string().stripWhiteSpace(), true))
esprehn 2014/06/19 10:37:04 CSSPropertyParser::fastParseColor is a private API
michaelbai 2014/06/19 16:42:51 We only support color name, rgba(), rgb() or "#" s
esprehn 2014/06/19 18:02:21 Why only support an arbitrary subset of the css co
+ return Color(rgb);
+ }
+ return Color();
+}
+
HTMLLinkElement* Document::linkManifest() const
{
HTMLHeadElement* head = this->head();

Powered by Google App Engine
This is Rietveld 408576698