欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android Webkit Render

程序员文章站 2022-04-05 15:20:36
...

Rough exe sequence

void DocumentLoader::commitLoad(const char* data, int length)

      frameLoader->client()->committedLoad(this, data, length);

void FrameLoaderClientAndroid::committedLoad(DocumentLoader* loader, const char* data, int length)

      loader->commitData(data, length);

void DocumentLoader::commitData(const char* bytes, int length)

      m_writer.addData(bytes, length);

void DocumentWriter::addData(const char* str, int len, bool flush)

      parser->appendBytes(this, str, len, flush);

void DecodedDataDocumentParser::appendBytes(DocumentWriter* writer , const char* data, int length, bool shouldFlush)

      append(decoded);

void HTMLDocumentParser::append(const SegmentedString& source)

      pumpTokenizerIfPossible(AllowYield);

                pumpTokenizer(mode);

!!!LOOP!!!

                          m_treeBuilder->constructTreeFromToken(m_token);         

void HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken)

      constructTreeFromAtomicToken(token);

                processToken(token);

                          processStartTag(token);

                                    processStartTagForInBody(token);

                                              m_tree.insertHTMLElement(token);

void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken& token)

      attachToCurrent(element.release())

                attach(currentNode(), child);

                          child->attach();

void Element::attach()

      createRendererIfNeeded();

                RenderObject* newRenderer = createRendererAndStyle();

RenderObject* Node::createRendererAndStyle()

      newRenderer->setAnimatableStyle(style.release()); // setAnimatableStyle() can depend on renderer() already being set.                                                                

                setStyle(style);

                          styleDidChange(diff, oldStyle.get());

void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      RenderBoxModelObject::styleDidChange(diff, oldStyle);

void RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      create layer

      layer()->styleChanged(diff, oldStyle);

void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle)

      compositor()->updateLayerCompositingState(this)

      /*RenderLayerCompositor* compositor(); render view has one compositor*/

bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)

      updateBacking(layer, shouldRepaint);

                enableCompositingMode();

                          ensureRootPlatformLayer();

                                    m_rootPlatformLayer = GraphicsLayer::create(0);



                                    PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)

                                    {

                                        return new GraphicsLayerAndroid(client);

                                    }

                                   

                                    GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client)

                                              m_contentLayer = new LayerAndroid(renderLayer);

                                             

                                   

                layer->ensureBacking();

                RenderLayerBacking* RenderLayer::ensureBacking()

                          m_backing.set(new RenderLayerBacking(this));

                RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)

                          createGraphicsLayer();

                                    m_graphicsLayer = GraphicsLayer::create(this);                             

Finally,

void HTMLTreeBuilder::processToken(AtomicHTMLToken& token)

case HTMLToken::EndOfFile:                                                           

private void webkitDraw()

      draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mContentSize);

BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)

      BaseLayerAndroid* baseLayer = createBaseLayer(root);

                realBase = new BaseLayerAndroid(content);
BaseLayerAndroid::BaseLayerAndroid(LayerContent* content)
LayerAndroid((RenderLayer*)0)

create surface,

webview,

bool setBaseLayer(BaseLayerAndroid* newBaseLayer, bool showVisualIndicator,

      bool GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, bool showVisualIndicator,

bool GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, bool showVisualIndicator,

      collection = new SurfaceCollection(layer);

SurfaceCollection::SurfaceCollection(BaseLayerAndroid* layer)

      m_compositedRoot->assignSurfaces(&layerMergeState);

void LayerAndroid::assignSurfaces(LayerMergeState* mergeState)

      mergeState->currentSurface = new Surface();                            

/system/lib/libv8.so

v8::Handlev8::Value V8Node::appendChildCallback(const v8::Arguments& args)

      imp->appendChild(newChild, ec, true );

bool Node::appendChild(PassRefPtr newChild, ExceptionCode& ec, bool shouldLazyAttach)

      toContainerNode(this)->appendChild(newChild, ec, shouldLazyAttach);

bool ContainerNode::appendChild(PassRefPtr newChild, ExceptionCode& ec, bool shouldLazyAttach)

!!!LOOP!!!

      notifyChildInserted(child);         

                c->insertedIntoDocument();

void StyleElement::insertedIntoDocument(Document* document, Element* element)

      process(element);

                createSheet(e, m_startLineNumber, "");

                          m_sheet = CSSStyleSheet::create(e, String(), KURL(), document->inputEncoding());

                          m_sheet->checkLoaded();

void CSSStyleSheet::checkLoaded()

      ownerNode()->sheetLoaded()

bool StyleElement::sheetLoaded(Document* document)

      document->removePendingSheet();

void Document::removePendingSheet()

      styleSelectorChanged(RecalcStyleImmediately);

                recalcStyle(Force);

void Document::recalcStyle(StyleChange change)

      n->recalcStyle(change);

void Element::recalcStyle(StyleChange change)

      n->recalcStyle(change);

                setRenderStyle(newStyle);

void Node::setRenderStyle(PassRefPtr s)

      m_renderer->setAnimatableStyle(s);

void RenderObject::setAnimatableStyle(PassRefPtr style)

      setStyle(animation()->updateAnimations(this, style.get()));

                styleDidChange(diff, oldStyle.get());

void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      RenderBox::styleDidChange(diff, oldStyle);

void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

void RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      layer()->styleChanged(diff, oldStyle);

void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle)

      compositor()->updateLayerCompositingState(this)                                                                                         

bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)

      bool layerChanged = updateBacking(layer, shouldRepaint);

                enableCompositingMode();

                          ensureRootPlatformLayer();

                                    m_rootPlatformLayer = GraphicsLayer::create(0);

Graphic layer android create…, be aware, it is almost as same as the beginning


void ScriptRunner::timerFired(Timer* timer)

      toScriptElement(element.get())->execute(cachedScript);

      void ScriptElement::execute(CachedScript* cachedScript)

                executeScript(ScriptSourceCode(cachedScript));

                          Document::updateStyleForAllDocuments();

void Document::updateStyleForAllDocuments()

      doc->updateStyleIfNeeded();

                recalcStyle(NoChange);

                          n->recalcStyle(change);

                               recursive setRenderStyle(newStyle);

void Node::setRenderStyle(PassRefPtr s)

      m_renderer->setAnimatableStyle(s);

void RenderObject::setAnimatableStyle(PassRefPtr style)

      setStyle(animation()->updateAnimations(this, style.get()));

void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      RenderBox::styleDidChange(diff, oldStyle);

void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      RenderBoxModelObject::styleDidChange(diff, oldStyle);

void RenderBoxModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)

      layer()->styleChanged(diff, oldStyle);

void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle)

      if (compositor()->updateLayerCompositingState(this))

bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)

      bool layerChanged = updateBacking(layer, shouldRepaint);

                layer->ensureBacking();

RenderLayerBacking* RenderLayer::ensureBacking()

      m_backing.set(new RenderLayerBacking(this));

BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)

      layout();

                bool success = layoutIfNeededRecursive(m_mainFrame);

                          v->updateLayoutAndStyleIfNeededRecursive();

void FrameView::updateLayoutAndStyleIfNeededRecursive()

      layout();

                updateCompositingLayers();

                    view->compositor()->updateCompositingLayers(CompositingUpdateAfterLayoutOrStyleChange);

void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)

      computeCompositingRequirements(updateRoot, 0, compState, layersChanged);

@@@@@@@recursive, computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged);

                (updateBacking(layer, CompositingChangeRepaintNow))

                          layer->ensureBacking();

Above again


BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)

      layout();

                bool success = layoutIfNeededRecursive(m_mainFrame);

                          v->updateLayoutAndStyleIfNeededRecursive();

void FrameView::updateLayoutAndStyleIfNeededRecursive()

      layout();

                updateCompositingLayers();

                    view->compositor()->updateCompositingLayers(CompositingUpdateAfterLayoutOrStyleChange);

void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType updateType, RenderLayer* updateRoot)

.........As above, finish recursive computeCompositingRequirements(updateRoot, 0, compState, layersChanged);.........

      rebuildCompositingLayerTree(updateRoot, compState, childList);

@@@@recursive, rebuildCompositingLayerTree(curLayer, childState, childList);

                          layerBacking->updateGraphicsLayerConfiguration();

bool RenderLayerBacking::updateGraphicsLayerConfiguration()

      updateClippingLayers

                m_ancestorClippingLayer = GraphicsLayer::create(this);

BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)

      Above layout() exe finished

      BaseLayerAndroid* baseLayer = createBaseLayer(root);

                realBase = new BaseLayerAndroid(content);

BaseLayerAndroid* WebViewCore::recordContent(SkIPoint* point)

      Above layout() exe finished

      BaseLayerAndroid* baseLayer = createBaseLayer(root);

                realBase = new BaseLayerAndroid(content);

                          later, will be following

                          addChild(layer.getChild(i)->copy())->unref();

surface

As above surface create procedure,

void LayerAndroid::assignSurfaces(LayerMergeState* mergeState)

      mergeState->currentSurface = new Surface();

      ....

      sublayers[i]->assignSurfaces(mergeState);
相关标签: WebKit