зеркало из https://github.com/mozilla/pjs.git
Bug 374832, lower opacity on drag images, Bug 375038, dragging doesn't work on blocks inside inlines, r+sr=roc
This commit is contained in:
Родитель
543977cd9d
Коммит
cc2acf1711
|
@ -479,20 +479,6 @@ GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
// Get the frame's next-in-flow, or, if it doesn't have one,
|
||||
// its special sibling.
|
||||
static nsIFrame*
|
||||
GetNifOrSpecialSibling(nsFrameManager *aFrameManager, nsIFrame *aFrame)
|
||||
{
|
||||
nsIFrame *result = aFrame->GetNextContinuation();
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (IsFrameSpecial(aFrame))
|
||||
GetSpecialSibling(aFrameManager, aFrame, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
SetFrameIsSpecial(nsIFrame* aFrame, nsIFrame* aSpecialSibling)
|
||||
{
|
||||
|
@ -9672,7 +9658,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
|||
NS_PRECONDITION(gInApplyRenderingChangeToTree,
|
||||
"should only be called within ApplyRenderingChangeToTree");
|
||||
|
||||
for ( ; aFrame; aFrame = GetNifOrSpecialSibling(aFrameManager, aFrame)) {
|
||||
for ( ; aFrame; aFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(aFrame)) {
|
||||
// Get view if this frame has one and trigger an update. If the
|
||||
// frame doesn't have a view, find the nearest containing view
|
||||
// (adjusting r's coordinate system to reflect the nesting) and
|
||||
|
@ -10749,7 +10735,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
|
|||
nsIFrame *parentFrame = kidFrame->GetParent();
|
||||
kidFrame = nsnull;
|
||||
if (parentFrame) {
|
||||
parentFrame = GetNifOrSpecialSibling(aFrameManager, parentFrame);
|
||||
parentFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(parentFrame);
|
||||
}
|
||||
if (parentFrame) {
|
||||
// Found it, continue the search with its first child.
|
||||
|
@ -10832,7 +10818,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
|
|||
|
||||
// We didn't find a matching frame. If aFrame has a next-in-flow,
|
||||
// then continue looking there
|
||||
aParentFrame = GetNifOrSpecialSibling(aFrameManager, aParentFrame);
|
||||
aParentFrame = nsLayoutUtils::GetNextContinuationOrSpecialSibling(aParentFrame);
|
||||
#ifdef NOISY_FINDFRAME
|
||||
if (aParentFrame) {
|
||||
FFWC_nextInFlows++;
|
||||
|
|
|
@ -1175,6 +1175,25 @@ nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
|
|||
return lastCommonFrame;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsLayoutUtils::GetNextContinuationOrSpecialSibling(nsIFrame *aFrame)
|
||||
{
|
||||
nsIFrame *result = aFrame->GetNextContinuation();
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if ((aFrame->GetStateBits() & NS_FRAME_IS_SPECIAL) != 0) {
|
||||
// We only store the "special sibling" annotation with the first
|
||||
// frame in the flow. Walk back to find that frame now.
|
||||
aFrame = aFrame->GetFirstInFlow();
|
||||
|
||||
void* value = aFrame->GetProperty(nsGkAtoms::IBSplitSpecialSibling);
|
||||
return NS_STATIC_CAST(nsIFrame*, value);
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLayoutUtils::IsViewportScrollbarFrame(nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -501,6 +501,12 @@ public:
|
|||
GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1, nsIFrame* aFrame2,
|
||||
nsIFrame* aKnownCommonAncestorHint);
|
||||
|
||||
/**
|
||||
* Get a frame's next-in-flow, or, if it doesn't have one, its special sibling.
|
||||
*/
|
||||
static nsIFrame*
|
||||
GetNextContinuationOrSpecialSibling(nsIFrame *aFrame);
|
||||
|
||||
/**
|
||||
* Check whether aFrame is a part of the scrollbar or scrollcorner of
|
||||
* the root content.
|
||||
|
|
|
@ -5098,7 +5098,8 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
|||
|
||||
// use the nearest ancestor frame that includes all continuations as the
|
||||
// root for building the display list
|
||||
while (ancestorFrame && ancestorFrame->GetNextInFlow())
|
||||
while (ancestorFrame &&
|
||||
nsLayoutUtils::GetNextContinuationOrSpecialSibling(ancestorFrame))
|
||||
ancestorFrame = ancestorFrame->GetParent();
|
||||
|
||||
if (!ancestorFrame)
|
||||
|
|
|
@ -247,6 +247,11 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
|
|||
nsresult rv = DrawDrag(aDOMNode, aRegion,
|
||||
NSToIntRound(screenPoint.x), NSToIntRound(screenPoint.y),
|
||||
aDragRect, getter_AddRefs(surface));
|
||||
if (!aDragRect->width || !aDragRect->height) {
|
||||
// just use some suitable defaults
|
||||
aDragRect->SetRect(NSToIntRound(screenPoint.x), NSToIntRound(screenPoint.y), 20, 20);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !surface)
|
||||
return nsnull;
|
||||
|
||||
|
@ -284,16 +289,17 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
|
|||
for (PRUint32 i = 0; i < height; ++i) {
|
||||
PRUint8* src = (PRUint8 *)imageData + i * stride;
|
||||
for (PRUint32 j = 0; j < width; ++j) {
|
||||
// reduce transparency overall by multipying by a factor
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
dest[0] = src[1];
|
||||
dest[1] = src[2];
|
||||
dest[2] = src[3];
|
||||
dest[3] = PRUint8(src[0] * 0.8); // reduce transparency overall
|
||||
dest[3] = PRUint8(src[0] * DRAG_TRANSLUCENCY);
|
||||
#else
|
||||
dest[0] = src[2];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[0];
|
||||
dest[3] = PRUint8(src[3] * 0.8); // reduce transparency overall
|
||||
dest[3] = PRUint8(src[3] * DRAG_TRANSLUCENCY);
|
||||
#endif
|
||||
src += 4;
|
||||
dest += 4;
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
#include "gfxImageSurface.h"
|
||||
#endif
|
||||
|
||||
// translucency level for drag images
|
||||
#define DRAG_TRANSLUCENCY 0.65
|
||||
|
||||
class nsIDOMNode;
|
||||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
|
|
Загрузка…
Ссылка в новой задаче