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

Side by Side Diff: Source/core/html/HTMLImageElementTest.cpp

Issue 1218413002: Remove width calculation in `Width` hint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed widthAttr support in `Width` hint Created 5 years, 5 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
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/html/HTMLImageElement.h" 6 #include "core/html/HTMLImageElement.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
(...skipping 10 matching lines...) Expand all
21 { 21 {
22 } 22 }
23 23
24 OwnPtr<DummyPageHolder> m_dummyPageHolder; 24 OwnPtr<DummyPageHolder> m_dummyPageHolder;
25 }; 25 };
26 26
27 TEST_F(HTMLImageElementTest, width) 27 TEST_F(HTMLImageElementTest, width)
28 { 28 {
29 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(m_dumm yPageHolder->document(), nullptr, /* createdByParser */ false); 29 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(m_dumm yPageHolder->document(), nullptr, /* createdByParser */ false);
30 image->setAttribute(HTMLNames::widthAttr, "400"); 30 image->setAttribute(HTMLNames::widthAttr, "400");
31 EXPECT_EQ(400, image->resourceWidth().width); 31 // TODO(yoav): `width` does not impact resourceWidth until we resolve https: //github.com/ResponsiveImagesCG/picture-element/issues/268
32 EXPECT_EQ(500, image->resourceWidth().width);
32 image->setAttribute(HTMLNames::sizesAttr, "100vw"); 33 image->setAttribute(HTMLNames::sizesAttr, "100vw");
33 EXPECT_EQ(500, image->resourceWidth().width); 34 EXPECT_EQ(500, image->resourceWidth().width);
34 } 35 }
35 36
36 TEST_F(HTMLImageElementTest, sourceSize) 37 TEST_F(HTMLImageElementTest, sourceSize)
37 { 38 {
38 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(m_dumm yPageHolder->document(), nullptr, /* createdByParser */ false); 39 RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(m_dumm yPageHolder->document(), nullptr, /* createdByParser */ false);
39 image->setAttribute(HTMLNames::widthAttr, "400"); 40 image->setAttribute(HTMLNames::widthAttr, "400");
40 EXPECT_EQ(viewportWidth, image->sourceSize(*image)); 41 EXPECT_EQ(viewportWidth, image->sourceSize(*image));
41 image->setAttribute(HTMLNames::sizesAttr, "50vw"); 42 image->setAttribute(HTMLNames::sizesAttr, "50vw");
42 EXPECT_EQ(250, image->sourceSize(*image)); 43 EXPECT_EQ(250, image->sourceSize(*image));
43 } 44 }
44 45
45 } // namespace blink 46 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698