[webkit-reviews] review denied: [Bug 87846] vw/vh units used as font/line-height values don't scale with the viewport : [Attachment 231724] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat May 24 19:24:39 PDT 2014
Darin Adler <darin at apple.com> has denied Bem Jones-Bey <bjonesbe at adobe.com>'s
request for review:
Bug 87846: vw/vh units used as font/line-height values don't scale with the
viewport
https://bugs.webkit.org/show_bug.cgi?id=87846
Attachment 231724: Patch
https://bugs.webkit.org/attachment.cgi?id=231724&action=review
------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=231724&action=review
This patch seems quite good. I reluctantly need to review- because of the for
loop mistake that is copying every MatchedPropertiesCacheItem.
> Source/WebCore/css/CSSToLengthConversionData.cpp:69
> + if (m_renderView) {
> + IntSize viewportSize = m_renderView->viewportSize();
> + return std::min(viewportSize.width(), viewportSize.height()) /
100.0;
> + }
> +
> + return 0.0;
WebKit coding style is to use early return:
if (!m_renderView)
return 0;
...
We don’t like to nest the normal case inside an if statement.
> Source/WebCore/css/StyleResolver.cpp:1582
> + for (auto cacheKeyValue : m_matchedPropertiesCache) {
This is going to copy each item out of the cache, and we definitely don’t want
to do that! That’s copying a vector and churning the reference count on two
objects among other things. To avoid that, simply use auto& instead of auto
here.
> Source/WebCore/dom/Document.cpp:3190
> + // FIXME Ideally, we should save the list of elements that have viewport
units and only iterate over those.
WebKit comment style puts a colon after the FIXME.
> Source/WebCore/dom/Document.cpp:3192
> + RenderObject* renderObject = element->renderer();
I would suggest calling this local variable renderer rather than renderObject.
Also, the correct type for Element::renderer is RenderElement*, not
RenderObject*; using RenderObject unnecessarily lowers the type and calls the
slower RenderObject::style rather than the faster RenderElement::style. I
suggest using auto or auto* so we automatically get the type right, or
RenderElement* would also be OK.
> Source/WebCore/dom/Document.h:1280
> + void notifyResizeForViewportUnits();
While there are other functions with names like this, I really don’t like them.
What does “notify resize for viewport units” mean? We could probably make a
phrase for this that makes sense in English and is less jargony.
More information about the webkit-reviews
mailing list