Changeset 216439 in webkit
- Timestamp:
- May 8, 2017 11:28:23 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r216438 r216439 1 2017-05-08 Chris Dumez <cdumez@apple.com> 2 3 Refactor ImageInputType::width() / height() for clarity 4 https://bugs.webkit.org/show_bug.cgi?id=171810 5 6 Reviewed by Zalan Bujtas. 7 8 Refactor ImageInputType::width() / height() for clarity. 9 10 * html/ImageInputType.cpp: 11 (WebCore::ImageInputType::height): 12 (WebCore::ImageInputType::width): 13 1 14 2017-05-08 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Source/WebCore/html/ImageInputType.cpp
r216426 r216439 180 180 element->document().updateLayout(); 181 181 182 if ( !element->renderer()) {183 // Check the attribute first for an explicit pixel value.184 if (auto optionalHeight = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(heightAttr))) 185 return optionalHeight.value();186 187 // If the image is available, use its height.188 HTMLImageLoader* imageLoader = element->imageLoader(); 189 if (imageLoader && imageLoader->image())190 return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned();191 }192 193 RenderBox* box = element->renderBox(); 194 return box ? adjustForAbsoluteZoom(box->contentHeight(), *box) :0;182 if (auto* renderer = element->renderer()) 183 return adjustForAbsoluteZoom(downcast<RenderBox>(*renderer).contentHeight(), *renderer); 184 185 // Check the attribute first for an explicit pixel value. 186 if (auto optionalHeight = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(heightAttr))) 187 return optionalHeight.value(); 188 189 // If the image is available, use its height. 190 auto* imageLoader = element->imageLoader(); 191 if (imageLoader && imageLoader->image()) 192 return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned(); 193 194 return 0; 195 195 } 196 196 … … 201 201 element->document().updateLayout(); 202 202 203 if ( !element->renderer()) {204 // Check the attribute first for an explicit pixel value.205 if (auto optionalWidth = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(widthAttr))) 206 return optionalWidth.value();207 208 // If the image is available, use its width.209 HTMLImageLoader* imageLoader = element->imageLoader(); 210 if (imageLoader && imageLoader->image())211 return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned();212 }213 214 RenderBox* box = element->renderBox(); 215 return box ? adjustForAbsoluteZoom(box->contentWidth(), *box) :0;203 if (auto* renderer = element->renderer()) 204 return adjustForAbsoluteZoom(downcast<RenderBox>(*renderer).contentWidth(), *renderer); 205 206 // Check the attribute first for an explicit pixel value. 207 if (auto optionalWidth = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(widthAttr))) 208 return optionalWidth.value(); 209 210 // If the image is available, use its width. 211 auto* imageLoader = element->imageLoader(); 212 if (imageLoader && imageLoader->image()) 213 return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned(); 214 215 return 0; 216 216 } 217 217
Note: See TracChangeset
for help on using the changeset viewer.