Bug 924692 - Part 1: Add touch caret rendering support; r=roc

This commit is contained in:
Phoebe Chang
2014-06-03 15:08:25 +08:00
parent 40906b2fe9
commit b9fcaae0c1
14 changed files with 200 additions and 7 deletions

View File

@@ -29,6 +29,7 @@
#include "nsTableCellFrame.h"
#include "nsIDOMHTMLDocument.h"
#include "nsHTMLParts.h"
#include "nsPresShell.h"
#include "nsIPresShell.h"
#include "nsUnicharUtils.h"
#include "nsStyleSet.h"
@@ -2597,6 +2598,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
SetInitialSingleChild(mDocElementContainingBlock, newFrame);
// Create touch caret frame if there is a canvas frame
if (mDocElementContainingBlock->GetType() == nsGkAtoms::canvasFrame) {
ConstructAnonymousContentForCanvas(state, mDocElementContainingBlock,
aDocElement);
}
return newFrame;
}
@@ -2852,6 +2859,29 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
}
}
void
nsCSSFrameConstructor::ConstructAnonymousContentForCanvas(nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIContent* aDocElement)
{
NS_ASSERTION(aFrame->GetType() == nsGkAtoms::canvasFrame, "aFrame should be canvas frame!");
nsAutoTArray<nsIAnonymousContentCreator::ContentInfo, 4> anonymousItems;
GetAnonymousContent(aDocElement, aFrame, anonymousItems);
if (anonymousItems.IsEmpty()) {
// Touch caret is not enabled.
return;
}
FrameConstructionItemList itemsToConstruct;
nsContainerFrame* frameAsContainer = do_QueryFrame(aFrame);
AddFCItemsForAnonymousContent(aState, frameAsContainer, anonymousItems, itemsToConstruct);
nsFrameItems frameItems;
ConstructFramesFromItemList(aState, itemsToConstruct, frameAsContainer, frameItems);
frameAsContainer->AppendFrames(kPrincipalList, frameItems);
}
nsContainerFrame*
nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
nsPresContext* aPresContext,