WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
79867
[BlackBerry] Upstream GraphicsLayerBlackBerry.{h, cpp}
https://bugs.webkit.org/show_bug.cgi?id=79867
Summary
[BlackBerry] Upstream GraphicsLayerBlackBerry.{h, cpp}
Robin Cao
Reported
2012-02-28 21:47:01 PST
This is the BlackBerry implementation of GraphicsLayer.
Attachments
patch
(41.13 KB, patch)
2012-02-29 01:18 PST
,
Robin Cao
no flags
Details
Formatted Diff
Diff
patch v2
(41.06 KB, patch)
2012-03-01 00:19 PST
,
Robin Cao
no flags
Details
Formatted Diff
Diff
patch v3
(40.96 KB, patch)
2012-03-07 02:57 PST
,
Robin Cao
no flags
Details
Formatted Diff
Diff
patch-for-landing
(40.95 KB, patch)
2012-03-08 00:02 PST
,
Robin Cao
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Robin Cao
Comment 1
2012-02-29 01:18:40 PST
Created
attachment 129411
[details]
patch
Rob Buis
Comment 2
2012-02-29 07:33:36 PST
Comment on
attachment 129411
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=129411&action=review
Looks good but can be cleaned up a bit more.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:53 > +#include "NotImplemented.h"
Not used?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:58 > +#include <wtf/text/CString.h>
Check for all includes if they are needed please.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:71 > + layer.setBorderColor(static_cast<RGBA32>(0));
Better use transparant from Color.h
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:81 > + layer.setBackgroundColor(static_cast<RGBA32>(0));
Ditto.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:278 > +void GraphicsLayerBlackBerry::setHasFixedContainer(bool b)
b is not a good param name here.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:287 > +void GraphicsLayerBlackBerry::setHasFixedAncestorInDOMTree(bool b)
Ditto.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:400 > + // This is what GraphicsLayerCA checks for
Lacks period.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:404 > + // We only support these two kinds of properties ATM
Ditto.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:406 > + && values.property() != AnimatedPropertyOpacity)
Can be put on one line.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:433 > + while (animation = removeAnimationByName(animationName, m_runningAnimations)) {
Can be combined.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h:37 > +#include "GraphicsContext.h"
Needed?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h:39 > +#include "LayerAnimation.h"
Needed?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h:98 > + virtual void removeAnimation(const String& /*animationName*/);
Why comment the param names?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h:172 > + ContentsLayerPurpose m_contentsLayerPurpose;
You should be able to compress this a bit by giving it 2 bits : ContentsLayerPurpose m_contentsLayerPurpose : 2; But make sure our compiler really decreases the object size, just try with sizeof before and after.
Robin Cao
Comment 3
2012-03-01 00:12:12 PST
(In reply to
comment #2
)
> (From update of
attachment 129411
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=129411&action=review
> > > > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.h:172 > > + ContentsLayerPurpose m_contentsLayerPurpose; > > You should be able to compress this a bit by giving it 2 bits : > ContentsLayerPurpose m_contentsLayerPurpose : 2; > But make sure our compiler really decreases the object size, just try with sizeof before and after.
I tried the bit-field, but sizeof(GraphicsLayerBlackBerry) gives the same result. I prefer not to change it. All the other comments will be addressed in a revised patch. Thank you very much!
Robin Cao
Comment 4
2012-03-01 00:19:58 PST
Created
attachment 129652
[details]
patch v2
Rob Buis
Comment 5
2012-03-05 12:41:37 PST
Comment on
attachment 129652
[details]
patch v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=129652&action=review
Looks good, can be cleaned up some more.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:54 > +#include "PlatformString.h"
Is PlatformString.h include really needed?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:56 > +using namespace std;
Might not be needed if you use clampTo.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:332 > + float clampedOpacity = max(min(opacity, 1.0f), 0.0f);
better use clampTo from MathExtras.h to make clear what you are doing here.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:356 > + m_layer->setNeedsDisplayInRect(rect);
You could look at putting some the one/two liners in the header, but only if you do not need to add another include....
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:567 > +}
Above two functions look very similar, can we share code?
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:836 > + m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
better use m_contentsLayer->setPosition(m_contentsRect.location());
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:853 > + m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
FloatPoint::zero
Robin Cao
Comment 6
2012-03-07 02:49:35 PST
(In reply to
comment #5
)
> (From update of
attachment 129652
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=129652&action=review
> > Looks good, can be cleaned up some more. > > > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:54 > > +#include "PlatformString.h" > > Is PlatformString.h include really needed? >
Good catch, this is already indirectly included in GraphicsLayer.h, so can be removed.
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:56 > > +using namespace std; > > Might not be needed if you use clampTo. > > > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:332 > > + float clampedOpacity = max(min(opacity, 1.0f), 0.0f); > > better use clampTo from MathExtras.h to make clear what you are doing here. >
Fixed, clampTo is much more readable here.
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:356 > > + m_layer->setNeedsDisplayInRect(rect); > > You could look at putting some the one/two liners in the header, but only if you do not need to add another include.... >
Moving these two liner to header file will require one more include in the header. So I prefer not to move them.
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:567 > > +} > > Above two functions look very similar, can we share code? >
The two functions look very similar, but they have some subtle differences, which make it hard to share code here. We can refactor the code later.
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:836 > > + m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y())); > > better use m_contentsLayer->setPosition(m_contentsRect.location()); >
I made the following changes: - m_contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y())); - m_contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height())); + m_contentsLayer->setPosition(m_contentsRect.location()); + m_contentsLayer->setBounds(m_contentsRect.size());
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:853 > > + m_contentsLayer->setAnchorPoint(FloatPoint(0, 0)); > > FloatPoint::zero
Fixed.
Robin Cao
Comment 7
2012-03-07 02:57:08 PST
Created
attachment 130582
[details]
patch v3
Rob Buis
Comment 8
2012-03-07 11:30:12 PST
Comment on
attachment 130582
[details]
patch v3 View in context:
https://bugs.webkit.org/attachment.cgi?id=130582&action=review
Almost there, have a look especially at the release issue. Maybe you can get Leo to cq+ for you once fixed.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:146 > + if (GraphicsLayer::replaceChild(oldChild, newChild)) {
I think early return may look better here.
> Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:384 > + return layerAnimation.release();
I dont think you want to release here? Note that removeAnimationByIdAndProperty doesnt do it either.
Robin Cao
Comment 9
2012-03-07 23:51:23 PST
(In reply to
comment #8
)
> (From update of
attachment 130582
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=130582&action=review
> > Almost there, have a look especially at the release issue. Maybe you can get Leo to cq+ for you once fixed. > > > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:146 > > + if (GraphicsLayer::replaceChild(oldChild, newChild)) { > > I think early return may look better here. >
Fixed.
> > Source/WebCore/platform/graphics/blackberry/GraphicsLayerBlackBerry.cpp:384 > > + return layerAnimation.release(); > > I dont think you want to release here? Note that removeAnimationByIdAndProperty doesn't do it either.
"return layerAnimation.release();" is equivalent to "return layerAnimation;" in functionality. But for readability and consistency it makes sense to use "return layerAnimation;" in both functions.
Robin Cao
Comment 10
2012-03-08 00:02:40 PST
Created
attachment 130783
[details]
patch-for-landing
WebKit Review Bot
Comment 11
2012-03-08 01:46:14 PST
Comment on
attachment 130783
[details]
patch-for-landing Clearing flags on attachment: 130783 Committed
r110156
: <
http://trac.webkit.org/changeset/110156
>
WebKit Review Bot
Comment 12
2012-03-08 01:46:20 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug