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

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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/animation/AnimationTimeline.h" 45 #include "core/animation/AnimationTimeline.h"
46 #include "core/animation/DocumentAnimations.h" 46 #include "core/animation/DocumentAnimations.h"
47 #include "core/css/CSSFontSelector.h" 47 #include "core/css/CSSFontSelector.h"
48 #include "core/css/CSSStyleDeclaration.h" 48 #include "core/css/CSSStyleDeclaration.h"
49 #include "core/css/CSSStyleSheet.h" 49 #include "core/css/CSSStyleSheet.h"
50 #include "core/css/MediaQueryMatcher.h" 50 #include "core/css/MediaQueryMatcher.h"
51 #include "core/css/StylePropertySet.h" 51 #include "core/css/StylePropertySet.h"
52 #include "core/css/StyleSheetContents.h" 52 #include "core/css/StyleSheetContents.h"
53 #include "core/css/StyleSheetList.h" 53 #include "core/css/StyleSheetList.h"
54 #include "core/css/invalidation/StyleInvalidator.h" 54 #include "core/css/invalidation/StyleInvalidator.h"
55 #include "core/css/parser/CSSPropertyParser.h"
55 #include "core/css/resolver/FontBuilder.h" 56 #include "core/css/resolver/FontBuilder.h"
56 #include "core/css/resolver/StyleResolver.h" 57 #include "core/css/resolver/StyleResolver.h"
57 #include "core/css/resolver/StyleResolverStats.h" 58 #include "core/css/resolver/StyleResolverStats.h"
58 #include "core/dom/AddConsoleMessageTask.h" 59 #include "core/dom/AddConsoleMessageTask.h"
59 #include "core/dom/Attr.h" 60 #include "core/dom/Attr.h"
60 #include "core/dom/CDATASection.h" 61 #include "core/dom/CDATASection.h"
61 #include "core/dom/Comment.h" 62 #include "core/dom/Comment.h"
62 #include "core/dom/ContextFeatures.h" 63 #include "core/dom/ContextFeatures.h"
63 #include "core/dom/DOMImplementation.h" 64 #include "core/dom/DOMImplementation.h"
64 #include "core/dom/DocumentFragment.h" 65 #include "core/dom/DocumentFragment.h"
(...skipping 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 4729
4729 if (firstTouchIcon.m_iconType != InvalidIcon) 4730 if (firstTouchIcon.m_iconType != InvalidIcon)
4730 iconURLs.append(firstTouchIcon); 4731 iconURLs.append(firstTouchIcon);
4731 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon) 4732 if (firstTouchPrecomposedIcon.m_iconType != InvalidIcon)
4732 iconURLs.append(firstTouchPrecomposedIcon); 4733 iconURLs.append(firstTouchPrecomposedIcon);
4733 for (int i = secondaryIcons.size() - 1; i >= 0; --i) 4734 for (int i = secondaryIcons.size() - 1; i >= 0; --i)
4734 iconURLs.append(secondaryIcons[i]); 4735 iconURLs.append(secondaryIcons[i]);
4735 return iconURLs; 4736 return iconURLs;
4736 } 4737 }
4737 4738
4739 Color Document::brandColor() const
4740 {
4741 for (HTMLMetaElement* metaElement = head() ? Traversal<HTMLMetaElement>::fir stChild(*head()) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nex tSibling(*metaElement)) {
4742 RGBA32 rgb;
4743 if (equalIgnoringCase(metaElement->name(), "brand-color") && CSSProperty Parser::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
4744 return Color(rgb);
4745 }
4746 return Color();
4747 }
4748
4738 HTMLLinkElement* Document::linkManifest() const 4749 HTMLLinkElement* Document::linkManifest() const
4739 { 4750 {
4740 HTMLHeadElement* head = this->head(); 4751 HTMLHeadElement* head = this->head();
4741 if (!head) 4752 if (!head)
4742 return 0; 4753 return 0;
4743 4754
4744 // The first link element with a manifest rel must be used. Others are ignor ed. 4755 // The first link element with a manifest rel must be used. Others are ignor ed.
4745 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkE lement)) { 4756 for (HTMLLinkElement* linkElement = Traversal<HTMLLinkElement>::firstChild(* head); linkElement; linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkE lement)) {
4746 if (!linkElement->relAttribute().isManifest()) 4757 if (!linkElement->relAttribute().isManifest())
4747 continue; 4758 continue;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
5833 visitor->trace(m_compositorPendingAnimations); 5844 visitor->trace(m_compositorPendingAnimations);
5834 visitor->trace(m_contextDocument); 5845 visitor->trace(m_contextDocument);
5835 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5846 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5836 DocumentSupplementable::trace(visitor); 5847 DocumentSupplementable::trace(visitor);
5837 TreeScope::trace(visitor); 5848 TreeScope::trace(visitor);
5838 ContainerNode::trace(visitor); 5849 ContainerNode::trace(visitor);
5839 ExecutionContext::trace(visitor); 5850 ExecutionContext::trace(visitor);
5840 } 5851 }
5841 5852
5842 } // namespace WebCore 5853 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698