MCPcopy Create free account
hub / github.com/dillo-browser/dillo / getWidgetAtPointLevel

Method getWidgetAtPointLevel

dw/textblock.cc:2890–2949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2888}
2889
2890core::Widget *Textblock::getWidgetAtPointLevel (int x, int y, int level,
2891 core::GettingWidgetAtPointContext
2892 *context)
2893{
2894 DBG_OBJ_ENTER ("events", 0, "Textblock::getWidgetAtPointLevel", "%d, %d, %s",
2895 x, y, stackingLevelText (level));
2896
2897 Widget *widgetAtPoint = NULL;
2898
2899 switch (level) {
2900 case SL_IN_FLOW:
2901 {
2902 int lineIndex = findLineIndexWhenAllocated (y - allocation.y);
2903
2904 if (lineIndex >= 0 && lineIndex < lines->size ()) {
2905 Line *line = lines->getRef (lineIndex);
2906
2907 for (int wordIndex = line->lastWord;
2908 widgetAtPoint == NULL && wordIndex >= line->firstWord;
2909 wordIndex--) {
2910 Word *word = words->getRef (wordIndex);
2911 if (word->content.type == core::Content::WIDGET_IN_FLOW &&
2912 !core::StackingContextMgr::handledByStackingContextMgr
2913 (word->content.widget))
2914 widgetAtPoint =
2915 word->content.widget->getWidgetAtPoint (x, y, context);
2916 }
2917 }
2918 }
2919 break;
2920
2921 case SL_OOF_REF:
2922 // TODO Inefficient. Perhaps store OOF references in seperate
2923 // (much smaller!) list.
2924 for (int oofmIndex = NUM_OOFM; widgetAtPoint == NULL && oofmIndex >= 0;
2925 oofmIndex--) {
2926 for (int wordIndex = words->size () - 1;
2927 widgetAtPoint == NULL && wordIndex >= 0; wordIndex--) {
2928 Word *word = words->getRef (wordIndex);
2929 if (word->content.type == core::Content::WIDGET_OOF_REF &&
2930 getOOFMIndex (word->content.widgetReference->widget)
2931 == oofmIndex &&
2932 doesWidgetOOFInterruptDrawing (word->content.widgetReference
2933 ->widget))
2934 widgetAtPoint =
2935 word->content.widgetReference->widget
2936 ->getWidgetAtPointInterrupted (x, y, context);
2937 }
2938 }
2939 break;
2940
2941 default:
2942 widgetAtPoint =
2943 OOFAwareWidget::getWidgetAtPointLevel (x, y, level, context);
2944 break;
2945 }
2946
2947 DBG_OBJ_LEAVE_VAL ("%p", widgetAtPoint);

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
getRefMethod · 0.45
getWidgetAtPointMethod · 0.45

Tested by

no test coverage detected