Return the top-left ``<w:tc>`` element of a new span formed by
        merging the rectangular region defined by using this tc element and
        *other_tc* as diagonal corners.
498890
def merge(self, other_tc):
        
        top, left, height, width = self._span_dimensions(other_tc)
        top_tc = self._tbl.tr_lst[top].tc_at_grid_col(left)
        top_tc._grow_to(width, height)
        return top_tc
895068
def _rect_to_css(rect):
    
    return rect.top(), rect.right(), rect.bottom(), rect.left()
378247
public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) {

        final Insets insets;
        if (b != null) {
            insets = b.getBorderInsets(c);
        } else {
            insets = new Insets(0, 0, 0, 0);
        }

        return new Rectangle(x + insets.left, //
                y + insets.top, //
                width - insets.right - insets.left, //
                height - insets.top - insets.bottom);
    }
1023698
def get_rectangle(self):
        
        rec = [self.pos[0], self.pos[1]]*2
        for age in self.nodes:
            for node in age:
                # Check max/min for x/y coords
                for i in range(2):
                    if rec[0+i] > node.pos[i]:
                        rec[0+i] = node.pos[i]
                    elif rec[2+i] < node.pos[i]:
                        rec[2+i] = node.pos[i]
        return tuple(rec)
662853
private Span getNextSpan(int defaultLine, LayoutStateWrapper layoutState, LayoutManagerHelper helper) {
        OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();
        boolean preferLastSpan = false;

        if (helper.getOrientation() == HORIZONTAL) {
            preferLastSpan = (layoutState.getLayoutDirection() == LAYOUT_START) != helper.getReverseLayout();
        } else {
            preferLastSpan = ((layoutState.getLayoutDirection() == LAYOUT_START) == helper.getReverseLayout()) == helper.isDoLayoutRTL();
        }


        final int startIndex, endIndex, diff;
        if (preferLastSpan) {
            startIndex = mNumLanes - 1;
            endIndex = -1;
            diff = -1;
        } else {
            startIndex = 0;
            endIndex = mNumLanes;
            diff = 1;
        }
        if (layoutState.getLayoutDirection() == LAYOUT_END) {
            Span min = null;
            int minLine = Integer.MAX_VALUE;
            for (int i = startIndex; i != endIndex; i += diff) {
                final Span other = mSpans[i];
                int otherLine = other.getEndLine(defaultLine, orientationHelper);
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "end starIndex " + i + " end otherLine " + otherLine);
                }
                if (otherLine < minLine) {
                    min = other;
                    minLine = otherLine;
                }
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "end min " + min + " end minLine " + minLine);
                }
            }
            if (BuildConfig.DEBUG) {
                Log.d(TAG, "final end min " + min + " final end minLine " + minLine);
            }
            return min;
        } else {
            Span max = null;
            int maxLine = Integer.MIN_VALUE;
            for (int i = startIndex; i != endIndex; i += diff) {
                final Span other = mSpans[i];
                int otherLine = other.getStartLine(defaultLine, orientationHelper);
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "start starIndex " + i + " start otherLine " + otherLine);
                }
                if (otherLine > maxLine) {
                    max = other;
                    maxLine = otherLine;
                }
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "start max " + max + " start maxLine " + maxLine);
                }
            }
            if (BuildConfig.DEBUG) {
                Log.d(TAG, "final start max " + max + " final start maxLine " + maxLine);
            }
            return max;
        }
    }
271268
def addElement(self,etype='hex8',corners=[-1.0,-1.0,-1.0,1.,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0],name='new_elem'):
        '''
        
        '''
        lastelm = self.elements[-1][1]
        lastnode = self.nodes[-1][0]
        elm = [etype,lastelm+1]
        for i in range(old_div(len(corners),3)):
            elm.append(lastnode+1+i)
            
        self.elements.append(elm)
        self.elsets['e'+name] = {}
        self.elsets['e'+name][int(elm[1])] = True
        
        cnt = 1
        self.nsets['n'+name] = []
        for i in range(0,len(corners),3):
            self.nodes.append([lastnode+cnt, corners[i], corners[i+1], corners[i+2]])
            self.nsets['n'+name].append(lastnode+cnt)
            cnt += 1
        
        # if this is a quad4 or tri3 element make a surface set
        if etype == 'quad4' or etype == 'tri3':
            self.fsets['f'+name] = [[etype, MeshDef.facetID, lastnode+1, lastnode+2, lastnode+3, lastnode+4]]
            MeshDef.facetID += 1
1352557
def avl_new_top(t1, t2, top, direction=0):
    
    top.parent = None
    assert top.parent is None, str(top.parent.value)
    top.set_child(direction, t1)
    top.set_child(1 - direction, t2)
    top.balance = max(height(t1), height(t2)) + 1
    return top
