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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp

Issue 2627953003: Make `getComputedStyle` return the correct style for collapsed <img> elements. (Closed)
Patch Set: Move logic to StyleAdjuster. Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 27 matching lines...) Expand all
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/ElementTraversal.h" 39 #include "core/dom/ElementTraversal.h"
40 #include "core/dom/Node.h" 40 #include "core/dom/Node.h"
41 #include "core/dom/NodeComputedStyle.h" 41 #include "core/dom/NodeComputedStyle.h"
42 #include "core/dom/QualifiedName.h" 42 #include "core/dom/QualifiedName.h"
43 #include "core/dom/SpaceSplitString.h" 43 #include "core/dom/SpaceSplitString.h"
44 #include "core/dom/StyleEngine.h" 44 #include "core/dom/StyleEngine.h"
45 #include "core/dom/shadow/ElementShadow.h" 45 #include "core/dom/shadow/ElementShadow.h"
46 #include "core/dom/shadow/InsertionPoint.h" 46 #include "core/dom/shadow/InsertionPoint.h"
47 #include "core/html/HTMLElement.h" 47 #include "core/html/HTMLElement.h"
48 #include "core/html/HTMLImageElement.h"
48 #include "core/html/HTMLInputElement.h" 49 #include "core/html/HTMLInputElement.h"
49 #include "core/html/HTMLOptGroupElement.h" 50 #include "core/html/HTMLOptGroupElement.h"
50 #include "core/html/HTMLOptionElement.h" 51 #include "core/html/HTMLOptionElement.h"
51 #include "core/style/ComputedStyle.h" 52 #include "core/style/ComputedStyle.h"
52 #include "core/svg/SVGElement.h" 53 #include "core/svg/SVGElement.h"
53 #include "platform/instrumentation/tracing/TraceEvent.h" 54 #include "platform/instrumentation/tracing/TraceEvent.h"
54 #include "wtf/HashSet.h" 55 #include "wtf/HashSet.h"
55 #include "wtf/text/AtomicString.h" 56 #include "wtf/text/AtomicString.h"
56 57
57 namespace blink { 58 namespace blink {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 toHTMLOptionElement(element()).selected() || 280 toHTMLOptionElement(element()).selected() ||
280 toHTMLOptionElement(candidate).spatialNavigationFocused() != 281 toHTMLOptionElement(candidate).spatialNavigationFocused() !=
281 toHTMLOptionElement(element()).spatialNavigationFocused())) 282 toHTMLOptionElement(element()).spatialNavigationFocused()))
282 return false; 283 return false;
283 284
284 // FIXME: This line is surprisingly hot, we may wish to inline 285 // FIXME: This line is surprisingly hot, we may wish to inline
285 // hasDirectionAuto into StyleResolver. 286 // hasDirectionAuto into StyleResolver.
286 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto()) 287 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto())
287 return false; 288 return false;
288 289
290 if (isHTMLImageElement(candidate) && isHTMLImageElement(element()) &&
291 toHTMLImageElement(candidate).isCollapsed() !=
292 toHTMLImageElement(element()).isCollapsed()) {
esprehn 2017/02/15 02:08:46 good catch!
293 return false;
294 }
295
289 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink()) 296 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink())
290 return false; 297 return false;
291 298
292 if (candidate.isUnresolvedV0CustomElement() != 299 if (candidate.isUnresolvedV0CustomElement() !=
293 element().isUnresolvedV0CustomElement()) 300 element().isUnresolvedV0CustomElement())
294 return false; 301 return false;
295 302
296 if (element().parentOrShadowHostElement() != parent) { 303 if (element().parentOrShadowHostElement() != parent) {
297 if (!parent->isStyledElement()) 304 if (!parent->isStyledElement())
298 return false; 305 return false;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { 404 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) {
398 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), 405 INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(),
399 sharedStyleRejectedByParent, 1); 406 sharedStyleRejectedByParent, 1);
400 return nullptr; 407 return nullptr;
401 } 408 }
402 409
403 return shareElement->mutableComputedStyle(); 410 return shareElement->mutableComputedStyle();
404 } 411 }
405 412
406 } // namespace blink 413 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698