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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/animation/AnimationTimeline.h" 44 #include "core/animation/AnimationTimeline.h"
45 #include "core/animation/DocumentAnimations.h" 45 #include "core/animation/DocumentAnimations.h"
46 #include "core/css/CSSFontSelector.h" 46 #include "core/css/CSSFontSelector.h"
47 #include "core/css/CSSStyleDeclaration.h" 47 #include "core/css/CSSStyleDeclaration.h"
48 #include "core/css/CSSStyleSheet.h" 48 #include "core/css/CSSStyleSheet.h"
49 #include "core/css/MediaQueryMatcher.h" 49 #include "core/css/MediaQueryMatcher.h"
50 #include "core/css/StylePropertySet.h" 50 #include "core/css/StylePropertySet.h"
51 #include "core/css/StyleSheetContents.h" 51 #include "core/css/StyleSheetContents.h"
52 #include "core/css/StyleSheetList.h" 52 #include "core/css/StyleSheetList.h"
53 #include "core/css/invalidation/StyleInvalidator.h" 53 #include "core/css/invalidation/StyleInvalidator.h"
54 #include "core/css/parser/CSSPropertyParser.h"
54 #include "core/css/resolver/FontBuilder.h" 55 #include "core/css/resolver/FontBuilder.h"
55 #include "core/css/resolver/StyleResolver.h" 56 #include "core/css/resolver/StyleResolver.h"
56 #include "core/css/resolver/StyleResolverStats.h" 57 #include "core/css/resolver/StyleResolverStats.h"
57 #include "core/dom/AddConsoleMessageTask.h" 58 #include "core/dom/AddConsoleMessageTask.h"
58 #include "core/dom/Attr.h" 59 #include "core/dom/Attr.h"
59 #include "core/dom/CDATASection.h" 60 #include "core/dom/CDATASection.h"
60 #include "core/dom/Comment.h" 61 #include "core/dom/Comment.h"
61 #include "core/dom/ContextFeatures.h" 62 #include "core/dom/ContextFeatures.h"
62 #include "core/dom/DOMImplementation.h" 63 #include "core/dom/DOMImplementation.h"
63 #include "core/dom/DocumentFragment.h" 64 #include "core/dom/DocumentFragment.h"
(...skipping 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after
4730 4731
4731 if (firstTouchIcon.m_iconType != InvalidIcon) 4732 if (firstTouchIcon.m_iconType != InvalidIcon)
4732 iconURLs.append(firstTouchIcon); 4733 iconURLs.append(firstTouchIcon);
4733 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) 4734 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon)
4734 iconURLs.append(firstTouchPrecomposedIcon); 4735 iconURLs.append(firstTouchPrecomposedIcon);
4735 for (int i = secondaryIcons.size() - 1; i >= 0; --i) 4736 for (int i = secondaryIcons.size() - 1; i >= 0; --i)
4736 iconURLs.append(secondaryIcons[i]); 4737 iconURLs.append(secondaryIcons[i]);
4737 return iconURLs; 4738 return iconURLs;
4738 } 4739 }
4739 4740
4741 Color Document::brandColor() const
4742 {
4743 if (!RuntimeEnabledFeatures::brandColorEnabled())
4744 return Color();
4745
4746 for (HTMLMetaElement* metaElement = head() ? Traversal<HTMLMetaElement>::fir stChild(*head()) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nex tSibling(*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
4747 RGBA32 rgb;
4748 if (equalIgnoringCase(metaElement->name(), "brand-color") && CSSProperty Parser::fastParseColor(rgb, metaElement->content().string().stripWhiteSpace(), t rue))
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
4749 return Color(rgb);
4750 }
4751 return Color();
4752 }
4753
4740 HTMLLinkElement* Document::linkManifest() const 4754 HTMLLinkElement* Document::linkManifest() const
4741 { 4755 {
4742 HTMLHeadElement* head = this->head(); 4756 HTMLHeadElement* head = this->head();
4743 if (!head) 4757 if (!head)
4744 return 0; 4758 return 0;
4745 4759
4746 // The first link element with a manifest rel must be used. Others are ignor ed. 4760 // The first link element with a manifest rel must be used. Others are ignor ed.
4747 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkE lement)) { 4761 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkE lement)) {
4748 if (!linkElement->relAttribute().isManifest()) 4762 if (!linkElement->relAttribute().isManifest())
4749 continue; 4763 continue;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
5835 visitor->trace(m_compositorPendingAnimations); 5849 visitor->trace(m_compositorPendingAnimations);
5836 visitor->trace(m_contextDocument); 5850 visitor->trace(m_contextDocument);
5837 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5851 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5838 DocumentSupplementable::trace(visitor); 5852 DocumentSupplementable::trace(visitor);
5839 TreeScope::trace(visitor); 5853 TreeScope::trace(visitor);
5840 ContainerNode::trace(visitor); 5854 ContainerNode::trace(visitor);
5841 ExecutionContext::trace(visitor); 5855 ExecutionContext::trace(visitor);
5842 } 5856 }
5843 5857
5844 } // namespace WebCore 5858 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698