1034224
def merge(self, merge_area, tab):
        """"""

        top, left, bottom, right = merge_area

        cursor = self.grid.actions.cursor
        top_left_code = self.code_array((top, left, cursor[2]))

        selection = Selection([(top, left)], [(bottom, right)], [], [], [])

        # Check if the merge area overlaps another merge area

        error_msg = _("Overlapping merge area at {} prevents merge.")

        for row in xrange(top, bottom + 1):
            for col in xrange(left, right + 1):
                key = row, col, tab
                if self.code_array.cell_attributes[key]["merge_area"]:
                    post_command_event(self.main_window, self.StatusBarMsg,
                                       text=error_msg.format(str(key)))
                    return

        self.delete_selection(selection)
        self.set_code((top, left, cursor[2]), top_left_code)

        attr = {"merge_area": merge_area, "locked": True}

        self._set_cell_attr(selection, tab, attr)

        tl_selection = Selection([], [], [], [], [(top, left)])
        attr = {"locked": False}

        self._set_cell_attr(tl_selection, tab, attr)
413014
public static Range toRange(Span span) {
    return new Range(toKey(span.getStart()), span.isStartInclusive(), toKey(span.getEnd()),
        span.isEndInclusive());
  }
801034
def get_merged_rect(self, grid, key, rect):
        """"""

        row, col, tab = key

        # Check if cell is merged:
        cell_attributes = grid.code_array.cell_attributes
        merge_area = cell_attributes[(row, col, tab)]["merge_area"]

        if merge_area is None:
            return rect

        else:
            # We have a merged cell
            top, left, bottom, right = merge_area

            # Are we drawing the top left cell?
            if top == row and left == col:
                # Set rect to merge area
                ul_rect = grid.CellToRect(row, col)
                br_rect = grid.CellToRect(bottom, right)

                width = br_rect.x - ul_rect.x + br_rect.width
                height = br_rect.y - ul_rect.y + br_rect.height

                rect = wx.Rect(ul_rect.x, ul_rect.y, width, height)

                return rect
102160
def iter_left_col_tcs(self):
        """"""
        col_idx = self._left
        for tr in self._tbl.tr_lst[self._top:self._bottom]:
            yield tr.tc_lst[col_idx]
355446
function (x, y, width, height) {

		// create a dummy element
		var clipRect = this.createElement();

		// mimic a rectangle with its style object for automatic updating in attr
		return extend(clipRect, {
			members: [],
			left: x,
			top: y,
			width: width,
			height: height,
			getCSS: function (inverted) {
				var rect = this,//clipRect.element.style,
					top = rect.top,
					left = rect.left,
					right = left + rect.width,
					bottom = top + rect.height,
					ret = {
						clip: 'rect(' +
							mathRound(inverted ? left : top) + 'px,' +
							mathRound(inverted ? bottom : right) + 'px,' +
							mathRound(inverted ? right : bottom) + 'px,' +
							mathRound(inverted ? top : left) + 'px)'
					};

				// issue 74 workaround
				if (!inverted && docMode8) {
					extend(ret, {
						width: right + PX,
						height: bottom + PX
					});
				}
				return ret;
			},

			// used in attr and animation to update the clipping of all members
			updateClipping: function () {
				each(clipRect.members, function (member) {
					member.css(clipRect.getCSS(member.inverted));
				});
			}
		});

	}
488985
public double getChildSpan() {
        double span = 0.0;
        for (Node node : getVisibleChildren()) {
            span += nodeSplits.get(node);
        }
        return span;
    }
413465
def intersection(ir):
        
        x = max(self.getX(), ur.getX())
        y = max(self.getY(), ur.getY())
        w = min(self.getBottomRight().x, ur.getBottomRight().x) - x
        h = min(self.getBottomRight().y, ur.getBottomRight().y) - y
        if w > 0 and h > 0:
            return Region(x, y, w, h)
        return None
1256407
public Bbox union(Bbox other) {
		if (other.getWidth() == 0 && other.getHeight() == 0 && other.getX() == 0 && other.getY() == 0) {
			return (Bbox) clone();
		}
		if (width == 0 && height == 0 && x == 0 && y == 0) {
			return (Bbox) other.clone();
		}

		double minx = other.getX() < this.getX() ? other.getX() : this.getX();
		double maxx = other.getEndPoint().getX() > this.getEndPoint().getX() ? other.getEndPoint().getX() : this
				.getEndPoint().getX();
		double miny = other.getY() < this.getY() ? other.getY() : this.getY();
		double maxy = other.getEndPoint().getY() > this.getEndPoint().getY() ? other.getEndPoint().getY() : this
				.getEndPoint().getY();
		return new Bbox(minx, miny, (maxx - minx), (maxy - miny));
	}
825991
public static final int getW(Element e) {
        int ret = e.getOffsetWidth();
        ret -= MiscUtils.getComputedStyleInt(e, "paddingLeft");
        ret -= MiscUtils.getComputedStyleInt(e, "paddingRight");
        ret -= MiscUtils.getComputedStyleInt(e, "borderLeftWidth");
        ret -= MiscUtils.getComputedStyleInt(e, "borderRightWidth");
        return Math.max(ret, 0);
    }
485327
public Rectangle rectangle(float top, float bottom) {
		Rectangle tmp = new Rectangle(this);
		if (getTop() > top) {
			tmp.setTop(top);
			tmp.disableBorderSide(TOP);
		}
		if (getBottom() < bottom) {
			tmp.setBottom(bottom);
			tmp.disableBorderSide(BOTTOM);
		}
		return tmp;
	}