📄 renderstyle.cpp
字号:
if (box->width != other->box->width || box->min_width != other->box->min_width || box->max_width != other->box->max_width || box->height != other->box->height || box->min_height != other->box->min_height || box->max_height != other->box->max_height) return StyleDifferenceLayout; if (box->vertical_align != other->box->vertical_align || noninherited_flags._vertical_align != other->noninherited_flags._vertical_align) return StyleDifferenceLayout; if (box->boxSizing != other->box->boxSizing) return StyleDifferenceLayout; if (surround->margin != other->surround->margin) return StyleDifferenceLayout; if (surround->padding != other->surround->padding) return StyleDifferenceLayout; if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) { if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m_appearance || rareNonInheritedData->marginTopCollapse != other->rareNonInheritedData->marginTopCollapse || rareNonInheritedData->marginBottomCollapse != other->rareNonInheritedData->marginBottomCollapse || rareNonInheritedData->lineClamp != other->rareNonInheritedData->lineClamp || rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow) return StyleDifferenceLayout; if (rareNonInheritedData->flexibleBox.get() != other->rareNonInheritedData->flexibleBox.get() && *rareNonInheritedData->flexibleBox.get() != *other->rareNonInheritedData->flexibleBox.get()) return StyleDifferenceLayout; if (!rareNonInheritedData->shadowDataEquivalent(*other->rareNonInheritedData.get())) return StyleDifferenceLayout; if (!rareNonInheritedData->reflectionDataEquivalent(*other->rareNonInheritedData.get())) return StyleDifferenceLayout; if (rareNonInheritedData->m_multiCol.get() != other->rareNonInheritedData->m_multiCol.get() && *rareNonInheritedData->m_multiCol.get() != *other->rareNonInheritedData->m_multiCol.get()) return StyleDifferenceLayout; if (rareNonInheritedData->m_transform.get() != other->rareNonInheritedData->m_transform.get() && *rareNonInheritedData->m_transform.get() != *other->rareNonInheritedData->m_transform.get()) {#if USE(ACCELERATED_COMPOSITING) changedContextSensitiveProperties |= ContextSensitivePropertyTransform; // Don't return; keep looking for another change#else return StyleDifferenceLayout;#endif }#if !USE(ACCELERATED_COMPOSITING) if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) { if (rareNonInheritedData->m_transformStyle3D != other->rareNonInheritedData->m_transformStyle3D || rareNonInheritedData->m_backfaceVisibility != other->rareNonInheritedData->m_backfaceVisibility || rareNonInheritedData->m_perspective != other->rareNonInheritedData->m_perspective || rareNonInheritedData->m_perspectiveOriginX != other->rareNonInheritedData->m_perspectiveOriginX || rareNonInheritedData->m_perspectiveOriginY != other->rareNonInheritedData->m_perspectiveOriginY) return StyleDifferenceLayout; }#endif#if ENABLE(DASHBOARD_SUPPORT) // If regions change, trigger a relayout to re-calc regions. if (rareNonInheritedData->m_dashboardRegions != other->rareNonInheritedData->m_dashboardRegions) return StyleDifferenceLayout;#endif } if (rareInheritedData.get() != other->rareInheritedData.get()) { if (rareInheritedData->highlight != other->rareInheritedData->highlight || rareInheritedData->textSizeAdjust != other->rareInheritedData->textSizeAdjust || rareInheritedData->wordBreak != other->rareInheritedData->wordBreak || rareInheritedData->wordWrap != other->rareInheritedData->wordWrap || rareInheritedData->nbspMode != other->rareInheritedData->nbspMode || rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak || rareInheritedData->textSecurity != other->rareInheritedData->textSecurity) return StyleDifferenceLayout; if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get())) return StyleDifferenceLayout; if (textStrokeWidth() != other->textStrokeWidth()) return StyleDifferenceLayout; } if (inherited->indent != other->inherited->indent || inherited->line_height != other->inherited->line_height || inherited->list_style_image != other->inherited->list_style_image || inherited->font != other->inherited->font || inherited->horizontal_border_spacing != other->inherited->horizontal_border_spacing || inherited->vertical_border_spacing != other->inherited->vertical_border_spacing || inherited_flags._box_direction != other->inherited_flags._box_direction || inherited_flags._visuallyOrdered != other->inherited_flags._visuallyOrdered || inherited_flags._htmlHacks != other->inherited_flags._htmlHacks || noninherited_flags._position != other->noninherited_flags._position || noninherited_flags._floating != other->noninherited_flags._floating || noninherited_flags._originalDisplay != other->noninherited_flags._originalDisplay) return StyleDifferenceLayout; if (((int)noninherited_flags._effectiveDisplay) >= TABLE) { if (inherited_flags._border_collapse != other->inherited_flags._border_collapse || inherited_flags._empty_cells != other->inherited_flags._empty_cells || inherited_flags._caption_side != other->inherited_flags._caption_side || noninherited_flags._table_layout != other->noninherited_flags._table_layout) return StyleDifferenceLayout; // In the collapsing border model, 'hidden' suppresses other borders, while 'none' // does not, so these style differences can be width differences. if (inherited_flags._border_collapse && (borderTopStyle() == BHIDDEN && other->borderTopStyle() == BNONE || borderTopStyle() == BNONE && other->borderTopStyle() == BHIDDEN || borderBottomStyle() == BHIDDEN && other->borderBottomStyle() == BNONE || borderBottomStyle() == BNONE && other->borderBottomStyle() == BHIDDEN || borderLeftStyle() == BHIDDEN && other->borderLeftStyle() == BNONE || borderLeftStyle() == BNONE && other->borderLeftStyle() == BHIDDEN || borderRightStyle() == BHIDDEN && other->borderRightStyle() == BNONE || borderRightStyle() == BNONE && other->borderRightStyle() == BHIDDEN)) return StyleDifferenceLayout; } if (noninherited_flags._effectiveDisplay == LIST_ITEM) { if (inherited_flags._list_style_type != other->inherited_flags._list_style_type || inherited_flags._list_style_position != other->inherited_flags._list_style_position) return StyleDifferenceLayout; } if (inherited_flags._text_align != other->inherited_flags._text_align || inherited_flags._text_transform != other->inherited_flags._text_transform || inherited_flags._direction != other->inherited_flags._direction || inherited_flags._white_space != other->inherited_flags._white_space || noninherited_flags._clear != other->noninherited_flags._clear) return StyleDifferenceLayout; // Overflow returns a layout hint. if (noninherited_flags._overflowX != other->noninherited_flags._overflowX || noninherited_flags._overflowY != other->noninherited_flags._overflowY) return StyleDifferenceLayout; // If our border widths change, then we need to layout. Other changes to borders // only necessitate a repaint. if (borderLeftWidth() != other->borderLeftWidth() || borderTopWidth() != other->borderTopWidth() || borderBottomWidth() != other->borderBottomWidth() || borderRightWidth() != other->borderRightWidth()) return StyleDifferenceLayout; // If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree. const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get(); const CounterDirectiveMap* mapB = other->rareNonInheritedData->m_counterDirectives.get(); if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) return StyleDifferenceLayout; if (visual->counterIncrement != other->visual->counterIncrement || visual->counterReset != other->visual->counterReset) return StyleDifferenceLayout; if (inherited->m_effectiveZoom != other->inherited->m_effectiveZoom) return StyleDifferenceLayout; // Make sure these left/top/right/bottom checks stay below all layout checks and above // all visible checks. if (position() != StaticPosition) { if (surround->offset != other->surround->offset) { // Optimize for the case where a positioned layer is moving but not changing size. if (position() == AbsolutePosition && positionedObjectMoved(surround->offset, other->surround->offset)) return StyleDifferenceLayoutPositionedMovementOnly; // FIXME: We will need to do a bit of work in RenderObject/Box::setStyle before we // can stop doing a layout when relative positioned objects move. In particular, we'll need // to update scrolling positions and figure out how to do a repaint properly of the updated layer. //if (other->position() == RelativePosition) // return RepaintLayer; //else return StyleDifferenceLayout; } else if (box->z_index != other->box->z_index || box->z_auto != other->box->z_auto || visual->clip != other->visual->clip || visual->hasClip != other->visual->hasClip) return StyleDifferenceRepaintLayer; } if (rareNonInheritedData->opacity != other->rareNonInheritedData->opacity) {#if USE(ACCELERATED_COMPOSITING) changedContextSensitiveProperties |= ContextSensitivePropertyOpacity; // Don't return; keep looking for another change.#else return StyleDifferenceRepaintLayer;#endif } if (rareNonInheritedData->m_mask != other->rareNonInheritedData->m_mask || rareNonInheritedData->m_maskBoxImage != other->rareNonInheritedData->m_maskBoxImage) return StyleDifferenceRepaintLayer; if (inherited->color != other->inherited->color || inherited_flags._visibility != other->inherited_flags._visibility || inherited_flags._text_decorations != other->inherited_flags._text_decorations || inherited_flags._force_backgrounds_to_white != other->inherited_flags._force_backgrounds_to_white || surround->border != other->surround->border || *background.get() != *other->background.get() || visual->textDecoration != other->visual->textDecoration || rareInheritedData->userModify != other->rareInheritedData->userModify || rareInheritedData->userSelect != other->rareInheritedData->userSelect || rareNonInheritedData->userDrag != other->rareNonInheritedData->userDrag || rareNonInheritedData->m_borderFit != other->rareNonInheritedData->m_borderFit || rareInheritedData->textFillColor != other->rareInheritedData->textFillColor || rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor) return StyleDifferenceRepaint;#if USE(ACCELERATED_COMPOSITING) if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) { if (rareNonInheritedData->m_transformStyle3D != other->rareNonInheritedData->m_transformStyle3D || rareNonInheritedData->m_backfaceVisibility != other->rareNonInheritedData->m_backfaceVisibility || rareNonInheritedData->m_perspective != other->rareNonInheritedData->m_perspective || rareNonInheritedData->m_perspectiveOriginX != other->rareNonInheritedData->m_perspectiveOriginX || rareNonInheritedData->m_perspectiveOriginY != other->rareNonInheritedData->m_perspectiveOriginY) return StyleDifferenceRecompositeLayer; }#endif // Cursors are not checked, since they will be set appropriately in response to mouse events, // so they don't need to cause any repaint or layout. // Animations don't need to be checked either. We always set the new style on the RenderObject, so we will get a chance to fire off // the resulting transition properly. return StyleDifferenceEqual;}void RenderStyle::setClip(Length top, Length right, Length bottom, Length left){ StyleVisualData* data = visual.access(); data->clip.m_top = top; data->clip.m_right = right; data->clip.m_bottom = bottom; data->clip.m_left = left;}void RenderStyle::addCursor(CachedImage* image, const IntPoint& hotSpot){ CursorData data; data.cursorImage = image; data.hotSpot = hotSpot; if (!inherited.access()->cursorData) inherited.access()->cursorData = CursorList::create(); inherited.access()->cursorData->append(data);}void RenderStyle::setCursorList(PassRefPtr<CursorList> other){ inherited.access()->cursorData = other;}void RenderStyle::clearCursorList(){ if (inherited->cursorData) inherited.access()->cursorData = 0;}void RenderStyle::clearContent(){ if (rareNonInheritedData->m_content) rareNonInheritedData->m_content->clear();}void RenderStyle::setContent(PassRefPtr<StyleImage> image, bool add){ if (!image) return; // The object is null. Nothing to do. Just bail. OwnPtr<ContentData>& content = rareNonInheritedData.access()->m_content; ContentData* lastContent = content.get(); while (lastContent && lastContent->m_next) lastContent = lastContent->m_next; bool reuseContent = !add; ContentData* newContentData; if (reuseContent && content) { content->clear(); newContentData = content.release(); } else newContentData = new ContentData; if (lastContent && !reuseContent) lastContent->m_next = newContentData; else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -