Skip to content

Commit 8bd4d40

Browse files
committed
chg: somewhat taint safe Blizzard_WorldMap -- until we allow it to be moved...
1 parent e651ea6 commit 8bd4d40

1 file changed

Lines changed: 138 additions & 26 deletions

File tree

Skin/Interface/AddOns/Blizzard_WorldMap/Blizzard_WorldMap.lua

Lines changed: 138 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,30 @@ end
2929

3030
do --[[ AddOns\Blizzard_WorldMap.xml ]]
3131
do --[[ Blizzard_WorldMapTemplates.xml ]]
32+
-- TAINT-SAFE: Only use widget API calls (Hide, SetAlpha, SetTexture,
33+
-- SetPoint, etc.) on existing objects. Avoid FrameTypeButton,
34+
-- Base.SetBackdrop, CreateTexture, CreateLine, CreateFrame, direct
35+
-- Lua table writes, and HookScript — all of these mark the
36+
-- WorldMapFrame child hierarchy as addon-modified at the C level and
37+
-- propagate taint into the secure pin-creation path
38+
-- (AcquirePin → CheckMouseButtonPassthrough → SetPassThroughButtons).
3239
function Skin.WorldMapFloorNavigationFrameTemplate(Button)
33-
Skin.DropdownButton(Button)
40+
-- DropdownButton uses Base.SetBackdrop (CreateTexture) and direct
41+
-- table writes (_auroraSkinned, _auroraTextures). Only hide the
42+
-- existing decorations instead.
43+
if Button.Left then Button.Left:SetAlpha(0) end
44+
if Button.Middle then Button.Middle:SetAlpha(0) end
45+
if Button.Right then Button.Right:SetAlpha(0) end
46+
if Button.Background then Button.Background:Hide() end
47+
if Button.TopEdge then Button.TopEdge:Hide() end
48+
if Button.TopLeftCorner then Button.TopLeftCorner:Hide() end
49+
if Button.TopRightCorner then Button.TopRightCorner:Hide() end
50+
if Button.BottomEdge then Button.BottomEdge:Hide() end
51+
if Button.BottomLeftCorner then Button.BottomLeftCorner:Hide() end
52+
if Button.BottomRightCorner then Button.BottomRightCorner:Hide() end
53+
if Button.LeftEdge then Button.LeftEdge:Hide() end
54+
if Button.RightEdge then Button.RightEdge:Hide() end
55+
if Button.Arrow then Button.Arrow:SetAlpha(0) end
3456
end
3557
function Skin.WorldMapTrackingOptionsButtonTemplate(Button)
3658
Button:GetRegions():SetPoint("TOPRIGHT")
@@ -44,31 +66,32 @@ do --[[ AddOns\Blizzard_WorldMap.xml ]]
4466
function Skin.WorldMapShowLegendButtonTemplate(Button)
4567
end
4668
function Skin.WorldMapNavBarTemplate(Frame)
47-
Skin.NavBarTemplate(Frame) -- this is skinned from hooks in NavigationBar.lua
69+
-- NavBarTemplate uses FrameTypeButton (direct table writes +
70+
-- HookScript) on overflow and home buttons. Only hide existing
71+
-- decorations and reposition text here.
72+
Frame:GetRegions():Hide()
73+
Frame.overlay:Hide()
74+
Frame.overflow:SetWidth(28)
75+
local tex = Frame.overflow:GetNormalTexture()
76+
if tex then
77+
tex:SetPoint("TOPLEFT", 10, -5)
78+
tex:SetPoint("BOTTOMRIGHT", -10, 5)
79+
Base.SetTexture(tex, "arrowLeft")
80+
end
81+
Frame.home:GetRegions():Hide()
82+
Frame.home.text:SetPoint("RIGHT", -10, 0)
4883
Frame.InsetBorderBottomLeft:Hide()
4984
Frame.InsetBorderBottomRight:Hide()
5085
Frame.InsetBorderBottom:Hide()
5186
Frame.InsetBorderLeft:Hide()
5287
Frame.InsetBorderRight:Hide()
5388
end
5489

55-
local function SkinQuestToggle(Button, arrowDir)
56-
Skin.FrameTypeButton(Button)
57-
Button:SetAllPoints()
58-
59-
local arrow = Button:CreateTexture(nil, "ARTWORK")
60-
arrow:SetPoint("TOPLEFT", 5, -9)
61-
arrow:SetPoint("BOTTOMRIGHT", -20, 9)
62-
arrow:SetVertexColor(Color.yellow:GetRGB())
63-
Base.SetTexture(arrow, "arrow"..arrowDir)
64-
65-
local quest = Button:CreateTexture(nil, "ARTWORK")
66-
quest:SetAtlas("questlog-waypoint-finaldestination-questionmark", true)
67-
quest:SetPoint("TOPLEFT", 11, -1)
68-
end
6990
function Skin.WorldMapSidePanelToggleTemplate(Frame)
70-
SkinQuestToggle(Frame.OpenButton, "Right")
71-
SkinQuestToggle(Frame.CloseButton, "Left")
91+
-- SkinQuestToggle used FrameTypeButton + CreateTexture. Skip the
92+
-- full skin to avoid taint; only adjust points.
93+
Frame.OpenButton:SetAllPoints()
94+
Frame.CloseButton:SetAllPoints()
7295
end
7396
function Skin.WorldMapZoneTimerTemplate(Frame)
7497
end
@@ -87,16 +110,105 @@ function private.AddOns.Blizzard_WorldMap()
87110
----====####$$$$%%%%%$$$$####====----
88111
-- Blizzard_WorldMap --
89112
----====####$$$$%%%%%$$$$####====----
113+
-- TAINT-SAFE version: WorldMapFrame's OnShow runs in a secure context
114+
-- from the TOGGLEWORLDMAP keybinding. Any addon-created children
115+
-- (CreateTexture/CreateLine/CreateFrame), direct Lua table writes
116+
-- (frame.key = value), or HookScript calls on frames in this hierarchy
117+
-- mark the frame tree as addon-modified at the C level. When the secure
118+
-- OnShow then calls PlayerMovementFrameFader.AddDeferredFrame, the taint
119+
-- propagates into the fadingFrames table and poisons every subsequent
120+
-- OnUpdate tick, eventually blocking SetPassThroughButtons on map pins.
121+
--
122+
-- Only widget API calls (Hide, SetTexture, SetPoint, SetAlpha, SetSize,
123+
-- SetFrameLevel, SetFrameStrata, ClearAllPoints, ClearNormalTexture, etc.)
124+
-- and hooksecurefunc are safe here.
90125
local WorldMapFrame = _G.WorldMapFrame
91126
Skin.WorldMapFrameTemplate(WorldMapFrame)
92-
Util.Mixin(WorldMapFrame, Hook.WorldMapMixin)
93-
Skin.PortraitFrameTemplate(WorldMapFrame.BorderFrame)
94-
WorldMapFrame.BorderFrame:SetFrameStrata(WorldMapFrame:GetFrameStrata())
95-
96-
WorldMapFrame.BorderFrame.InsetBorderTop:Hide()
97-
Skin.MainHelpPlateButton(WorldMapFrame.BorderFrame.Tutorial)
98-
WorldMapFrame.BorderFrame.Tutorial:SetPoint("TOPLEFT", WorldMapFrame, "TOPLEFT", -15, 15)
99-
Skin.MaximizeMinimizeButtonFrameTemplate(WorldMapFrame.BorderFrame.MaximizeMinimizeFrame)
127+
Util.Mixin(WorldMapFrame, Hook.WorldMapMixin) -- hooksecurefunc, safe
128+
129+
-- PortraitFrameTemplate: manual taint-safe reimplementation.
130+
-- Skipped: Skin.NineSlicePanelTemplate (direct writes + SetBackdrop →
131+
-- CreateTexture), Skin.UIPanelCloseButton (FrameTypeButton →
132+
-- direct writes + HookScript + CreateLine), Skin.MaximizeMinimize-
133+
-- ButtonFrameTemplate (FrameTypeButton + CreateLine + CreateTexture).
134+
local BorderFrame = WorldMapFrame.BorderFrame
135+
Util.Mixin(BorderFrame, Hook.PortraitFrameMixin) -- hooksecurefunc, safe
136+
137+
-- NineSlice: hide all ornate border textures. This replaces
138+
-- Skin.NineSlicePanelTemplate which uses direct writes (_auroraNineSlice)
139+
-- and Base.SetBackdrop (mass table writes + CreateTexture).
140+
local ns = BorderFrame.NineSlice
141+
ns:SetFrameLevel(BorderFrame:GetFrameLevel() + 1)
142+
for _, region in next, {ns:GetRegions()} do
143+
region:SetAlpha(0)
144+
end
145+
146+
-- Darken existing Bg texture to serve as the frame backdrop.
147+
local frameBg = BorderFrame.Bg
148+
if frameBg then
149+
frameBg:ClearAllPoints()
150+
frameBg:SetAllPoints(BorderFrame)
151+
local r, g, b = Color.frame:GetRGB()
152+
frameBg:SetColorTexture(r, g, b, Util.GetFrameAlpha())
153+
end
154+
155+
BorderFrame.PortraitContainer:Hide()
156+
BorderFrame.TitleContainer:SetHeight(private.FRAME_TITLE_HEIGHT)
157+
BorderFrame.TitleContainer:SetPoint("TOPLEFT", 24, -1)
158+
local titleText = BorderFrame.TitleContainer.TitleText
159+
titleText:ClearAllPoints()
160+
titleText:SetPoint("TOPLEFT", BorderFrame.TitleContainer)
161+
titleText:SetPoint("BOTTOMRIGHT", BorderFrame.TitleContainer)
162+
if BorderFrame.TopTileStreaks then
163+
BorderFrame.TopTileStreaks:SetTexture("")
164+
end
165+
166+
BorderFrame:SetFrameStrata(WorldMapFrame:GetFrameStrata())
167+
BorderFrame.InsetBorderTop:Hide()
168+
169+
-- Helper: style a title-bar button as a dark square with a text icon.
170+
-- Uses only widget API (SetNormalTexture, SetText, etc.) — no table
171+
-- writes, no CreateTexture/CreateLine, no HookScript.
172+
local function StyleTitleButton(btn, text)
173+
btn:SetSize(22, 22)
174+
btn:SetNormalTexture("Interface\\Buttons\\White8x8")
175+
btn:GetNormalTexture():SetVertexColor(Color.button:GetRGB())
176+
btn:SetPushedTexture("Interface\\Buttons\\White8x8")
177+
btn:GetPushedTexture():SetVertexColor(0.15, 0.15, 0.15)
178+
btn:SetDisabledTexture("Interface\\Buttons\\White8x8")
179+
btn:GetDisabledTexture():SetVertexColor(0.15, 0.15, 0.15, 0.5)
180+
btn:SetHighlightTexture("Interface\\Buttons\\White8x8", "ADD")
181+
btn:GetHighlightTexture():SetVertexColor(1, 1, 1)
182+
btn:GetHighlightTexture():SetAlpha(0.25)
183+
btn:SetNormalFontObject("GameFontHighlightLarge")
184+
btn:SetHighlightFontObject("GameFontHighlightLarge")
185+
btn:SetDisabledFontObject("GameFontDisableLarge")
186+
btn:SetText(text)
187+
btn:SetPushedTextOffset(1, -1)
188+
if btn.Border then btn.Border:SetAlpha(0) end
189+
end
190+
191+
-- CloseButton: dark square with X icon.
192+
if BorderFrame.CloseButton then
193+
StyleTitleButton(BorderFrame.CloseButton, "\195\151") -- × (U+00D7)
194+
end
195+
196+
-- MaximizeMinimize: dark squares with arrow icons matching the old Aurora
197+
-- style as closely as possible. Original used CreateLine (unsafe) for
198+
-- diagonal + corner bars; we approximate with Unicode arrows.
199+
local maxMin = BorderFrame.MaximizeMinimizeFrame
200+
if maxMin then
201+
if maxMin.MaximizeButton then
202+
StyleTitleButton(maxMin.MaximizeButton, "\226\134\151") -- ↗ (U+2197)
203+
end
204+
if maxMin.MinimizeButton then
205+
StyleTitleButton(maxMin.MinimizeButton, "\226\134\153") -- ↙ (U+2199)
206+
end
207+
end
208+
209+
Skin.MainHelpPlateButton(BorderFrame.Tutorial) -- only Hide + SetPoint, safe
210+
BorderFrame.Tutorial:SetPoint("TOPLEFT", WorldMapFrame, "TOPLEFT", -15, 15)
211+
100212
Skin.WorldMapFloorNavigationFrameTemplate(WorldMapFrame.overlayFrames[1])
101213
Skin.WorldMapTrackingOptionsButtonTemplate(WorldMapFrame.overlayFrames[2])
102214
WorldMapFrame.overlayFrames[2]:SetPoint("TOPRIGHT", WorldMapFrame:GetCanvasContainer(), "TOPRIGHT", 0, 0)

0 commit comments

Comments
 (0)