Title: [216439] trunk/Source/WebCore
- Revision
- 216439
- Author
- cdu...@apple.com
- Date
- 2017-05-08 11:28:23 -0700 (Mon, 08 May 2017)
Log Message
Refactor ImageInputType::width() / height() for clarity
https://bugs.webkit.org/show_bug.cgi?id=171810
Reviewed by Zalan Bujtas.
Refactor ImageInputType::width() / height() for clarity.
* html/ImageInputType.cpp:
(WebCore::ImageInputType::height):
(WebCore::ImageInputType::width):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (216438 => 216439)
--- trunk/Source/WebCore/ChangeLog 2017-05-08 18:19:31 UTC (rev 216438)
+++ trunk/Source/WebCore/ChangeLog 2017-05-08 18:28:23 UTC (rev 216439)
@@ -1,3 +1,16 @@
+2017-05-08 Chris Dumez <cdu...@apple.com>
+
+ Refactor ImageInputType::width() / height() for clarity
+ https://bugs.webkit.org/show_bug.cgi?id=171810
+
+ Reviewed by Zalan Bujtas.
+
+ Refactor ImageInputType::width() / height() for clarity.
+
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::height):
+ (WebCore::ImageInputType::width):
+
2017-05-08 Zalan Bujtas <za...@apple.com>
Bail out of simple line layout when hyphen needs a fallback font.
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (216438 => 216439)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2017-05-08 18:19:31 UTC (rev 216438)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2017-05-08 18:28:23 UTC (rev 216439)
@@ -179,19 +179,19 @@
element->document().updateLayout();
- if (!element->renderer()) {
- // Check the attribute first for an explicit pixel value.
- if (auto optionalHeight = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(heightAttr)))
- return optionalHeight.value();
+ if (auto* renderer = element->renderer())
+ return adjustForAbsoluteZoom(downcast<RenderBox>(*renderer).contentHeight(), *renderer);
- // If the image is available, use its height.
- HTMLImageLoader* imageLoader = element->imageLoader();
- if (imageLoader && imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned();
- }
+ // Check the attribute first for an explicit pixel value.
+ if (auto optionalHeight = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(heightAttr)))
+ return optionalHeight.value();
- RenderBox* box = element->renderBox();
- return box ? adjustForAbsoluteZoom(box->contentHeight(), *box) : 0;
+ // If the image is available, use its height.
+ auto* imageLoader = element->imageLoader();
+ if (imageLoader && imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned();
+
+ return 0;
}
unsigned ImageInputType::width() const
@@ -200,19 +200,19 @@
element->document().updateLayout();
- if (!element->renderer()) {
- // Check the attribute first for an explicit pixel value.
- if (auto optionalWidth = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(widthAttr)))
- return optionalWidth.value();
+ if (auto* renderer = element->renderer())
+ return adjustForAbsoluteZoom(downcast<RenderBox>(*renderer).contentWidth(), *renderer);
- // If the image is available, use its width.
- HTMLImageLoader* imageLoader = element->imageLoader();
- if (imageLoader && imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned();
- }
+ // Check the attribute first for an explicit pixel value.
+ if (auto optionalWidth = parseHTMLNonNegativeInteger(element->attributeWithoutSynchronization(widthAttr)))
+ return optionalWidth.value();
- RenderBox* box = element->renderBox();
- return box ? adjustForAbsoluteZoom(box->contentWidth(), *box) : 0;
+ // If the image is available, use its width.
+ auto* imageLoader = element->imageLoader();
+ if (imageLoader && imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned();
+
+ return 0;
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes