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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.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 21 matching lines...) Expand all
32 32
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/SVGNames.h" 34 #include "core/SVGNames.h"
35 #include "core/dom/ContainerNode.h" 35 #include "core/dom/ContainerNode.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/Element.h" 37 #include "core/dom/Element.h"
38 #include "core/frame/FrameView.h" 38 #include "core/frame/FrameView.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h" 40 #include "core/frame/UseCounter.h"
41 #include "core/html/HTMLIFrameElement.h" 41 #include "core/html/HTMLIFrameElement.h"
42 #include "core/html/HTMLImageElement.h"
42 #include "core/html/HTMLInputElement.h" 43 #include "core/html/HTMLInputElement.h"
43 #include "core/html/HTMLPlugInElement.h" 44 #include "core/html/HTMLPlugInElement.h"
44 #include "core/html/HTMLTableCellElement.h" 45 #include "core/html/HTMLTableCellElement.h"
45 #include "core/html/HTMLTextAreaElement.h" 46 #include "core/html/HTMLTextAreaElement.h"
46 #include "core/layout/LayoutTheme.h" 47 #include "core/layout/LayoutTheme.h"
47 #include "core/style/ComputedStyle.h" 48 #include "core/style/ComputedStyle.h"
48 #include "core/style/ComputedStyleConstants.h" 49 #include "core/style/ComputedStyleConstants.h"
49 #include "core/svg/SVGSVGElement.h" 50 #include "core/svg/SVGSVGElement.h"
50 #include "platform/Length.h" 51 #include "platform/Length.h"
51 #include "platform/transforms/TransformOperations.h" 52 #include "platform/transforms/TransformOperations.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // use normal instead. If the width of the cell is fixed, then 202 // use normal instead. If the width of the cell is fixed, then
202 // we don't actually use NOWRAP. 203 // we don't actually use NOWRAP.
203 if (style.width().isFixed()) 204 if (style.width().isFixed())
204 style.setWhiteSpace(EWhiteSpace::kNormal); 205 style.setWhiteSpace(EWhiteSpace::kNormal);
205 else 206 else
206 style.setWhiteSpace(EWhiteSpace::kNowrap); 207 style.setWhiteSpace(EWhiteSpace::kNowrap);
207 } 208 }
208 return; 209 return;
209 } 210 }
210 211
212 if (isHTMLImageElement(element)) {
213 if (toHTMLImageElement(element).isCollapsed())
214 style.setDisplay(EDisplay::None);
215 return;
216 }
217
211 if (isHTMLTableElement(element)) { 218 if (isHTMLTableElement(element)) {
212 // Tables never support the -webkit-* values for text-align and will reset 219 // Tables never support the -webkit-* values for text-align and will reset
213 // back to the default. 220 // back to the default.
214 if (style.textAlign() == ETextAlign::kWebkitLeft || 221 if (style.textAlign() == ETextAlign::kWebkitLeft ||
215 style.textAlign() == ETextAlign::kWebkitCenter || 222 style.textAlign() == ETextAlign::kWebkitCenter ||
216 style.textAlign() == ETextAlign::kWebkitRight) 223 style.textAlign() == ETextAlign::kWebkitRight)
217 style.setTextAlign(ETextAlign::kStart); 224 style.setTextAlign(ETextAlign::kStart);
218 return; 225 return;
219 } 226 }
220 227
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 style.setDisplay(EDisplay::Block); 482 style.setDisplay(EDisplay::Block);
476 483
477 // Columns don't apply to svg text elements. 484 // Columns don't apply to svg text elements.
478 if (isSVGTextElement(*element)) 485 if (isSVGTextElement(*element))
479 style.clearMultiCol(); 486 style.clearMultiCol();
480 } 487 }
481 adjustStyleForAlignment(style, parentStyle); 488 adjustStyleForAlignment(style, parentStyle);
482 } 489 }
483 490
484 } // namespace blink 491 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698