Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sammycage committed Dec 21, 2024
1 parent 90942f1 commit dab9e11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions source/svgelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,15 @@ void SVGElement::build()

void SVGElement::layoutElement(const SVGLayoutState& state)
{
m_paintBoundingBox = Rect::Invalid;
m_clipper = getClipper(state.clip_path());
m_masker = getMasker(state.mask());
m_opacity = state.opacity();

m_font_size = state.font_size();
m_display = state.display();
m_overflow = state.overflow();
m_visibility = state.visibility();
m_opacity = state.opacity();

m_paintBoundingBox = Rect::Invalid;
m_clipper = getClipper(state.clip_path());
m_masker = getMasker(state.mask());
}

void SVGElement::layoutChildren(SVGLayoutState& state)
Expand Down
10 changes: 5 additions & 5 deletions source/svgelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ class SVGElement : public SVGNode {
bool isElement() const final { return true; }

private:
mutable Rect m_paintBoundingBox = Rect::Invalid;
const SVGClipPathElement* m_clipper = nullptr;
const SVGMaskElement* m_masker = nullptr;
float m_opacity = 1.f;

float m_font_size = 12.f;
Display m_display = Display::Inline;
Overflow m_overflow = Overflow::Visible;
Expand All @@ -200,11 +205,6 @@ class SVGElement : public SVGNode {
AttributeList m_attributes;
SVGPropertyList m_properties;
SVGNodeList m_children;

mutable Rect m_paintBoundingBox = Rect::Invalid;
const SVGClipPathElement* m_clipper = nullptr;
const SVGMaskElement* m_masker = nullptr;
float m_opacity = 1.f;
};

inline const SVGElement* toSVGElement(const SVGNode* node)
Expand Down
6 changes: 3 additions & 3 deletions source/svgtextelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static float calculateBaselineOffset(const SVGTextPositioningElement* element)
}

auto baseline = element->alignment_baseline();
if(baseline == AlignmentBaseline::Baseline || baseline == AlignmentBaseline::Auto) {
if(baseline == AlignmentBaseline::Auto || baseline == AlignmentBaseline::Baseline) {
baseline = resolveDominantBaseline(element);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ static float calculateBaselineOffset(const SVGTextPositioningElement* element)
static bool needsTextAnchorAdjustment(const SVGTextPositioningElement* element)
{
auto direction = element->direction();
switch (element->text_anchor()) {
switch(element->text_anchor()) {
case TextAnchor::Start:
return direction == Direction::Rtl;
case TextAnchor::Middle:
Expand All @@ -111,7 +111,7 @@ static bool needsTextAnchorAdjustment(const SVGTextPositioningElement* element)
static float calculateTextAnchorOffset(const SVGTextPositioningElement* element, float width)
{
auto direction = element->direction();
switch (element->text_anchor()) {
switch(element->text_anchor()) {
case TextAnchor::Start:
if(direction == Direction::Ltr)
return 0.f;
Expand Down

0 comments on commit dab9e11

Please sign in to comment.